Switch to unified view

a/src/mediaserver/contentdirectory.cxx b/src/mediaserver/contentdirectory.cxx
...
...
66
        return nullptr;
66
        return nullptr;
67
        }
67
        }
68
            port = usport;
68
            port = usport;
69
        LOGDEB("ContentDirectory: host "<< host<< " port " << port << endl);
69
        LOGDEB("ContentDirectory: host "<< host<< " port " << port << endl);
70
    }
70
    }
71
  if (!appname.compare("tidal")) {
72
      return new PlgWithSlave("tidal", service);
71
        return new PlgWithSlave(appname, service);
73
        } else if (!appname.compare("qobuz")) {
74
      return new PlgWithSlave("qobuz", service);
75
        } else if (!appname.compare("gmusic")) {
76
      return new PlgWithSlave("gmusic", service);
77
  } else {
78
      return nullptr;
79
  }
80
    }
72
    }
81
    CDPlugin *pluginForApp(const string& appname) {
73
    CDPlugin *pluginForApp(const string& appname) {
82
    auto it = plugins.find(appname);
74
    auto it = plugins.find(appname);
83
    if (it != plugins.end()) {
75
    if (it != plugins.end()) {
84
        return it->second;
76
        return it->second;
...
...
158
150
159
static vector<UpSong> rootdir;
151
static vector<UpSong> rootdir;
160
static bool makerootdir()
152
static bool makerootdir()
161
{
153
{
162
    rootdir.clear();
154
    rootdir.clear();
163
    if (g_config->hasNameAnywhere("gmusicuser")) {
155
    string pathplg = path_cat(g_datadir, "cdplugins");
164
        rootdir.push_back(UpSong::container("0$gmusic$", "0", "Google Music"));
156
    string reason;
157
    set<string> entries;
158
    if (!readdir(pathplg, reason, entries)) {
159
        LOGERR("ContentDirectory::makerootdir: can't read " << pathplg <<
160
               " : " << reason << endl);
161
        return false;
162
    }
163
164
    for (const auto& entry : entries) {
165
        if (!entry.compare("pycommon")) {
166
            continue;
165
    }
167
        }
168
        // We compute the title from the plugin name. Maybe it would
169
        // be better to have it as a parameter either in the plugin
170
        // directory (somehow), or in the global config
171
        string title = stringtoupper((const string&)entry.substr(0,1)) +
172
            entry.substr(1, entry.size()-1);
173
        string userparam = entry + "user";
166
    if (g_config->hasNameAnywhere("qobuzuser")) {
174
        if (g_config->hasNameAnywhere(userparam)) {
167
        rootdir.push_back(UpSong::container("0$qobuz$", "0", "Qobuz"));
175
            rootdir.push_back(UpSong::container("0$" + entry + "$",
176
                                                "0", title));
168
    }
177
        }
169
    if (g_config->hasNameAnywhere("tidaluser")) {
170
        rootdir.push_back(UpSong::container("0$tidal$", "0", "Tidal"));
171
    }
178
    }
172
179
173
    if (rootdir.empty()) {
180
    if (rootdir.empty()) {
174
        // This should not happen, as we only start the CD if services
181
        // This should not happen, as we only start the CD if services
175
        // are configured !
182
        // are configured !