Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add resume point to database if available (e.g. in <resume> from an N…

…FO, must be enabled in as.xml)
  • Loading branch information...
commit 894f4c3ac35f5e6c00701719106bc4be86fcc3a3 1 parent 7039846
@Montellese authored
View
2  xbmc/settings/AdvancedSettings.cpp
@@ -214,6 +214,7 @@ void CAdvancedSettings::Initialize()
m_bVideoLibraryCleanOnUpdate = false;
m_bVideoLibraryExportAutoThumbs = false;
m_bVideoLibraryImportWatchedState = false;
+ m_bVideoLibraryImportResumePoint = false;
m_bVideoScannerIgnoreErrors = false;
m_iTuxBoxStreamtsPort = 31339;
@@ -616,6 +617,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
XMLUtils::GetString(pElement, "itemseparator", m_videoItemSeparator);
XMLUtils::GetBoolean(pElement, "exportautothumbs", m_bVideoLibraryExportAutoThumbs);
XMLUtils::GetBoolean(pElement, "importwatchedstate", m_bVideoLibraryImportWatchedState);
+ XMLUtils::GetBoolean(pElement, "importresumepoint", m_bVideoLibraryImportResumePoint);
}
pElement = pRootElement->FirstChildElement("videoscanner");
View
1  xbmc/settings/AdvancedSettings.h
@@ -237,6 +237,7 @@ class CAdvancedSettings
bool m_bVideoLibraryCleanOnUpdate;
bool m_bVideoLibraryExportAutoThumbs;
bool m_bVideoLibraryImportWatchedState;
+ bool m_bVideoLibraryImportResumePoint;
bool m_bVideoScannerIgnoreErrors;
View
11 xbmc/video/VideoDatabase.cpp
@@ -7905,8 +7905,7 @@ void CVideoDatabase::ImportFromXML(const CStdString &path)
if (ImportArtFromXML(movie->FirstChild("art"), artwork))
item.SetArt(artwork);
bool useFolders = info.m_basePath.IsEmpty() ? LookupByFolders(item.GetPath()) : false;
- scanner.AddVideo(&item, CONTENT_MOVIES, useFolders);
- SetPlayCount(item, info.m_playCount, info.m_lastPlayed);
+ scanner.AddVideo(&item, CONTENT_MOVIES, useFolders, true, -1, true);
CStdString strFileName(info.m_strTitle);
if (iVersion >= 1 && info.m_iYear > 0)
strFileName.AppendFormat("_%i", info.m_iYear);
@@ -7920,8 +7919,7 @@ void CVideoDatabase::ImportFromXML(const CStdString &path)
if (ImportArtFromXML(movie->FirstChild("art"), artwork))
item.SetArt(artwork);
bool useFolders = info.m_basePath.IsEmpty() ? LookupByFolders(item.GetPath()) : false;
- scanner.AddVideo(&item, CONTENT_MUSICVIDEOS, useFolders);
- SetPlayCount(item, info.m_playCount, info.m_lastPlayed);
+ scanner.AddVideo(&item, CONTENT_MUSICVIDEOS, useFolders, true, -1, true);
CStdString strFileName(StringUtils::Join(info.m_artist, g_advancedSettings.m_videoItemSeparator) + "." + info.m_strTitle);
if (iVersion >= 1 && info.m_iYear > 0)
strFileName.AppendFormat("_%i", info.m_iYear);
@@ -7939,7 +7937,7 @@ void CVideoDatabase::ImportFromXML(const CStdString &path)
if (ImportArtFromXML(movie->FirstChild("art"), artwork))
item.SetArt(artwork);
bool useFolders = info.m_basePath.IsEmpty() ? LookupByFolders(item.GetPath(), true) : false;
- int showID = scanner.AddVideo(&item, CONTENT_TVSHOWS, useFolders);
+ int showID = scanner.AddVideo(&item, CONTENT_TVSHOWS, useFolders, true, -1, true);
// season artwork
TiXmlNode *art = movie->FirstChild("art");
if (art)
@@ -7972,8 +7970,7 @@ void CVideoDatabase::ImportFromXML(const CStdString &path)
map<string, string> artwork;
if (ImportArtFromXML(movie->FirstChild("art"), artwork))
item.SetArt(artwork);
- scanner.AddVideo(&item,CONTENT_TVSHOWS,false,false,showID);
- SetPlayCount(item, info.m_playCount, info.m_lastPlayed);
+ scanner.AddVideo(&item,CONTENT_TVSHOWS, false, false, showID, true);
episode = episode->NextSiblingElement("episodedetails");
}
}
View
8 xbmc/video/VideoInfoScanner.cpp
@@ -1002,7 +1002,7 @@ namespace VIDEO
return episodeInfo.cDate.IsValid();
}
- long CVideoInfoScanner::AddVideo(CFileItem *pItem, const CONTENT_TYPE &content, bool videoFolder, bool useLocal, int idShow)
+ long CVideoInfoScanner::AddVideo(CFileItem *pItem, const CONTENT_TYPE &content, bool videoFolder /* = false */, bool useLocal /* = true */, int idShow /* = -1 */, bool libraryImport /* = false */)
{
// ensure our database is open (this can get called via other classes)
if (!m_database.Open())
@@ -1089,9 +1089,13 @@ namespace VIDEO
movieDetails.m_iDbId = lResult;
}
- if (g_advancedSettings.m_bVideoLibraryImportWatchedState)
+ if (g_advancedSettings.m_bVideoLibraryImportWatchedState || libraryImport)
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)
+ m_database.AddBookMarkToFile(pItem->GetPath(), movieDetails.m_resumePoint, CBookmark::EType::RESUME);
+
m_database.Close();
CFileItemPtr itemCopy = CFileItemPtr(new CFileItem(*pItem));
View
3  xbmc/video/VideoInfoScanner.h
@@ -97,9 +97,10 @@ namespace VIDEO
\param videoFolder whether the video is represented by a folder (single movie per folder). Defaults to false.
\param useLocal whether to use local information for artwork etc.
\param idShow database id of the tvshow if we're adding an episode. Defaults to -1.
+ \param libraryImport Whether this call belongs to a full library import or not. Defaults to false.
\return database id of the added item, or -1 on failure.
*/
- long AddVideo(CFileItem *pItem, const CONTENT_TYPE &content, bool videoFolder = false, bool useLocal = true, int idShow = -1);
+ long AddVideo(CFileItem *pItem, const CONTENT_TYPE &content, bool videoFolder = false, bool useLocal = true, int idShow = -1, bool libraryImport = false);
/*! \brief Retrieve information for a list of items and add them to the database.
\param items list of items to retrieve info for.
Please sign in to comment.
Something went wrong with that request. Please try again.