diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/RecentlyAddedJob.cpp | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/RecentlyAddedJob.cpp')
| -rw-r--r-- | xbmc/utils/RecentlyAddedJob.cpp | 390 |
1 files changed, 390 insertions, 0 deletions
diff --git a/xbmc/utils/RecentlyAddedJob.cpp b/xbmc/utils/RecentlyAddedJob.cpp new file mode 100644 index 0000000..b45fade --- /dev/null +++ b/xbmc/utils/RecentlyAddedJob.cpp | |||
| @@ -0,0 +1,390 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include "RecentlyAddedJob.h" | ||
| 10 | |||
| 11 | #include "FileItem.h" | ||
| 12 | #include "ServiceBroker.h" | ||
| 13 | #include "guilib/GUIComponent.h" | ||
| 14 | #include "guilib/GUIWindow.h" | ||
| 15 | #include "guilib/GUIWindowManager.h" | ||
| 16 | #include "guilib/WindowIDs.h" | ||
| 17 | #include "music/MusicDatabase.h" | ||
| 18 | #include "music/MusicThumbLoader.h" | ||
| 19 | #include "music/tags/MusicInfoTag.h" | ||
| 20 | #include "settings/AdvancedSettings.h" | ||
| 21 | #include "settings/Settings.h" | ||
| 22 | #include "settings/SettingsComponent.h" | ||
| 23 | #include "utils/StringUtils.h" | ||
| 24 | #include "utils/log.h" | ||
| 25 | #include "video/VideoDatabase.h" | ||
| 26 | #include "video/VideoInfoTag.h" | ||
| 27 | #include "video/VideoThumbLoader.h" | ||
| 28 | |||
| 29 | #if defined(TARGET_DARWIN_TVOS) | ||
| 30 | #include "platform/darwin/tvos/TVOSTopShelf.h" | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #define NUM_ITEMS 10 | ||
| 34 | |||
| 35 | CRecentlyAddedJob::CRecentlyAddedJob(int flag) | ||
| 36 | { | ||
| 37 | m_flag = flag; | ||
| 38 | } | ||
| 39 | |||
| 40 | bool CRecentlyAddedJob::UpdateVideo() | ||
| 41 | { | ||
| 42 | auto home = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_HOME); | ||
| 43 | |||
| 44 | if ( home == nullptr ) | ||
| 45 | return false; | ||
| 46 | |||
| 47 | CLog::Log(LOGDEBUG, "CRecentlyAddedJob::UpdateVideos() - Running RecentlyAdded home screen update"); | ||
| 48 | |||
| 49 | int i = 0; | ||
| 50 | CFileItemList items; | ||
| 51 | CVideoDatabase videodatabase; | ||
| 52 | CVideoThumbLoader loader; | ||
| 53 | loader.OnLoaderStart(); | ||
| 54 | |||
| 55 | videodatabase.Open(); | ||
| 56 | |||
| 57 | if (videodatabase.GetRecentlyAddedMoviesNav("videodb://recentlyaddedmovies/", items, NUM_ITEMS)) | ||
| 58 | { | ||
| 59 | for (; i < items.Size(); ++i) | ||
| 60 | { | ||
| 61 | auto item = items.Get(i); | ||
| 62 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 63 | std::string strRating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->GetRating().rating); | ||
| 64 | |||
| 65 | home->SetProperty("LatestMovie." + value + ".Title" , item->GetLabel()); | ||
| 66 | home->SetProperty("LatestMovie." + value + ".Rating" , strRating); | ||
| 67 | home->SetProperty("LatestMovie." + value + ".Year" , item->GetVideoInfoTag()->GetYear()); | ||
| 68 | home->SetProperty("LatestMovie." + value + ".Plot" , item->GetVideoInfoTag()->m_strPlot); | ||
| 69 | home->SetProperty("LatestMovie." + value + ".RunningTime" , item->GetVideoInfoTag()->GetDuration() / 60); | ||
| 70 | home->SetProperty("LatestMovie." + value + ".Path" , item->GetVideoInfoTag()->m_strFileNameAndPath); | ||
| 71 | home->SetProperty("LatestMovie." + value + ".Trailer" , item->GetVideoInfoTag()->m_strTrailer); | ||
| 72 | |||
| 73 | if (!item->HasArt("thumb")) | ||
| 74 | loader.LoadItem(item.get()); | ||
| 75 | |||
| 76 | home->SetProperty("LatestMovie." + value + ".Thumb" , item->GetArt("thumb")); | ||
| 77 | home->SetProperty("LatestMovie." + value + ".Fanart" , item->GetArt("fanart")); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | for (; i < NUM_ITEMS; ++i) | ||
| 81 | { | ||
| 82 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 83 | home->SetProperty("LatestMovie." + value + ".Title" , ""); | ||
| 84 | home->SetProperty("LatestMovie." + value + ".Thumb" , ""); | ||
| 85 | home->SetProperty("LatestMovie." + value + ".Rating" , ""); | ||
| 86 | home->SetProperty("LatestMovie." + value + ".Year" , ""); | ||
| 87 | home->SetProperty("LatestMovie." + value + ".Plot" , ""); | ||
| 88 | home->SetProperty("LatestMovie." + value + ".RunningTime" , ""); | ||
| 89 | home->SetProperty("LatestMovie." + value + ".Path" , ""); | ||
| 90 | home->SetProperty("LatestMovie." + value + ".Trailer" , ""); | ||
| 91 | home->SetProperty("LatestMovie." + value + ".Fanart" , ""); | ||
| 92 | } | ||
| 93 | |||
| 94 | i = 0; | ||
| 95 | CFileItemList TVShowItems; | ||
| 96 | |||
| 97 | if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://recentlyaddedepisodes/", TVShowItems, NUM_ITEMS)) | ||
| 98 | { | ||
| 99 | for (; i < TVShowItems.Size(); ++i) | ||
| 100 | { | ||
| 101 | auto item = TVShowItems.Get(i); | ||
| 102 | int EpisodeSeason = item->GetVideoInfoTag()->m_iSeason; | ||
| 103 | int EpisodeNumber = item->GetVideoInfoTag()->m_iEpisode; | ||
| 104 | std::string EpisodeNo = StringUtils::Format("s%02de%02d", EpisodeSeason, EpisodeNumber); | ||
| 105 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 106 | std::string strRating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->GetRating().rating); | ||
| 107 | |||
| 108 | home->SetProperty("LatestEpisode." + value + ".ShowTitle" , item->GetVideoInfoTag()->m_strShowTitle); | ||
| 109 | home->SetProperty("LatestEpisode." + value + ".EpisodeTitle" , item->GetVideoInfoTag()->m_strTitle); | ||
| 110 | home->SetProperty("LatestEpisode." + value + ".Rating" , strRating); | ||
| 111 | home->SetProperty("LatestEpisode." + value + ".Plot" , item->GetVideoInfoTag()->m_strPlot); | ||
| 112 | home->SetProperty("LatestEpisode." + value + ".EpisodeNo" , EpisodeNo); | ||
| 113 | home->SetProperty("LatestEpisode." + value + ".EpisodeSeason" , EpisodeSeason); | ||
| 114 | home->SetProperty("LatestEpisode." + value + ".EpisodeNumber" , EpisodeNumber); | ||
| 115 | home->SetProperty("LatestEpisode." + value + ".Path" , item->GetVideoInfoTag()->m_strFileNameAndPath); | ||
| 116 | |||
| 117 | if (!item->HasArt("thumb")) | ||
| 118 | loader.LoadItem(item.get()); | ||
| 119 | |||
| 120 | std::string seasonThumb; | ||
| 121 | if (item->GetVideoInfoTag()->m_iIdSeason > 0) | ||
| 122 | seasonThumb = videodatabase.GetArtForItem(item->GetVideoInfoTag()->m_iIdSeason, MediaTypeSeason, "thumb"); | ||
| 123 | |||
| 124 | home->SetProperty("LatestEpisode." + value + ".Thumb" , item->GetArt("thumb")); | ||
| 125 | home->SetProperty("LatestEpisode." + value + ".ShowThumb" , item->GetArt("tvshow.thumb")); | ||
| 126 | home->SetProperty("LatestEpisode." + value + ".SeasonThumb" , seasonThumb); | ||
| 127 | home->SetProperty("LatestEpisode." + value + ".Fanart" , item->GetArt("fanart")); | ||
| 128 | } | ||
| 129 | } | ||
| 130 | for (; i < NUM_ITEMS; ++i) | ||
| 131 | { | ||
| 132 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 133 | home->SetProperty("LatestEpisode." + value + ".ShowTitle" , ""); | ||
| 134 | home->SetProperty("LatestEpisode." + value + ".EpisodeTitle" , ""); | ||
| 135 | home->SetProperty("LatestEpisode." + value + ".Rating" , ""); | ||
| 136 | home->SetProperty("LatestEpisode." + value + ".Plot" , ""); | ||
| 137 | home->SetProperty("LatestEpisode." + value + ".EpisodeNo" , ""); | ||
| 138 | home->SetProperty("LatestEpisode." + value + ".EpisodeSeason" , ""); | ||
| 139 | home->SetProperty("LatestEpisode." + value + ".EpisodeNumber" , ""); | ||
| 140 | home->SetProperty("LatestEpisode." + value + ".Path" , ""); | ||
| 141 | home->SetProperty("LatestEpisode." + value + ".Thumb" , ""); | ||
| 142 | home->SetProperty("LatestEpisode." + value + ".ShowThumb" , ""); | ||
| 143 | home->SetProperty("LatestEpisode." + value + ".SeasonThumb" , ""); | ||
| 144 | home->SetProperty("LatestEpisode." + value + ".Fanart" , ""); | ||
| 145 | } | ||
| 146 | |||
| 147 | #if defined(TARGET_DARWIN_TVOS) | ||
| 148 | // send recently added Movies and TvShows to TopShelf | ||
| 149 | CTVOSTopShelf::GetInstance().SetTopShelfItems(items, TVShowItems); | ||
| 150 | #endif | ||
| 151 | |||
| 152 | i = 0; | ||
| 153 | CFileItemList MusicVideoItems; | ||
| 154 | |||
| 155 | if (videodatabase.GetRecentlyAddedMusicVideosNav("videodb://recentlyaddedmusicvideos/", MusicVideoItems, NUM_ITEMS)) | ||
| 156 | { | ||
| 157 | for (; i < MusicVideoItems.Size(); ++i) | ||
| 158 | { | ||
| 159 | auto item = MusicVideoItems.Get(i); | ||
| 160 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 161 | |||
| 162 | home->SetProperty("LatestMusicVideo." + value + ".Title" , item->GetLabel()); | ||
| 163 | home->SetProperty("LatestMusicVideo." + value + ".Year" , item->GetVideoInfoTag()->GetYear()); | ||
| 164 | home->SetProperty("LatestMusicVideo." + value + ".Plot" , item->GetVideoInfoTag()->m_strPlot); | ||
| 165 | home->SetProperty("LatestMusicVideo." + value + ".RunningTime" , item->GetVideoInfoTag()->GetDuration() / 60); | ||
| 166 | home->SetProperty("LatestMusicVideo." + value + ".Path" , item->GetVideoInfoTag()->m_strFileNameAndPath); | ||
| 167 | home->SetProperty("LatestMusicVideo." + value + ".Artist" , StringUtils::Join(item->GetVideoInfoTag()->m_artist, CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoItemSeparator)); | ||
| 168 | |||
| 169 | if (!item->HasArt("thumb")) | ||
| 170 | loader.LoadItem(item.get()); | ||
| 171 | |||
| 172 | home->SetProperty("LatestMusicVideo." + value + ".Thumb" , item->GetArt("thumb")); | ||
| 173 | home->SetProperty("LatestMusicVideo." + value + ".Fanart" , item->GetArt("fanart")); | ||
| 174 | } | ||
| 175 | } | ||
| 176 | for (; i < NUM_ITEMS; ++i) | ||
| 177 | { | ||
| 178 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 179 | home->SetProperty("LatestMusicVideo." + value + ".Title" , ""); | ||
| 180 | home->SetProperty("LatestMusicVideo." + value + ".Thumb" , ""); | ||
| 181 | home->SetProperty("LatestMusicVideo." + value + ".Year" , ""); | ||
| 182 | home->SetProperty("LatestMusicVideo." + value + ".Plot" , ""); | ||
| 183 | home->SetProperty("LatestMusicVideo." + value + ".RunningTime" , ""); | ||
| 184 | home->SetProperty("LatestMusicVideo." + value + ".Path" , ""); | ||
| 185 | home->SetProperty("LatestMusicVideo." + value + ".Artist" , ""); | ||
| 186 | home->SetProperty("LatestMusicVideo." + value + ".Fanart" , ""); | ||
| 187 | } | ||
| 188 | |||
| 189 | videodatabase.Close(); | ||
| 190 | return true; | ||
| 191 | } | ||
| 192 | |||
| 193 | bool CRecentlyAddedJob::UpdateMusic() | ||
| 194 | { | ||
| 195 | auto home = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_HOME); | ||
| 196 | |||
| 197 | if ( home == nullptr ) | ||
| 198 | return false; | ||
| 199 | |||
| 200 | CLog::Log(LOGDEBUG, "CRecentlyAddedJob::UpdateMusic() - Running RecentlyAdded home screen update"); | ||
| 201 | |||
| 202 | int i = 0; | ||
| 203 | CFileItemList musicItems; | ||
| 204 | CMusicDatabase musicdatabase; | ||
| 205 | CMusicThumbLoader loader; | ||
| 206 | loader.OnLoaderStart(); | ||
| 207 | |||
| 208 | musicdatabase.Open(); | ||
| 209 | |||
| 210 | if (musicdatabase.GetRecentlyAddedAlbumSongs("musicdb://songs/", musicItems, NUM_ITEMS)) | ||
| 211 | { | ||
| 212 | long idAlbum = -1; | ||
| 213 | std::string strAlbumThumb; | ||
| 214 | std::string strAlbumFanart; | ||
| 215 | for (; i < musicItems.Size(); ++i) | ||
| 216 | { | ||
| 217 | auto item = musicItems.Get(i); | ||
| 218 | std::string value = StringUtils::Format("%d", i + 1); | ||
| 219 | |||
| 220 | std::string strRating; | ||
| 221 | std::string strAlbum = item->GetMusicInfoTag()->GetAlbum(); | ||
| 222 | std::string strArtist = item->GetMusicInfoTag()->GetArtistString(); | ||
| 223 | |||
| 224 | if (idAlbum != item->GetMusicInfoTag()->GetAlbumId()) | ||
| 225 | { | ||
| 226 | strAlbumThumb.clear(); | ||
| 227 | strAlbumFanart.clear(); | ||
| 228 | idAlbum = item->GetMusicInfoTag()->GetAlbumId(); | ||
| 229 | |||
| 230 | if (loader.LoadItem(item.get())) | ||
| 231 | { | ||
| 232 | strAlbumThumb = item->GetArt("thumb"); | ||
| 233 | strAlbumFanart = item->GetArt("fanart"); | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | strRating = StringUtils::Format("%c", item->GetMusicInfoTag()->GetUserrating()); | ||
| 238 | |||
| 239 | home->SetProperty("LatestSong." + value + ".Title" , item->GetMusicInfoTag()->GetTitle()); | ||
| 240 | home->SetProperty("LatestSong." + value + ".Year" , item->GetMusicInfoTag()->GetYear()); | ||
| 241 | home->SetProperty("LatestSong." + value + ".Artist" , strArtist); | ||
| 242 | home->SetProperty("LatestSong." + value + ".Album" , strAlbum); | ||
| 243 | home->SetProperty("LatestSong." + value + ".Rating" , strRating); | ||
| 244 | home->SetProperty("LatestSong." + value + ".Path" , item->GetMusicInfoTag()->GetURL()); | ||
| 245 | home->SetProperty("LatestSong." + value + ".Thumb" , strAlbumThumb); | ||
| 246 | home->SetProperty("LatestSong." + value + ".Fanart" , strAlbumFanart); | ||
| 247 | } | ||
| 248 | } | ||
| 249 | for (; i < NUM_ITEMS; ++i) | ||
| 250 | { | ||
| 251 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 252 | home->SetProperty("LatestSong." + value + ".Title" , ""); | ||
| 253 | home->SetProperty("LatestSong." + value + ".Year" , ""); | ||
| 254 | home->SetProperty("LatestSong." + value + ".Artist" , ""); | ||
| 255 | home->SetProperty("LatestSong." + value + ".Album" , ""); | ||
| 256 | home->SetProperty("LatestSong." + value + ".Rating" , ""); | ||
| 257 | home->SetProperty("LatestSong." + value + ".Path" , ""); | ||
| 258 | home->SetProperty("LatestSong." + value + ".Thumb" , ""); | ||
| 259 | home->SetProperty("LatestSong." + value + ".Fanart" , ""); | ||
| 260 | } | ||
| 261 | |||
| 262 | i = 0; | ||
| 263 | VECALBUMS albums; | ||
| 264 | |||
| 265 | if (musicdatabase.GetRecentlyAddedAlbums(albums, NUM_ITEMS)) | ||
| 266 | { | ||
| 267 | size_t j = 0; | ||
| 268 | for (; j < albums.size(); ++j) | ||
| 269 | { | ||
| 270 | auto& album=albums[j]; | ||
| 271 | std::string value = StringUtils::Format("%lu", j + 1); | ||
| 272 | std::string strThumb; | ||
| 273 | std::string strFanart; | ||
| 274 | bool artfound = false; | ||
| 275 | std::vector<ArtForThumbLoader> art; | ||
| 276 | // Get album thumb and fanart for first album artist | ||
| 277 | artfound = musicdatabase.GetArtForItem(-1, album.idAlbum, -1, true, art); | ||
| 278 | if (artfound) | ||
| 279 | { | ||
| 280 | for (auto artitem : art) | ||
| 281 | { | ||
| 282 | if (artitem.mediaType == MediaTypeAlbum && artitem.artType == "thumb") | ||
| 283 | strThumb = artitem.url; | ||
| 284 | else if (artitem.mediaType == MediaTypeArtist && artitem.artType == "fanart") | ||
| 285 | strFanart = artitem.url; | ||
| 286 | } | ||
| 287 | } | ||
| 288 | |||
| 289 | std::string strDBpath = StringUtils::Format("musicdb://albums/%li/", album.idAlbum); | ||
| 290 | |||
| 291 | home->SetProperty("LatestAlbum." + value + ".Title" , album.strAlbum); | ||
| 292 | home->SetProperty("LatestAlbum." + value + ".Year" , album.strReleaseDate); | ||
| 293 | home->SetProperty("LatestAlbum." + value + ".Artist" , album.GetAlbumArtistString()); | ||
| 294 | home->SetProperty("LatestAlbum." + value + ".Rating" , album.fRating); | ||
| 295 | home->SetProperty("LatestAlbum." + value + ".Path" , strDBpath); | ||
| 296 | home->SetProperty("LatestAlbum." + value + ".Thumb" , strThumb); | ||
| 297 | home->SetProperty("LatestAlbum." + value + ".Fanart" , strFanart); | ||
| 298 | } | ||
| 299 | i = j; | ||
| 300 | } | ||
| 301 | for (; i < NUM_ITEMS; ++i) | ||
| 302 | { | ||
| 303 | std::string value = StringUtils::Format("%i", i + 1); | ||
| 304 | home->SetProperty("LatestAlbum." + value + ".Title" , ""); | ||
| 305 | home->SetProperty("LatestAlbum." + value + ".Year" , ""); | ||
| 306 | home->SetProperty("LatestAlbum." + value + ".Artist" , ""); | ||
| 307 | home->SetProperty("LatestAlbum." + value + ".Rating" , ""); | ||
| 308 | home->SetProperty("LatestAlbum." + value + ".Path" , ""); | ||
| 309 | home->SetProperty("LatestAlbum." + value + ".Thumb" , ""); | ||
| 310 | home->SetProperty("LatestAlbum." + value + ".Fanart" , ""); | ||
| 311 | } | ||
| 312 | |||
| 313 | musicdatabase.Close(); | ||
| 314 | return true; | ||
| 315 | } | ||
| 316 | |||
| 317 | bool CRecentlyAddedJob::UpdateTotal() | ||
| 318 | { | ||
| 319 | auto home = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_HOME); | ||
| 320 | |||
| 321 | if ( home == nullptr ) | ||
| 322 | return false; | ||
| 323 | |||
| 324 | CLog::Log(LOGDEBUG, "CRecentlyAddedJob::UpdateTotal() - Running RecentlyAdded home screen update"); | ||
| 325 | |||
| 326 | CVideoDatabase videodatabase; | ||
| 327 | CMusicDatabase musicdatabase; | ||
| 328 | |||
| 329 | musicdatabase.Open(); | ||
| 330 | |||
| 331 | CMusicDbUrl musicUrl; | ||
| 332 | musicUrl.FromString("musicdb://artists/"); | ||
| 333 | musicUrl.AddOption("albumartistsonly", !CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MUSICLIBRARY_SHOWCOMPILATIONARTISTS)); | ||
| 334 | |||
| 335 | CFileItemList items; | ||
| 336 | CDatabase::Filter filter; | ||
| 337 | musicdatabase.GetArtistsByWhere(musicUrl.ToString(), filter, items, SortDescription(), true); | ||
| 338 | int MusArtistTotals = 0; | ||
| 339 | if (items.Size() == 1 && items.Get(0)->HasProperty("total")) | ||
| 340 | MusArtistTotals = items.Get(0)->GetProperty("total").asInteger(); | ||
| 341 | |||
| 342 | int MusSongTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(1)").c_str()); | ||
| 343 | int MusAlbumTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(distinct strAlbum)").c_str()); | ||
| 344 | musicdatabase.Close(); | ||
| 345 | |||
| 346 | videodatabase.Open(); | ||
| 347 | int tvShowCount = atoi(videodatabase.GetSingleValue("tvshow_view" , "count(1)").c_str()); | ||
| 348 | int movieTotals = atoi(videodatabase.GetSingleValue("movie_view" , "count(1)").c_str()); | ||
| 349 | int movieWatched = atoi(videodatabase.GetSingleValue("movie_view" , "count(playCount)").c_str()); | ||
| 350 | int MusVidTotals = atoi(videodatabase.GetSingleValue("musicvideo_view" , "count(1)").c_str()); | ||
| 351 | int MusVidWatched = atoi(videodatabase.GetSingleValue("musicvideo_view" , "count(playCount)").c_str()); | ||
| 352 | int EpWatched = atoi(videodatabase.GetSingleValue("tvshow_view" , "sum(watchedcount)").c_str()); | ||
| 353 | int EpCount = atoi(videodatabase.GetSingleValue("tvshow_view" , "sum(totalcount)").c_str()); | ||
| 354 | int TvShowsWatched = atoi(videodatabase.GetSingleValue("tvshow_view" , "sum(watchedcount = totalcount)").c_str()); | ||
| 355 | videodatabase.Close(); | ||
| 356 | |||
| 357 | home->SetProperty("TVShows.Count" , tvShowCount); | ||
| 358 | home->SetProperty("TVShows.Watched" , TvShowsWatched); | ||
| 359 | home->SetProperty("TVShows.UnWatched" , tvShowCount - TvShowsWatched); | ||
| 360 | home->SetProperty("Episodes.Count" , EpCount); | ||
| 361 | home->SetProperty("Episodes.Watched" , EpWatched); | ||
| 362 | home->SetProperty("Episodes.UnWatched" , EpCount-EpWatched); | ||
| 363 | home->SetProperty("Movies.Count" , movieTotals); | ||
| 364 | home->SetProperty("Movies.Watched" , movieWatched); | ||
| 365 | home->SetProperty("Movies.UnWatched" , movieTotals - movieWatched); | ||
| 366 | home->SetProperty("MusicVideos.Count" , MusVidTotals); | ||
| 367 | home->SetProperty("MusicVideos.Watched" , MusVidWatched); | ||
| 368 | home->SetProperty("MusicVideos.UnWatched" , MusVidTotals - MusVidWatched); | ||
| 369 | home->SetProperty("Music.SongsCount" , MusSongTotals); | ||
| 370 | home->SetProperty("Music.AlbumsCount" , MusAlbumTotals); | ||
| 371 | home->SetProperty("Music.ArtistsCount" , MusArtistTotals); | ||
| 372 | |||
| 373 | return true; | ||
| 374 | } | ||
| 375 | |||
| 376 | |||
| 377 | bool CRecentlyAddedJob::DoWork() | ||
| 378 | { | ||
| 379 | bool ret = true; | ||
| 380 | if (m_flag & Audio) | ||
| 381 | ret &= UpdateMusic(); | ||
| 382 | |||
| 383 | if (m_flag & Video) | ||
| 384 | ret &= UpdateVideo(); | ||
| 385 | |||
| 386 | if (m_flag & Totals) | ||
| 387 | ret &= UpdateTotal(); | ||
| 388 | |||
| 389 | return ret; | ||
| 390 | } | ||
