Exemple #1
0
Playlist::Entries SIDPlay::fetchTracks(const QString &url, bool &ok)
{
	Playlist::Entries entries;
	if (open(url, true))
	{
		const int tracks = m_tune->getInfo()->songs();
		for (int i = 0; i < tracks; ++i)
		{
			const SidTuneInfo *info = m_tune->getInfo(i);
			if (info)
			{
				Playlist::Entry entry;
				entry.url = SIDPlayName + QString("://{%1}%2").arg(m_url).arg(i);
				entry.name = getTitle(info, i);
				entry.length = m_length;
				entries.append(entry);
			}
		}
		if (entries.length() > 1)
		{
			for (int i = 0; i < entries.length(); ++i)
				entries[i].parent = 1;
			Playlist::Entry entry;
			entry.name = Functions::fileName(m_url, false);
			entry.url = m_url;
			entry.GID = 1;
			entries.prepend(entry);
		}
	}
	ok = !entries.isEmpty();
	return entries;
}
Exemple #2
0
Playlist::Entries GME::fetchTracks(const QString &url, bool &ok)
{
	Playlist::Entries entries;
	if (open(url, true))
	{
		const int tracks = gme_track_count(m_gme);
		for (int i = 0; i < tracks; ++i)
		{
			gme_info_t *info = NULL;
			if (!gme_track_info(m_gme, &info, i) && info)
			{
				Playlist::Entry entry;
				entry.url = GMEName + QString("://{%1}%2").arg(m_url).arg(i);
				entry.name = getTitle(info, i);
				entry.length = getLength(info);
				gme_free_info(info);
				entries.append(entry);
			}
		}
		if (entries.length() > 1)
		{
			for (int i = 0; i < entries.length(); ++i)
				entries[i].parent = 1;
			Playlist::Entry entry;
			entry.name = Functions::fileName(m_url, false);
			entry.url = m_url;
			entry.GID = 1;
			entries.prepend(entry);
		}
	}
	ok = !entries.isEmpty();
	return entries;
}