コード例 #1
0
        public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            var IsIdle = Utils.IsIdle();
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Update due TriggerRefresh
            if (Utils.ScraperMPDatabase && (FanartHandlerSetup.Fh.MyScraperWorker != null && FanartHandlerSetup.Fh.MyScraperWorker.TriggerRefresh))
            {
              RefreshRefreshTickCount();
              SetCurrentSelectedImageNames(null, Utils.Category.Dummy);
              FanartHandlerSetup.Fh.MyScraperWorker.TriggerRefresh = false;
            }
            #endregion

            #region Pictures selected
            if (Utils.UsePicturesFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedPictures))
              {
            IsSelectedPicture = true;
            RefreshPicturesSelectedProperties();
              }
              else if (IsSelectedPicture)
              {
            EmptyPicturesProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region Music selected
            if (Utils.UseMusicFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedMusic))
              {
            IsSelectedMusic = true;
            if (Utils.iActiveWindow == 504 || // My Music Genres (Main music window for database views: artist, album, genres etc)
                Utils.iActiveWindow == 501 || // My Music Songs (Music shares view screen)
                Utils.iActiveWindow == 500)   // My Music Playlist
            {
              RefreshMusicSelectedProperties();
            }
            else
            {
              RefreshGenericSelectedProperties("music",
                                               ref ListSelectedMusic,
                                               Utils.Category.MusicFanartScraped,
                                               ref CurrSelectedMusic,
                                               ref CurrSelectedMusicArtist);
            }
              }
              else if (IsSelectedMusic)
              {
            EmptyMusicProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region TV/Video selected
            if (Utils.UseVideoFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedMovie))
              {
            IsSelectedVideo = true;
            if (Utils.iActiveWindow == 601 || Utils.iActiveWindow == 605 || Utils.iActiveWindow == 606 || Utils.iActiveWindow == 603 || Utils.iActiveWindow == 759 || Utils.iActiveWindow == 1 ||
             // mytvschedulerServer                                         mytvrecordedtv                mytvRecordedInfo              mytvhomeserver
                Utils.iActiveWindow == 600 || Utils.iActiveWindow == 747 || Utils.iActiveWindow == 49849 || Utils.iActiveWindow == 49848 || Utils.iActiveWindow == 49850
             // mytvguide                     mytvschedulerServerSearch     ARGUS_Active                    ARGUS_UpcomingTv                ARGUS_TvGuideSearch2
               )
            {  // TV
              RefreshGenericSelectedProperties("movie",
                                               ref ListSelectedMovies,
                                               Utils.Category.TvManual,
                                               ref CurrSelectedMovie,
                                               ref CurrSelectedMovieTitle);
            }
            else if (Utils.iActiveWindow == 9811 ||    // TVSeries
                     Utils.iActiveWindow == 9813)      // TVSeries Playlist
            {
              RefreshGenericSelectedProperties("movie",
                                               ref ListSelectedMovies,
                                               Utils.Category.TvSeriesScraped,
                                               ref CurrSelectedMovie,
                                               ref CurrSelectedMovieTitle);
            }
            else // Movie
            {
              RefreshGenericSelectedProperties("movie",
                                               ref ListSelectedMovies,
                                               Utils.Category.MovieScraped,
                                               ref CurrSelectedMovie,
                                               ref CurrSelectedMovieTitle);
            }
              }
              else if (IsSelectedVideo)
              {
            EmptyVideoProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region ScoreCenter selected
            if (Utils.UseScoreCenterFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedScoreCenter))
              {
            IsSelectedScoreCenter = true;
            if (Utils.iActiveWindow == 42000) // My Score center
            {
              RefreshScorecenterSelectedProperties();
            }
              }
              else if (IsSelectedScoreCenter)
              {
            EmptyScoreCenterProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            FanartAvailable = FanartAvailableMusic || FanartAvailableMovies || FanartAvailableScorecenter || FanartAvailablePictures;

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else if (IsSelectedScoreCenter || IsSelectedVideo || IsSelectedMusic || IsSelectedPicture)
            {
              EmptyAllProperties(false);
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshSelected: " + ex);
              }
        }
コード例 #2
0
 public void RefreshRandomTVImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.TvManual, ref currAnyTVUser, ref PrevSelectedTVUser, "tv.userdef", ref ListAnyTVUser);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "TV Updated Properties");
 }
コード例 #3
0
 public void RefreshRandomTVSeriesImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.TvSeriesScraped, ref currAnyTVSeries, ref PrevSelectedTVSeries, "tvseries", ref ListAnyTVSeries);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "TVSeries Updated Properties");
 }
