Updates for listing DAAP shares

This commit is contained in:
Tobias Rundstrom 2006-08-23 20:43:30 -04:00
parent 95ff470248
commit 33bb42e8be

View file

@ -74,21 +74,28 @@ BrowseModel::list_cb (const Xmms::List< Xmms::Dict > &res)
} }
for (res.first (); res.isValid (); ++res) { for (res.first (); res.isValid (); ++res) {
const char *tmp;
Xmms::Dict d = *res; Xmms::Dict d = *res;
if (!d.contains ("path")) if (!d.contains ("path"))
continue; continue;
tmp = xmmsc_result_decode_url (NULL, d.get<std::string> ("path").c_str ()); QString path = QString::fromStdString (d.get<std::string> ("path"));
QString path = QString::fromUtf8 (tmp);
free ((char *)tmp);
QString name; QString name;
if (d.contains ("name")) { if (d.contains ("name")) {
name = QString::fromStdString ((*res).get<std::string> ("name")); name = QString::fromStdString ((*res).get<std::string> ("name"));
} else { } else {
name = path.mid (path.lastIndexOf ("/")+1); if (d.contains ("title") && d.contains ("artist")) {
name += QString::fromStdString (d.get<std::string> ("artist"));
name += " - ";
name += QString::fromStdString (d.get<std::string> ("title"));
} else {
const char *tmp;
QString tmp2 = path.mid (path.lastIndexOf ("/")+1);
tmp = xmmsc_result_decode_url (NULL, tmp2.toAscii ());
name = QString::fromUtf8 (tmp);
free ((char *)tmp);
}
} }
bool isdir = (*res).get<int32_t> ("isdir"); bool isdir = (*res).get<int32_t> ("isdir");