Switch to unified view

a/src/main.cxx b/src/main.cxx
...
...
625
        if (loglevel != LibUPnP::LogLevelNone) {
625
        if (loglevel != LibUPnP::LogLevelNone) {
626
            mylib->setLogFileName(cp, LibUPnP::LogLevel(loglevel));
626
            mylib->setLogFileName(cp, LibUPnP::LogLevel(loglevel));
627
        }
627
        }
628
    }
628
    }
629
629
630
    // Create unique ID
630
    // Create unique IDs for renderer and possible media server
631
    UDevIds ids;
632
    ids.fname = friendlyname;
631
    string UUID = LibUPnP::makeDevUUID(friendlyname, hwaddr);
633
    ids.uuid =  LibUPnP::makeDevUUID(ids.fname, hwaddr);
634
    if (!g_config || !g_config->get("msfriendlyname", ids.fnameMS)) {
635
        ids.fnameMS = ids.fname + "-mediaserver";
636
    }
637
    ids.uuidMS = LibUPnP::makeDevUUID(ids.fnameMS, hwaddr);
638
632
639
633
    // If running as mediaserver only, make sure we don't conflict
640
    // If running as mediaserver only, make sure we don't conflict
634
    // with a possible renderer
641
    // with a possible renderer
635
    if (msonly) {
642
    if (msonly) {
636
        pidfilename = pidfilename + "-ms";
643
        pidfilename = pidfilename + "-ms";
637
    }
644
    }
638
645
639
    // Initialize the data we serve through HTTP (device and service
646
    // Initialize the data we serve through HTTP (device and service
640
    // descriptions, icons, presentation page, etc.)
647
    // descriptions, icons, presentation page, etc.)
641
    unordered_map<string, VDirContent> files;
648
    unordered_map<string, VDirContent> files;
642
    if (!initHttpFs(files, g_datadir, UUID, friendlyname, enableAV, enableOH,
649
    if (!initHttpFs(files, g_datadir, ids, enableAV, enableOH,
643
                    !senderpath.empty(), inprocessms,
650
                    !senderpath.empty(), inprocessms, msonly,
644
                    msonly, iconpath, presentationhtml)) {
651
                    iconpath, presentationhtml)) {
645
        exit(1);
652
        exit(1);
646
    }
653
    }
647
654
648
    if (ownqueue)
655
    if (ownqueue)
649
        opts.options |= UpMpd::upmpdOwnQueue;
656
        opts.options |= UpMpd::upmpdOwnQueue;
...
...
662
    }
669
    }
663
670
664
    if (!enableAV)
671
    if (!enableAV)
665
        opts.options |= UpMpd::upmpdNoAV;
672
        opts.options |= UpMpd::upmpdNoAV;
666
673
667
    UpMpd *mediarenderer = nullptr;
674
    UpMpd *mediarenderer{nullptr};
668
    if (!msonly) {
675
    if (!msonly) {
669
        mediarenderer = new UpMpd(string("uuid:") + UUID, friendlyname,
676
        mediarenderer = new UpMpd(string("uuid:") + ids.uuid, ids.fname,
670
                                  ohProductDesc, files, mpdclip, opts);
677
                                  ohProductDesc, files, mpdclip, opts);
671
    }
678
    }
672
679
673
    MediaServer *mediaserver = nullptr;
680
    MediaServer *mediaserver = nullptr;
674
    unordered_map<string, VDirContent> emptyfiles =
681
    unordered_map<string, VDirContent> emptyfiles =
...
...
685
            msfiles = &files;
692
            msfiles = &files;
686
        }
693
        }
687
    // Create the Media Server embedded device object. There needs
694
    // Create the Media Server embedded device object. There needs
688
    // be no reference to the root object because there can be
695
    // be no reference to the root object because there can be
689
    // only one (libupnp restriction)
696
    // only one (libupnp restriction)
690
    mediaserver = new MediaServer(string("uuid:") + uuidMediaServer(UUID),
697
    mediaserver = new MediaServer(string("uuid:") + ids.uuidMS, ids.fnameMS,
691
                                      friendlyNameMediaServer(friendlyname),
692
                                      *msfiles);
698
                                      *msfiles);
693
    } else if (enableMediaServer) {
699
    } else if (enableMediaServer) {
694
        // Fork process for media server, replacing whatever -m option
700
        // Fork process for media server, replacing whatever -m option
695
        // was given with -m 2 (ms only)
701
        // was given with -m 2 (ms only)
696
        string cmdpath(savedargs[0]);
702
        string cmdpath(savedargs[0]);