Permalink
Browse files

[resume] use CBookmark::IsSet and CBookmark::IsPartWay for various sp…

…ots we check for whether we've set or partly played an item.

Two places need thought:
1. VideoInfoScanner - currently we test IsPartWay() before setting the bookmark (if the user is importing bookmarks).
   Using IsSet() may be more appropriate if this routine can be used to override whatever is in the database already.

2. ThumbLoader.cpp - this used to also check m_resumePoint.type == CBookmark::RESUME. However, nothing sets this to anything
   other than resume.
  • Loading branch information...
1 parent 6ba6095 commit ba91333f2bef72e712beff7fa2ab1ea1f5c471b1 Jonathan Marshall committed Jul 8, 2012
View
@@ -3822,7 +3822,7 @@ bool CGUIInfoManager::GetItemInt(int &value, const CGUIListItem *item, int info)
switch (info)
{
case LISTITEM_PERCENT_PLAYED:
- if (item->IsFileItem() && ((const CFileItem *)item)->HasVideoInfoTag() && ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds > 0 && ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.timeInSeconds > 0)
+ if (item->IsFileItem() && ((const CFileItem *)item)->HasVideoInfoTag() && ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.IsPartWay())
value = (int)(100 * ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.timeInSeconds / ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds);
else
value = 0;
View
@@ -199,8 +199,7 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
m_database->Open();
// resume point
- if (pItem->HasVideoInfoTag() &&
- pItem->GetVideoInfoTag()->m_resumePoint.type != CBookmark::RESUME && pItem->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds == 0)
+ if (pItem->HasVideoInfoTag() && !pItem->GetVideoInfoTag()->m_resumePoint.IsSet())
{
if (m_database->GetResumePoint(*pItem->GetVideoInfoTag()))
pItem->SetInvalid();
@@ -1106,7 +1106,7 @@ namespace VIDEO
m_database.SetPlayCount(*pItem, movieDetails.m_playCount, movieDetails.m_lastPlayed);
if ((g_advancedSettings.m_bVideoLibraryImportResumePoint || libraryImport) &&
- movieDetails.m_resumePoint.timeInSeconds > 0.0f && movieDetails.m_resumePoint.totalTimeInSeconds > 0.0f)
+ movieDetails.m_resumePoint.IsPartWay())
m_database.AddBookMarkToFile(pItem->GetPath(), movieDetails.m_resumePoint, CBookmark::RESUME);
m_database.Close();
@@ -536,7 +536,7 @@ void CVideoInfoTag::ToSortable(SortItem& sortable)
sortable[FieldSubtitleLanguage] = m_streamDetails.GetSubtitleLanguage();
- sortable[FieldInProgress] = m_resumePoint.timeInSeconds > 0 && m_resumePoint.totalTimeInSeconds > 0;
+ sortable[FieldInProgress] = m_resumePoint.IsPartWay();
sortable[FieldDateAdded] = m_dateAdded.IsValid() ? m_dateAdded.GetAsDBDateTime() : StringUtils::EmptyString;
sortable[FieldMediaType] = DatabaseUtils::MediaTypeFromString(m_type);
}
@@ -827,7 +827,7 @@ void CGUIWindowVideoBase::GetResumeItemOffset(const CFileItem *item, int& starto
if (!item->IsNFO() && !item->IsPlayList())
{
- if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_resumePoint.timeInSeconds > 0.0)
+ if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_resumePoint.IsPartWay())
{
startoffset = (int)(item->GetVideoInfoTag()->m_resumePoint.timeInSeconds*75);
partNumber = item->GetVideoInfoTag()->m_resumePoint.partNumber;

0 comments on commit ba91333

Please sign in to comment.