Moved title attribution logic from PlaylistDiscoveryService to Playlist to make the titles consistent.

git-svn-id: http://svn.purei.org/purei/trunk@1307 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
jpd002 2014-05-24 05:09:35 +00:00 committed by Jean-Philip Desjardins
parent d6b21dd67e
commit 0af6278a45
3 changed files with 12 additions and 22 deletions

View File

@ -80,8 +80,15 @@ bool CPlaylist::IsLoadableExtension(const std::string& extension)
void CPlaylist::PopulateItemFromTags(ITEM& item, const CPsfTags& tags)
{
item.title = tags.GetTagValue("title");
item.length = CPsfTags::ConvertTimeString(tags.GetTagValue("length").c_str());
if(tags.HasTag("title"))
{
item.title = tags.GetTagValue("title");
}
else
{
item.title = item.path;
}
item.length = CPsfTags::ConvertTimeString(tags.GetTagValue("length").c_str());
}
unsigned int CPlaylist::InsertArchive(const std::wstring& path)

View File

@ -66,8 +66,7 @@ void CPlaylistDiscoveryService::ProcessPendingItems(CPlaylist& playlist)
if(itemIdx != -1)
{
CPlaylist::ITEM item = playlist.GetItem(itemIdx);
item.title = result.title;
item.length = result.length;
CPlaylist::PopulateItemFromTags(item, result.tags);
playlist.UpdateItem(itemIdx, item);
}
}
@ -95,22 +94,7 @@ void CPlaylistDiscoveryService::ThreadProc()
RESULT result;
result.runId = command.runId;
result.itemId = command.itemId;
result.length = 0;
if(tags.HasTag("title"))
{
result.title = tags.GetTagValue("title");
}
else
{
result.title = command.filePath.GetWidePath();
}
if(tags.HasTag("length"))
{
result.length = tags.ConvertTimeString(tags.GetTagValue("length").c_str());
}
result.tags = tags;
pendingResults.push_back(result);
}
catch(...)

View File

@ -33,8 +33,7 @@ private:
{
unsigned int runId;
unsigned int itemId;
std::wstring title;
double length;
CPsfTags tags;
};
typedef std::deque<COMMAND> CommandQueue;