aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Piechowiak <misiek.piechowiak@gmail.com>2012-06-19 01:38:24 -0700
committerMichal Piechowiak <misiek.piechowiak@gmail.com>2012-06-19 01:38:24 -0700
commit12f23d2694a9aee989a9687733333864a8b0ee1c (patch)
tree4aaf3463485486952ae3172eda5cdc6d15870729
parent35e9b07f2765f402458ea441c9433d78c9893d51 (diff)
parent2b74a4d88810f420a92135d47b126863c5371210 (diff)
Merge pull request #955 from pieh/is_same_path_resume
compare dedicated item_start property instead of multi purpose startoffset member to determine if FileItem represents same item
-rw-r--r--xbmc/FileItem.cpp16
-rw-r--r--xbmc/music/MusicDatabase.cpp1
2 files changed, 12 insertions, 5 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index 37d96d01a4..6840e6fe0c 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -74,6 +74,7 @@ CFileItem::CFileItem(const CSong& song)
m_strPath = song.strFileName;
GetMusicInfoTag()->SetSong(song);
m_lStartOffset = song.iStartOffset;
+ SetProperty("item_start", song.iStartOffset);
m_lEndOffset = song.iEndOffset;
m_strThumbnailImage = song.strThumb;
}
@@ -1148,29 +1149,34 @@ bool CFileItem::IsSamePath(const CFileItem *item) const
if (!item)
return false;
- if (item->GetPath() == m_strPath && item->m_lStartOffset == m_lStartOffset) return true;
+ if (item->GetPath() == m_strPath)
+ {
+ if (item->HasProperty("item_start") || HasProperty("item_start"))
+ return (item->GetProperty("item_start") == GetProperty("item_start"));
+ return true;
+ }
if (IsMusicDb() && HasMusicInfoTag())
{
CFileItem dbItem(m_musicInfoTag->GetURL(), false);
- dbItem.m_lStartOffset = m_lStartOffset;
+ dbItem.SetProperty("item_start", GetProperty("item_start"));
return dbItem.IsSamePath(item);
}
if (IsVideoDb() && HasVideoInfoTag())
{
CFileItem dbItem(m_videoInfoTag->m_strFileNameAndPath, false);
- dbItem.m_lStartOffset = m_lStartOffset;
+ dbItem.SetProperty("item_start", GetProperty("item_start"));
return dbItem.IsSamePath(item);
}
if (item->IsMusicDb() && item->HasMusicInfoTag())
{
CFileItem dbItem(item->m_musicInfoTag->GetURL(), false);
- dbItem.m_lStartOffset = item->m_lStartOffset;
+ dbItem.SetProperty("item_start", item->GetProperty("item_start"));
return IsSamePath(&dbItem);
}
if (item->IsVideoDb() && item->HasVideoInfoTag())
{
CFileItem dbItem(item->m_videoInfoTag->m_strFileNameAndPath, false);
- dbItem.m_lStartOffset = item->m_lStartOffset;
+ dbItem.SetProperty("item_start", item->GetProperty("item_start"));
return IsSamePath(&dbItem);
}
if (HasProperty("original_listitem_url"))
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index d9a3636387..8010d9f146 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -870,6 +870,7 @@ void CMusicDatabase::GetFileItemFromDataset(const dbiplus::sql_record* const rec
item->GetMusicInfoTag()->SetTitle(record->at(song_strTitle).get_asString());
item->SetLabel(record->at(song_strTitle).get_asString());
item->m_lStartOffset = record->at(song_iStartOffset).get_asInt();
+ item->SetProperty("item_start", item->m_lStartOffset);
item->m_lEndOffset = record->at(song_iEndOffset).get_asInt();
item->GetMusicInfoTag()->SetMusicBrainzTrackID(record->at(song_strMusicBrainzTrackID).get_asString());
item->GetMusicInfoTag()->SetMusicBrainzArtistID(record->at(song_strMusicBrainzArtistID).get_asString());