Skip to content

Commit

Permalink
fixed: store playcount/settings based on plugin:// urls
Browse files Browse the repository at this point in the history
the resolved video url isn't very useful as it's usually volatile.
plugin:// urls however, are often static.
  • Loading branch information
spiff committed Nov 10, 2011
1 parent f5a41e1 commit dbee53c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions xbmc/utils/SaveFileStateJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class CSaveFileStateJob : public CJob
bool CSaveFileStateJob::DoWork()
{
CStdString progressTrackingFile = m_item.GetPath();
if (m_item.HasProperty("original_listitem_url"))
progressTrackingFile = m_item.GetProperty("original_listitem_url").asString();

if (m_item.IsDVD())
progressTrackingFile = m_item.GetVideoInfoTag()->m_strFileNameAndPath; // this variable contains removable:// suffixed by disc label+uniqueid or is empty if label not uniquely identified
Expand Down
29 changes: 25 additions & 4 deletions xbmc/video/VideoDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3563,8 +3563,14 @@ bool CVideoDatabase::GetPlayCounts(const CStdString &strPath, CFileItemList &ite

return ret;
}

int pathID = GetPathId(strPath);
int pathID;
if (URIUtils::IsPlugin(strPath))
{
CURL url(strPath);
pathID = GetPathId(url.GetWithoutFilename());
}
else
pathID = GetPathId(strPath);
if (pathID < 0)
return false; // path (and thus files) aren't in the database

Expand Down Expand Up @@ -3657,7 +3663,15 @@ void CVideoDatabase::UpdateFanart(const CFileItem &item, VIDEODB_CONTENT_TYPE ty

void CVideoDatabase::SetPlayCount(const CFileItem &item, int count, const CStdString &date)
{
int id = AddFile(item);
int id;
if (item.HasProperty("original_listitem_url"))
{
CFileItem item2(item);
item2.SetPath(item.GetProperty("original_listitem_url").asString());
id = AddFile(item2);
}
else
id = AddFile(item);
if (id < 0)
return;

Expand Down Expand Up @@ -7671,7 +7685,8 @@ bool CVideoDatabase::ArbitraryExec(const CStdString& strExec)

void CVideoDatabase::ConstructPath(CStdString& strDest, const CStdString& strPath, const CStdString& strFileName)
{
if (URIUtils::IsStack(strFileName) || URIUtils::IsInArchive(strFileName))
if (URIUtils::IsStack(strFileName) ||
URIUtils::IsInArchive(strFileName) || URIUtils::IsPlugin(strPath))
strDest = strFileName;
else
URIUtils::AddFileToFolder(strPath, strFileName, strDest);
Expand All @@ -7684,6 +7699,12 @@ void CVideoDatabase::SplitPath(const CStdString& strFileNameAndPath, CStdString&
URIUtils::GetParentPath(strFileNameAndPath,strPath);
strFileName = strFileNameAndPath;
}
else if (URIUtils::IsPlugin(strFileNameAndPath))
{
CURL url(strFileNameAndPath);
strPath = url.GetWithoutFilename();
strFileName = strFileNameAndPath;
}
else
URIUtils::Split(strFileNameAndPath,strPath, strFileName);
}
Expand Down

0 comments on commit dbee53c

Please sign in to comment.