diff options
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 2 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 6de6f2bcac..6db4ddbc4a 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -5054,7 +5054,7 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY }, /// \table_row3{ <b>`ListItem.Property(WatchedEpisodePercent)`</b>, /// \anchor ListItem_Property_WatchedEpisodePercent /// _string_, -/// @return The percentage of watched episodes in the tvshow (watched/total*100). +/// @return The percentage of watched episodes in the tvshow (watched/total*100) or season. /// <p><hr> /// @skinning_v20 **[New Infolabel]** \link ListItem_Property_WatchedEpisodePercent `ListItem.Property(WatchedEpisodePercent)`\endlink /// <p> diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 8dad6d515a..0ff97539d3 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -7326,13 +7326,15 @@ bool CVideoDatabase::GetSeasonsByWhere(const std::string& strBaseDir, const Filt pItem->GetVideoInfoTag()->m_strMPAARating = m_pDS->fv(VIDEODB_ID_SEASON_TVSHOW_MPAA).get_asString(); pItem->GetVideoInfoTag()->m_iIdShow = showId; - int totalEpisodes = m_pDS->fv(VIDEODB_ID_SEASON_EPISODES_TOTAL).get_asInt(); - int watchedEpisodes = m_pDS->fv(VIDEODB_ID_SEASON_EPISODES_WATCHED).get_asInt(); + const int totalEpisodes = m_pDS->fv(VIDEODB_ID_SEASON_EPISODES_TOTAL).get_asInt(); + const int watchedEpisodes = m_pDS->fv(VIDEODB_ID_SEASON_EPISODES_WATCHED).get_asInt(); pItem->GetVideoInfoTag()->m_iEpisode = totalEpisodes; pItem->SetProperty("totalepisodes", totalEpisodes); pItem->SetProperty("numepisodes", totalEpisodes); // will be changed later to reflect watchmode setting pItem->SetProperty("watchedepisodes", watchedEpisodes); pItem->SetProperty("unwatchedepisodes", totalEpisodes - watchedEpisodes); + pItem->SetProperty("watchedepisodepercent", + totalEpisodes > 0 ? (watchedEpisodes * 100 / totalEpisodes) : 0); if (iSeason == 0) pItem->SetProperty("isspecial", true); pItem->GetVideoInfoTag()->SetPlayCount((totalEpisodes == watchedEpisodes) ? 1 : 0); |