コード例 #4
0
 public void RefreshRandomPluginsImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.PluginManual, ref currAnyPluginsUser, ref PrevSelectedPluginsUser, "plugins.userdef", ref ListAnyPluginsUser);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "PlugIns Updated Properties");
 }
コード例 #5
0
 public void RefreshRandomScoreCenterImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.SportsManual, ref currAnyScorecenterUser, ref PrevSelectedScorecenterUser, "scorecenter.userdef", ref ListAnyScorecenterUser);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "ScoreCenter Updated Properties");
 }
コード例 #6
0
 public void RefreshRandomMoviesImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.MovieManual, ref currAnyMoviesUser, ref PrevSelectedMoviesUser, "movie.userdef", ref ListAnyMoviesUser);
       FillPropertyRandom(Utils.Category.MovieScraped, ref currAnyMoviesScraper, ref PrevSelectedMoviesScraper, "movie.scraper", ref ListAnyMoviesScraper);
       FillPropertyRandom(Utils.Category.MovingPictureManual, ref currAnyMovingPictures, ref PrevSelectedMovingPictures, "movingpicture", ref ListAnyMovingPictures);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "Movies Updated Properties");
 }
コード例 #7
0
 public void RefreshRandomMusicImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.MusicFanartManual, ref currAnyMusicUser, ref PrevSelectedMusicUser, "music.userdef", ref ListAnyMusicUser);
       FillPropertyRandom(Utils.Category.MusicFanartScraped, ref currAnyMusicScraper, ref PrevSelectedMusicScraper, "music.scraper", ref ListAnyMusicScraper);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "Music Updated Properties");
 }
コード例 #8
0
 public void RefreshRandomGamesImageProperties(RefreshWorker rw)
 {
     FillPropertyRandom(Utils.Category.GameManual, ref currAnyGamesUser, ref PrevSelectedGamesUser, "games.userdef", ref ListAnyGamesUser);
       if (rw != null /*&& WindowOpen*/)
     rw.ReportProgress(10, "Games Updated Properties");
 }
コード例 #9
0
        public void RefreshRandomImageProperties(RefreshWorker rw)
        {
            try
              {
            if (Utils.GetIsStopping())
              return;

            if (RefreshTickCount >= Utils.MaxRefreshTickCount || RefreshTickCount == 0)
            {
              // var stopwatch = System.Diagnostics.Stopwatch.StartNew();
              var str = string.Empty;

              Parallel.Invoke(() => { RefreshRandomMoviesImageProperties(rw); },
                          () => { RefreshRandomMusicImageProperties(rw); },
                          () => { RefreshRandomTVImageProperties(rw); },
                          () => { RefreshRandomTVSeriesImageProperties(rw); },
                          () => { RefreshRandomPicturesImageProperties(rw); },
                          () => { RefreshRandomGamesImageProperties(rw); },
                          () => { RefreshRandomScoreCenterImageProperties(rw); },
                          () => { RefreshRandomPluginsImageProperties(rw); });

              ResetRefreshTickCount();
              if (rw != null /*&& WindowOpen*/)
            rw.ReportProgress(90, "Updated Properties");

              // stopwatch.Stop();
              // logger.Debug("Refreshing Random properties is done. FanartAvailable: {1} Time elapsed: {0}.", stopwatch.Elapsed, Utils.Check(FanartAvailable));
            }
            if (rw == null)
              return;
            rw.ReportProgress(100, "Updated Properties");
              }
              catch (Exception ex)
              {
            logger.Error("RefreshRandomImageProperties: " + ex);
              }
        }
コード例 #10
0
        public void RefreshRandom(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Random
            if (CheckValidWindowIDForFanart())
            {
              IsRandom = true;
              RefreshRandomImageProperties(rw);
            }
            else
            {
              EmptyAllProperties();
            }
            #endregion

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else
            {
              EmptyAllProperties();
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshRandom: " + ex);
              }
        }
コード例 #11
0
 private void UpdateImageTimer(object stateInfo, ElapsedEventArgs e)
 {
     if (Utils.GetIsStopping())
     return;
       try
       {
     if (Interlocked.CompareExchange(ref SyncPointRefresh, 1, 0) == 0 && SyncPointDirectoryUpdate == 0 && (MyRefreshWorker == null || (MyRefreshWorker != null && !MyRefreshWorker.IsBusy)))
     {
       if (MyRefreshWorker == null)
       {
     MyRefreshWorker = new RefreshWorker();
     MyRefreshWorker.ProgressChanged += new ProgressChangedEventHandler(MyRefreshWorker.OnProgressChanged);
     MyRefreshWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MyRefreshWorker.OnRunWorkerCompleted);
       }
       MyRefreshWorker.RunWorkerAsync();
     }
     else
       SyncPointRefresh = 0;
       }
       catch (Exception ex)
       {
     SyncPointRefresh = 0;
     logger.Error("UpdateImageTimer: " + ex);
       }
 }
