Skip to content
This repository
Browse code

videodb: make idSeason available through episodeview

  • Loading branch information...
commit b5b9fa815591499234b11ecea3ae7f5ce5d32386 1 parent 5170759
Sascha Montellese Montellese authored
8 xbmc/video/VideoDatabase.cpp
@@ -351,16 +351,19 @@ void CVideoDatabase::CreateViews()
351 351 " tvshow.c%02d AS mpaa,"
352 352 " tvshow.c%02d AS strShowPath, "
353 353 " bookmark.timeInSeconds AS resumeTimeInSeconds, "
354   - " bookmark.totalTimeInSeconds AS totalTimeInSeconds "
  354 + " bookmark.totalTimeInSeconds AS totalTimeInSeconds, "
  355 + " seasons.idSeason AS idSeason "
355 356 "FROM episode"
356 357 " JOIN files ON"
357 358 " files.idFile=episode.idFile"
358 359 " JOIN tvshow ON"
359 360 " tvshow.idShow=episode.idShow"
  361 + " LEFT JOIN seasons ON"
  362 + " seasons.idShow=episode.idShow AND seasons.season=episode.c%02d"
360 363 " JOIN path ON"
361 364 " files.idPath=path.idPath"
362 365 " LEFT JOIN bookmark ON"
363   - " bookmark.idFile=episode.idFile AND bookmark.type=1", VIDEODB_ID_TV_TITLE, VIDEODB_ID_TV_STUDIOS, VIDEODB_ID_TV_PREMIERED, VIDEODB_ID_TV_MPAA, VIDEODB_ID_TV_BASEPATH);
  366 + " bookmark.idFile=episode.idFile AND bookmark.type=1", VIDEODB_ID_TV_TITLE, VIDEODB_ID_TV_STUDIOS, VIDEODB_ID_TV_PREMIERED, VIDEODB_ID_TV_MPAA, VIDEODB_ID_TV_BASEPATH, VIDEODB_ID_EPISODE_SEASON);
364 367 m_pDS->exec(episodeview.c_str());
365 368
366 369 CLog::Log(LOGINFO, "create tvshowview");
@@ -3141,6 +3144,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(const dbiplus::sql_record* co
3141 3144 details.m_premiered.SetFromDBDate(record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_AIRED).get_asString());
3142 3145 details.m_iIdShow = record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt();
3143 3146 details.m_strShowPath = record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_PATH).get_asString();
  3147 + details.m_iIdSeason = record->at(VIDEODB_DETAILS_EPISODE_SEASON_ID).get_asInt();
3144 3148
3145 3149 details.m_resumePoint.timeInSeconds = record->at(VIDEODB_DETAILS_EPISODE_RESUME_TIME).get_asInt();
3146 3150 details.m_resumePoint.totalTimeInSeconds = record->at(VIDEODB_DETAILS_EPISODE_TOTAL_TIME).get_asInt();
3  xbmc/video/VideoDatabase.h
@@ -89,6 +89,7 @@ namespace VIDEO
89 89 #define VIDEODB_DETAILS_EPISODE_TVSHOW_PATH VIDEODB_MAX_COLUMNS + 12
90 90 #define VIDEODB_DETAILS_EPISODE_RESUME_TIME VIDEODB_MAX_COLUMNS + 13
91 91 #define VIDEODB_DETAILS_EPISODE_TOTAL_TIME VIDEODB_MAX_COLUMNS + 14
  92 +#define VIDEODB_DETAILS_EPISODE_SEASON_ID VIDEODB_MAX_COLUMNS + 15
92 93
93 94 #define VIDEODB_DETAILS_TVSHOW_PATH VIDEODB_MAX_COLUMNS + 1
94 95 #define VIDEODB_DETAILS_TVSHOW_DATEADDED VIDEODB_MAX_COLUMNS + 2
@@ -798,7 +799,7 @@ class CVideoDatabase : public CDatabase
798 799 */
799 800 bool LookupByFolders(const CStdString &path, bool shows = false);
800 801
801   - virtual int GetMinVersion() const { return 65; };
  802 + virtual int GetMinVersion() const { return 66; };
802 803 virtual int GetExportVersion() const { return 1; };
803 804 const char *GetBaseDBName() const { return "MyVideos"; };
804 805
4 xbmc/video/VideoInfoTag.cpp
@@ -89,6 +89,7 @@ void CVideoInfoTag::Reset()
89 89 m_resumePoint.Reset();
90 90 m_resumePoint.type = CBookmark::RESUME;
91 91 m_iIdShow = -1;
  92 + m_iIdSeason = -1;
92 93 m_strShowPath.clear();
93 94 m_dateAdded.Reset();
94 95 m_type.clear();
@@ -329,6 +330,7 @@ void CVideoInfoTag::Archive(CArchive& ar)
329 330 ar << m_strShowPath;
330 331 ar << m_dateAdded.GetAsDBDateTime();
331 332 ar << m_type;
  333 + ar << m_iIdSeason;
332 334 }
333 335 else
334 336 {
@@ -407,6 +409,7 @@ void CVideoInfoTag::Archive(CArchive& ar)
407 409 ar >> dateAdded;
408 410 m_dateAdded.SetFromDBDateTime(dateAdded);
409 411 ar >> m_type;
  412 + ar >> m_iIdSeason;
410 413 }
411 414 }
412 415
@@ -476,6 +479,7 @@ void CVideoInfoTag::Serialize(CVariant& value)
476 479 value["tvshowpath"] = m_strShowPath;
477 480 value["dateadded"] = m_dateAdded.IsValid() ? m_dateAdded.GetAsDBDateTime() : StringUtils::EmptyString;
478 481 value["type"] = m_type;
  482 + value["seasonid"] = m_iIdSeason;
479 483 }
480 484
481 485 void CVideoInfoTag::ToSortable(SortItem& sortable)
1  xbmc/video/VideoInfoTag.h
@@ -129,6 +129,7 @@ class CVideoInfoTag : public IArchivable, public ISerializable, public ISortable
129 129 float m_fEpBookmark;
130 130 int m_iBookmarkId;
131 131 int m_iIdShow;
  132 + int m_iIdSeason;
132 133 CFanart m_fanart;
133 134 CStreamDetails m_streamDetails;
134 135 CBookmark m_resumePoint;
6 xbmc/video/dialogs/GUIDialogVideoInfo.cpp
@@ -301,8 +301,10 @@ void CGUIDialogVideoInfo::SetMovie(const CFileItem *item)
301 301 {
302 302 if (m_movieItem->GetVideoInfoTag()->m_iSeason > -1)
303 303 {
304   - int seasonID = db.GetSeasonId(m_movieItem->GetVideoInfoTag()->m_iIdShow,
305   - m_movieItem->GetVideoInfoTag()->m_iSeason);
  304 + int seasonID = m_movieItem->GetVideoInfoTag()->m_iIdSeason;
  305 + if (seasonID < 0)
  306 + seasonID = db.GetSeasonId(m_movieItem->GetVideoInfoTag()->m_iIdShow,
  307 + m_movieItem->GetVideoInfoTag()->m_iSeason);
306 308 string thumb = db.GetArtForItem(seasonID, "season", "thumb");
307 309 if (!thumb.empty())
308 310 m_movieItem->SetProperty("seasonthumb", thumb);

0 comments on commit b5b9fa8

Please sign in to comment.
Something went wrong with that request. Please try again.