コード例 #1
0
        protected bool CheckBeginDownloadFanArt(TId itemId)
        {
            bool fanArtDownloaded = false;

            lock (_syncObj)
            {
                // Load cache or create new list
                List <TMatch> matches = _storage.GetMatches();
                foreach (TMatch match in matches.FindAll(m => m.Id.Equals(itemId)))
                {
                    // We can have multiple matches for one TvDbId in list, if one has FanArt downloaded already, update the flag for all matches.
                    if (match.FanArtDownloadFinished.HasValue)
                    {
                        fanArtDownloaded = true;
                    }

                    if (!match.FanArtDownloadStarted.HasValue)
                    {
                        match.FanArtDownloadStarted = DateTime.Now;
                    }
                }
                _storage.SaveMatches();
            }
            return(fanArtDownloaded);
        }
コード例 #2
0
        protected bool CheckBeginDownloadFanArt(FanartDownload <TId> fanartDownload)
        {
            bool fanArtDownloaded = false;

            lock (_syncObj)
            {
                // Load cache or create new list
                List <TMatch> matches = _storage.GetMatches();
                foreach (TMatch match in matches.FindAll(m => m.Id != null && m.Id.Equals(fanartDownload.Id)))
                {
                    if (string.IsNullOrEmpty(match.FanArtDownloadId))
                    {
                        match.FanArtDownloadId = fanartDownload.DownloadId;
                    }

                    // We can have multiple matches for one TvDbId in list, if one has FanArt downloaded already, update the flag for all matches.
                    if (match.FanArtDownloadFinished.HasValue)
                    {
                        fanArtDownloaded = true;
                    }

                    if (!match.FanArtDownloadStarted.HasValue)
                    {
                        match.FanArtDownloadStarted = DateTime.Now;
                    }
                }

                //It's possible that we have multiple matches with the same id, ensure that they are all marked as finished
                if (fanArtDownloaded)
                {
                    foreach (TMatch match in matches.FindAll(m => m.Id != null && m.Id.Equals(fanartDownload.Id) && !m.FanArtDownloadFinished.HasValue))
                    {
                        match.FanArtDownloadFinished = DateTime.Now;
                    }
                }

                _storage.SaveMatches();
            }
            return(fanArtDownloaded);
        }
コード例 #3
0
        protected void FinishDownloadFanArt(TId itemId)
        {
            lock (_syncObj)
            {
                // Load cache or create new list
                List <TMatch> matches = _storage.LoadMatches();
                foreach (TMatch match in matches.FindAll(m => m.Id.Equals(itemId)))
                {
                    if (!match.FanArtDownloadFinished.HasValue)
                    {
                        match.FanArtDownloadFinished = DateTime.Now;
                    }
                }

                _storage.SaveMatches(matches);
            }
        }