コード例 #12
0
        public void RefreshRandomImageProperties(RefreshWorker rw)
        {
            try
              {
            if (Utils.GetIsStopping())
              return;

            var doPerm = false;
            if (PropertiesRandomPerm.Count == 0)
              doPerm = true;

            if (CurrCountRandom >= FanartHandlerSetup.Fh.MaxCountImage || FirstRandom || CurrCountRandom == 0)
            {
              var str = string.Empty;
              #region Movies
              if (SupportsRandomImages("useRandomMoviesUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyMoviesUser, Utils.Category.MovieManual, ref PrevSelectedMoviesUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.movie.userdef.backdrop1.any", randomFilename, ref ListAnyMoviesUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.movie.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.movie.userdef.backdrop2.any", randomFilename, ref ListAnyMoviesUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.movie.userdef.backdrop2.any", randomFilename, ref ListAnyMoviesUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.movie.userdef.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.movie.userdef.backdrop1.any", randomFilename, ref ListAnyMoviesUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movie.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movie.userdef.backdrop2.any", string.Empty);
              PrevSelectedMoviesUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyMoviesUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movie.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movie.userdef.backdrop2.any", string.Empty);
            PrevSelectedMoviesUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              if (SupportsRandomImages("useRandomMoviesScraperFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyMoviesScraper, Utils.Category.MovieScraped, ref PrevSelectedMoviesScraper);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.movie.scraper.backdrop1.any", randomFilename, ref ListAnyMoviesScraper, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.movie.scraper.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.movie.scraper.backdrop2.any", randomFilename, ref ListAnyMoviesScraper, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.movie.scraper.backdrop2.any", randomFilename, ref ListAnyMoviesScraper, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.movie.scraper.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.movie.scraper.backdrop1.any", randomFilename, ref ListAnyMoviesScraper, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.scraper.movie.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.scraper.movie.backdrop2.any", string.Empty);
              PrevSelectedMoviesScraper = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyMoviesScraper);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movie.scraper.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movie.scraper.backdrop2.any", string.Empty);
            PrevSelectedMoviesScraper = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              if (SupportsRandomImages("useRandomMovingPicturesFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyMovingPictures, Utils.Category.MovingPictureManual, ref PrevSelectedMovingPictures);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.movingpicture.backdrop1.any", randomFilename, ref ListAnyMovingPictures, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.movingpicture.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.movingpicture.backdrop2.any", randomFilename, ref ListAnyMovingPictures, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.movingpicture.backdrop2.any", randomFilename, ref ListAnyMovingPictures, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.movingpicture.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.movingpicture.backdrop1.any", randomFilename, ref ListAnyMovingPictures, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movingpicture.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movingpicture.backdrop2.any", string.Empty);
              PrevSelectedMovingPictures = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyMovingPictures);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movingpicture.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.movingpicture.backdrop2.any", string.Empty);
            PrevSelectedMovingPictures = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region Music
              if (SupportsRandomImages("useRandomMusicUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyMusicUser, Utils.Category.MusicFanartManual, ref PrevSelectedMusicUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.music.userdef.backdrop1.any", randomFilename, ref ListAnyMusicUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.music.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.music.userdef.backdrop2.any", randomFilename, ref ListAnyMusicUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.music.userdef.backdrop2.any", randomFilename, ref ListAnyMusicUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.music.userdef.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.music.userdef.backdrop1.any", randomFilename, ref ListAnyMusicUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.userdef.backdrop2.any", string.Empty);
              PrevSelectedMusicUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyMusicUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.userdef.backdrop2.any", string.Empty);
            PrevSelectedMusicUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              if (SupportsRandomImages("useRandomMusicScraperFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyMusicScraper, Utils.Category.MusicFanartScraped, ref PrevSelectedMusicScraper);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.music.scraper.backdrop1.any", randomFilename, ref ListAnyMusicScraper, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.music.scraper.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.music.scraper.backdrop2.any", randomFilename, ref ListAnyMusicScraper, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.music.scraper.backdrop2.any", randomFilename, ref ListAnyMusicScraper, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.music.scraper.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.music.scraper.backdrop1.any", randomFilename, ref ListAnyMusicScraper, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.scraper.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.scraper.backdrop2.any", string.Empty);
              PrevSelectedMusicScraper = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyMusicScraper);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.scraper.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.music.scraper.backdrop2.any", string.Empty);
            PrevSelectedMusicScraper = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region TV
              if (SupportsRandomImages("useRandomTVUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyTVUser, Utils.Category.TvManual, ref PrevSelectedTVUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.tv.userdef.backdrop1.any", randomFilename, ref ListAnyTVUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.tv.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.tv.userdef.backdrop2.any", randomFilename, ref ListAnyTVUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.tv.userdef.backdrop2.any", randomFilename, ref ListAnyTVUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.tv.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.tv.userdef.backdrop1.any", randomFilename, ref ListAnyTVUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tv.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tv.userdef.backdrop2.any", string.Empty);
              PrevSelectedTVUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyTVUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tv.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tv.userdef.backdrop2.any", string.Empty);
            PrevSelectedTVUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region TVSeries
              if (SupportsRandomImages("useRandomTVSeriesFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyTVSeries, Utils.Category.TvSeriesScraped, ref PrevSelectedTVSeries);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.tvseries.backdrop1.any", randomFilename, ref ListAnyTVSeries, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.tvseries.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.tvseries.backdrop2.any", randomFilename, ref ListAnyTVSeries, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.tvseries.backdrop2.any", randomFilename, ref ListAnyTVSeries, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.tvseries.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.tvseries.backdrop1.any", randomFilename, ref ListAnyTVSeries, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tvseries.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tvseries.backdrop2.any", string.Empty);
              PrevSelectedTVSeries = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyTVSeries);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tvseries.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.tvseries.backdrop2.any", string.Empty);
            PrevSelectedTVSeries = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region Pictures
              if (SupportsRandomImages("useRandomPicturesUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyPicturesUser, Utils.Category.PictureManual, ref PrevSelectedPicturesUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.picture.userdef.backdrop1.any", randomFilename, ref ListAnyPicturesUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.picture.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.picture.userdef.backdrop2.any", randomFilename, ref ListAnyPicturesUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.picture.userdef.backdrop2.any", randomFilename, ref ListAnyPicturesUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.picture.userdef.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.picture.userdef.backdrop1.any", randomFilename, ref ListAnyPicturesUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.picture.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.picture.userdef.backdrop2.any", string.Empty);
              PrevSelectedPicturesUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyPicturesUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.picture.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.picture.userdef.backdrop2.any", string.Empty);
            PrevSelectedPicturesUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region Games
              if (SupportsRandomImages("useRandomGamesUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyGamesUser, Utils.Category.GameManual, ref PrevSelectedGamesUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.games.userdef.backdrop1.any", randomFilename, ref ListAnyGamesUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.games.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.games.userdef.backdrop2.any", randomFilename, ref ListAnyGamesUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.games.userdef.backdrop2.any", randomFilename, ref ListAnyGamesUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.games.userdef.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.games.userdef.backdrop1.any", randomFilename, ref ListAnyGamesUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.games.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.games.userdef.backdrop2.any", string.Empty);
              PrevSelectedGamesUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyGamesUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.games.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.games.userdef.backdrop2.any", string.Empty);
            PrevSelectedGamesUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region ScoreCenter
              if (SupportsRandomImages("useRandomScoreCenterUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyScorecenterUser, Utils.Category.SportsManual, ref PrevSelectedScorecenterUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.scorecenter.userdef.backdrop1.any", randomFilename, ref ListAnyScorecenterUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.scorecenter.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.scorecenter.userdef.backdrop2.any", randomFilename, ref ListAnyScorecenterUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.scorecenter.userdef.backdrop2.any", randomFilename, ref ListAnyScorecenterUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.scorecenter.userdef.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.scorecenter.userdef.backdrop1.any", randomFilename, ref ListAnyScorecenterUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.scorecenter.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.scorecenter.userdef.backdrop2.any", string.Empty);
              PrevSelectedScorecenterUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyScorecenterUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.scorecenter.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.scorecenter.userdef.backdrop2.any", string.Empty);
            PrevSelectedScorecenterUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              #region PlugIns
              if (SupportsRandomImages("useRandomPluginsUserFanart").Equals("True", StringComparison.CurrentCulture))
              {
            var randomFilename = GetRandomFilename(ref currAnyPluginsUser, Utils.Category.PluginManual, ref PrevSelectedPluginsUser);
            if (!string.IsNullOrEmpty(randomFilename))
            {
              if (DoShowImageOneRandom)
              {
                AddPropertyRandom("#fanarthandler.plugins.userdef.backdrop1.any", randomFilename, ref ListAnyPluginsUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.plugins.userdef.backdrop2.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.plugins.userdef.backdrop2.any", randomFilename, ref ListAnyPluginsUser, doPerm);
              }
              else
              {
                AddPropertyRandom("#fanarthandler.plugins.userdef.backdrop2.any", randomFilename, ref ListAnyPluginsUser, doPerm);
                var property = GUIPropertyManager.GetProperty("#fanarthandler.plugins.userdef.backdrop1.any");
                if (property == null || property.Length < 2 || property.EndsWith("transparent.png", StringComparison.CurrentCulture))
                  AddPropertyRandom("#fanarthandler.plugins.userdef.backdrop1.any", randomFilename, ref ListAnyPluginsUser, doPerm);
              }
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
            else
            {
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.plugins.userdef.backdrop1.any", string.Empty);
              FanartHandlerSetup.Fh.SetProperty("#fanarthandler.plugins.userdef.backdrop2.any", string.Empty);
              PrevSelectedPluginsUser = -1;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
                rw.ReportProgress(100, "Updated Properties");
            }
              }
              else
              {
            FanartHandlerSetup.Fh.EmptyAllImages(ref ListAnyPluginsUser);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.plugins.userdef.backdrop1.any", string.Empty);
            FanartHandlerSetup.Fh.SetProperty("#fanarthandler.plugins.userdef.backdrop2.any", string.Empty);
            PrevSelectedPluginsUser = -1;
            if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
              rw.ReportProgress(100, "Updated Properties");
              }
              #endregion
              ResetCurrCountRandom();
              FirstRandom = false;
              if (rw != null && FanartHandlerSetup.Fh.FR.WindowOpen)
            rw.ReportProgress(100, "Updated Properties");
            }
            IncreaseCurrCountRandom();
            if (rw == null)
              return;
            rw.ReportProgress(100, "Updated Properties");
              }
              catch (Exception ex)
              {
            logger.Error("RefreshRandomImageProperties: " + ex);
              }
        }
コード例 #13
0
        public void RefreshMusicPlaying(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Music playing
            if (CheckValidWindowIDForFanart())
            {
              Utils.GetCurrMusicPlayItem(ref CurrentTrackTag, ref CurrentAlbumTag, ref CurrentGenreTag, ref LastArtistTrack, ref LastAlbumArtistTrack);

              if (Utils.ScraperMusicPlaying && (FanartHandlerSetup.Fh.MyScraperNowWorker != null && FanartHandlerSetup.Fh.MyScraperNowWorker.TriggerRefresh))
              {
            RefreshRefreshTickCount();
            FanartHandlerSetup.Fh.MyScraperNowWorker.TriggerRefresh = false;
              }

              if (!string.IsNullOrEmpty(CurrentTrackTag) && (g_Player.Playing || g_Player.Paused))
              {
            RefreshMusicPlayingProperties();
            IsPlaying = true;
              }
              else
              {
            FanartAvailable = false;
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else
            {
              EmptyAllProperties(false);
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshMusicPlaying: " + ex);
              }
        }
コード例 #14
0
        public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            var IsIdle = Utils.IsIdle();
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Music selected
            if (IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedClearArtMusic) ||
              Utils.ContainsID(WindowsUsingFanartSelectedGenreMusic))
              {
            IsSelectedMusic = true;
            if (Utils.iActiveWindow == 504 || // My Music Genres (Main music window for database views: artist, album, genres etc)
                Utils.iActiveWindow == 501 || // My Music Songs (Music shares view screen)
                Utils.iActiveWindow == 500)   // My Music Playlist
            {
              RefreshMusicSelectedProperties();
            }
            else
            {
              RefreshGenericSelectedProperties("music",
                                               ref CurrSelectedMusic,
                                               ref CurrSelectedMusicArtist);
            }
              }
              else if (IsSelectedMusic)
              {
            EmptyMusicProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region TV/Video selected
            if (IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedGenreMovie) ||
              Utils.ContainsID(WindowsUsingFanartSelectedStudioMovie) ||
              Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie))
              {
            IsSelectedVideo = true;
            RefreshGenericSelectedProperties("movie",
                                             ref CurrSelectedMovie,
                                             ref CurrSelectedMovieTitle);
              }
              else if (IsSelectedVideo)
              {
            EmptyVideoProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else if (IsSelectedVideo || IsSelectedMusic)
            {
              EmptyAllProperties(false);
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshSelected: " + ex);
              }
        }