Skip to content

Commit

Permalink
Fix exporting of resuming point in dvds
Browse files Browse the repository at this point in the history
  • Loading branch information
phate89 committed Dec 4, 2016
1 parent afa567b commit 480839e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
10 changes: 8 additions & 2 deletions xbmc/video/VideoDatabase.cpp
Expand Up @@ -367,6 +367,7 @@ void CVideoDatabase::CreateViews()
" tvshow.c%02d AS mpaa,"
" bookmark.timeInSeconds AS resumeTimeInSeconds, "
" bookmark.totalTimeInSeconds AS totalTimeInSeconds, "
" bookmark.playerState AS playerState, "
" rating.rating AS rating, "
" rating.votes AS votes, "
" rating.rating_type AS rating_type, "
Expand Down Expand Up @@ -470,7 +471,8 @@ void CVideoDatabase::CreateViews()
" files.lastPlayed as lastPlayed,"
" files.dateAdded as dateAdded, "
" bookmark.timeInSeconds AS resumeTimeInSeconds, "
" bookmark.totalTimeInSeconds AS totalTimeInSeconds "
" bookmark.totalTimeInSeconds AS totalTimeInSeconds, "
" bookmark.playerState AS playerState "
"FROM musicvideo"
" JOIN files ON"
" files.idFile=musicvideo.idFile"
Expand All @@ -492,6 +494,7 @@ void CVideoDatabase::CreateViews()
" files.dateAdded AS dateAdded, "
" bookmark.timeInSeconds AS resumeTimeInSeconds, "
" bookmark.totalTimeInSeconds AS totalTimeInSeconds, "
" bookmark.playerState AS playerState, "
" rating.rating AS rating, "
" rating.votes AS votes, "
" rating.rating_type AS rating_type, "
Expand Down Expand Up @@ -3779,6 +3782,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMovie(const dbiplus::sql_record* cons
details.m_dateAdded.SetFromDBDateTime(record->at(VIDEODB_DETAILS_MOVIE_DATEADDED).get_asString());
details.m_resumePoint.timeInSeconds = record->at(VIDEODB_DETAILS_MOVIE_RESUME_TIME).get_asInt();
details.m_resumePoint.totalTimeInSeconds = record->at(VIDEODB_DETAILS_MOVIE_TOTAL_TIME).get_asInt();
details.m_resumePoint.playerState = record->at(VIDEODB_DETAILS_MOVIE_PLAYER_STATE).get_asString();
details.m_resumePoint.type = CBookmark::RESUME;
details.m_iUserRating = record->at(VIDEODB_DETAILS_MOVIE_USER_RATING).get_asInt();
details.SetRating(record->at(VIDEODB_DETAILS_MOVIE_RATING).get_asFloat(),
Expand Down Expand Up @@ -3943,6 +3947,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(const dbiplus::sql_record* co

details.m_resumePoint.timeInSeconds = record->at(VIDEODB_DETAILS_EPISODE_RESUME_TIME).get_asInt();
details.m_resumePoint.totalTimeInSeconds = record->at(VIDEODB_DETAILS_EPISODE_TOTAL_TIME).get_asInt();
details.m_resumePoint.playerState = record->at(VIDEODB_DETAILS_EPISODE_PLAYER_STATE).get_asString();
details.m_resumePoint.type = CBookmark::RESUME;
details.m_iUserRating = record->at(VIDEODB_DETAILS_EPISODE_USER_RATING).get_asInt();
details.SetRating(record->at(VIDEODB_DETAILS_EPISODE_RATING).get_asFloat(),
Expand Down Expand Up @@ -4004,6 +4009,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMusicVideo(const dbiplus::sql_record*
details.m_dateAdded.SetFromDBDateTime(record->at(VIDEODB_DETAILS_MUSICVIDEO_DATEADDED).get_asString());
details.m_resumePoint.timeInSeconds = record->at(VIDEODB_DETAILS_MUSICVIDEO_RESUME_TIME).get_asInt();
details.m_resumePoint.totalTimeInSeconds = record->at(VIDEODB_DETAILS_MUSICVIDEO_TOTAL_TIME).get_asInt();
details.m_resumePoint.playerState = record->at(VIDEODB_DETAILS_MUSICVIDEO_PLAYER_STATE).get_asString();
details.m_resumePoint.type = CBookmark::RESUME;
details.m_iUserRating = record->at(VIDEODB_DETAILS_MUSICVIDEO_USER_RATING).get_asInt();
std::string premieredString = record->at(VIDEODB_DETAILS_MUSICVIDEO_PREMIERED).get_asString();
Expand Down Expand Up @@ -5158,7 +5164,7 @@ void CVideoDatabase::UpdateTables(int iVersion)

int CVideoDatabase::GetSchemaVersion() const
{
return 107;
return 108;
}

bool CVideoDatabase::LookupByFolders(const std::string &path, bool shows)
Expand Down
23 changes: 13 additions & 10 deletions xbmc/video/VideoDatabase.h
Expand Up @@ -98,11 +98,12 @@ enum VideoDbDetails
#define VIDEODB_DETAILS_MOVIE_DATEADDED VIDEODB_MAX_COLUMNS + 11
#define VIDEODB_DETAILS_MOVIE_RESUME_TIME VIDEODB_MAX_COLUMNS + 12
#define VIDEODB_DETAILS_MOVIE_TOTAL_TIME VIDEODB_MAX_COLUMNS + 13
#define VIDEODB_DETAILS_MOVIE_RATING VIDEODB_MAX_COLUMNS + 14
#define VIDEODB_DETAILS_MOVIE_VOTES VIDEODB_MAX_COLUMNS + 15
#define VIDEODB_DETAILS_MOVIE_RATING_TYPE VIDEODB_MAX_COLUMNS + 16
#define VIDEODB_DETAILS_MOVIE_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 17
#define VIDEODB_DETAILS_MOVIE_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 18
#define VIDEODB_DETAILS_MOVIE_PLAYER_STATE VIDEODB_MAX_COLUMNS + 14
#define VIDEODB_DETAILS_MOVIE_RATING VIDEODB_MAX_COLUMNS + 15
#define VIDEODB_DETAILS_MOVIE_VOTES VIDEODB_MAX_COLUMNS + 16
#define VIDEODB_DETAILS_MOVIE_RATING_TYPE VIDEODB_MAX_COLUMNS + 17
#define VIDEODB_DETAILS_MOVIE_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 18
#define VIDEODB_DETAILS_MOVIE_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 19

#define VIDEODB_DETAILS_EPISODE_TVSHOW_ID VIDEODB_MAX_COLUMNS + 2
#define VIDEODB_DETAILS_EPISODE_USER_RATING VIDEODB_MAX_COLUMNS + 3
Expand All @@ -119,11 +120,12 @@ enum VideoDbDetails
#define VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA VIDEODB_MAX_COLUMNS + 14
#define VIDEODB_DETAILS_EPISODE_RESUME_TIME VIDEODB_MAX_COLUMNS + 15
#define VIDEODB_DETAILS_EPISODE_TOTAL_TIME VIDEODB_MAX_COLUMNS + 16
#define VIDEODB_DETAILS_EPISODE_RATING VIDEODB_MAX_COLUMNS + 17
#define VIDEODB_DETAILS_EPISODE_VOTES VIDEODB_MAX_COLUMNS + 18
#define VIDEODB_DETAILS_EPISODE_RATING_TYPE VIDEODB_MAX_COLUMNS + 19
#define VIDEODB_DETAILS_EPISODE_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 20
#define VIDEODB_DETAILS_EPISODE_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 21
#define VIDEODB_DETAILS_EPISODE_PLAYER_STATE VIDEODB_MAX_COLUMNS + 17
#define VIDEODB_DETAILS_EPISODE_RATING VIDEODB_MAX_COLUMNS + 18
#define VIDEODB_DETAILS_EPISODE_VOTES VIDEODB_MAX_COLUMNS + 19
#define VIDEODB_DETAILS_EPISODE_RATING_TYPE VIDEODB_MAX_COLUMNS + 20
#define VIDEODB_DETAILS_EPISODE_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 21
#define VIDEODB_DETAILS_EPISODE_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 22

#define VIDEODB_DETAILS_TVSHOW_USER_RATING VIDEODB_MAX_COLUMNS + 1
#define VIDEODB_DETAILS_TVSHOW_DURATION VIDEODB_MAX_COLUMNS + 2
Expand All @@ -149,6 +151,7 @@ enum VideoDbDetails
#define VIDEODB_DETAILS_MUSICVIDEO_DATEADDED VIDEODB_MAX_COLUMNS + 8
#define VIDEODB_DETAILS_MUSICVIDEO_RESUME_TIME VIDEODB_MAX_COLUMNS + 9
#define VIDEODB_DETAILS_MUSICVIDEO_TOTAL_TIME VIDEODB_MAX_COLUMNS + 10
#define VIDEODB_DETAILS_MUSICVIDEO_PLAYER_STATE VIDEODB_MAX_COLUMNS + 11

#define VIDEODB_TYPE_UNUSED 0
#define VIDEODB_TYPE_STRING 1
Expand Down
17 changes: 17 additions & 0 deletions xbmc/video/VideoInfoTag.cpp
Expand Up @@ -300,6 +300,14 @@ bool CVideoInfoTag::Save(TiXmlNode *node, const std::string &tag, bool savePathI
TiXmlElement resume("resume");
XMLUtils::SetFloat(&resume, "position", (float)m_resumePoint.timeInSeconds);
XMLUtils::SetFloat(&resume, "total", (float)m_resumePoint.totalTimeInSeconds);
if (!m_resumePoint.playerState.empty())
{
TiXmlElement playerstate("playerstate");
CXBMCTinyXML doc;
doc.Parse(m_resumePoint.playerState);
playerstate.InsertEndChild(*doc.RootElement());
resume.InsertEndChild(playerstate);
}
movie->InsertEndChild(resume);

XMLUtils::SetDateTime(movie, "dateadded", m_dateAdded);
Expand Down Expand Up @@ -408,6 +416,7 @@ void CVideoInfoTag::Archive(CArchive& ar)
ar << m_parentPathID;
ar << m_resumePoint.timeInSeconds;
ar << m_resumePoint.totalTimeInSeconds;
ar << m_resumePoint.playerState;
ar << m_iIdShow;
ar << m_dateAdded.GetAsDBDateTime();
ar << m_type;
Expand Down Expand Up @@ -524,6 +533,7 @@ void CVideoInfoTag::Archive(CArchive& ar)
ar >> m_parentPathID;
ar >> m_resumePoint.timeInSeconds;
ar >> m_resumePoint.totalTimeInSeconds;
ar >> m_resumePoint.playerState;
ar >> m_iIdShow;

std::string dateAdded;
Expand Down Expand Up @@ -1187,6 +1197,13 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise)
{
XMLUtils::GetDouble(resume, "position", m_resumePoint.timeInSeconds);
XMLUtils::GetDouble(resume, "total", m_resumePoint.totalTimeInSeconds);
const TiXmlElement *playerstate = resume->FirstChildElement("playerstate");
if (playerstate)
{
const TiXmlElement *value = playerstate->FirstChildElement();
if (value)
m_resumePoint.playerState << *value;
}
}

XMLUtils::GetDateTime(movie, "dateadded", m_dateAdded);
Expand Down

0 comments on commit 480839e

Please sign in to comment.