Example #1
0
        void setFanartPreviewBackground(MFFanart fanart)
        {
            string fanartInfo = fanart.isAvailableLocally ? "Translation.FanArtLocal" : "Translation.FanArtOnline";
              fanartInfo += Environment.NewLine;

              MyFilmsDetail.setGUIProperty("FanArt.SelectedFanartResolution", fanart.ImageResolutionClass);
              fanartInfo += "Resolution: " + fanart.ImageResolutionClass + Environment.NewLine;
              MyFilmsDetail.setGUIProperty("FanArt.SelectedFanartIsChosen", fanart.Chosen.ToString());
              fanartInfo += "Chosen: " + fanart.Chosen + Environment.NewLine;
              MyFilmsDetail.setGUIProperty("FanArt.SelectedFanartIsDisabled", fanart.Disabled.ToString());
              fanartInfo += "Disabled: " + fanart.Disabled + Environment.NewLine;

              MyFilmsDetail.setGUIProperty("FanArt.SelectedFanartInfo", fanartInfo);

              string preview = string.Empty;

              lock (locker)
              {
            if (fanart.isAvailableLocally)
            {
              // Ensure Fanart on Disk is valid as well
              if (ImageAllocator.LoadImageFastFromFile(fanart.FullLocalPath) == null)
              {
            LogMyFilms.Debug("Fanart is invalid, deleting...");
            fanart.Delete();
            fanart.Chosen = false;
            m_Facade.SelectedListItem.Label = "Translation.FanArtOnline";
              }

              // Should be safe to assign fullsize fanart if available
              preview = fanart.isAvailableLocally ?
                    ImageAllocator.GetOtherImage(fanart.FullLocalPath, default(System.Drawing.Size), false) :
                    m_Facade.SelectedListItem.IconImageBig;
            }
            else
              preview = m_Facade.SelectedListItem.IconImageBig;

            MyFilmsDetail.setGUIProperty("FanArt.SelectedPreview", preview);
              }
        }
Example #2
0
        public static List<MFFanart> GetAll(int SeriesID, bool availableOnly)
        {
            lock (cache)
              {
            if (SeriesID < 0) return new List<MFFanart>();

            if (cache == null || !cache.ContainsKey(SeriesID))
            {
              try
              {
            // make sure the table is created - create a dummy object
            MFFanart dummy = new MFFanart();

            // retrieve all fields in the table
            // ToDo: Get TMDB fanarts here ...
            var movies = new List<TmdbMovie>();
            var movie = new TmdbMovie();
            var results = movie.backdrop_path;
            if (results.Length > 0)
            {
              var ourFanart = new List<MFFanart>(results.Length);

              for (int index = 0; index < results.Length; index++)
              {
                ourFanart.Add(new MFFanart());
                // ourFanart[index].Read(ref results, index);
              }
              if (cache == null) cache = new Dictionary<int, List<MFFanart>>();
              cache.Add(SeriesID, ourFanart);
            }
            LogMyFilms.Debug("Found " + results.Length + " Fanart from TMDB");

              }
              catch (Exception ex)
              {
            LogMyFilms.Error("Error in MFFanart.Get (" + ex.Message + ").");
              }
            }
            List<MFFanart> faForSeries = null;
            if (cache != null && cache.TryGetValue(SeriesID, out faForSeries))
              return faForSeries;
            return new List<MFFanart>();
              }
        }
Example #3
0
        void downloadFanart(MFFanart fanart)
        {
            // we need to get it, let's queue them up and download in the background
              lock (toDownload)
              {
            toDownload.Enqueue(fanart);
              }
              setDownloadStatus();
              // don't return, user can queue up multiple fanart to download
              // the last he selects to download will be the chosen one by default

              // finally lets check if the downloader is already running, and if not start it
              if (!downloadingWorker.IsBusy)
            downloadingWorker.RunWorkerAsync();
        }