Example #1
0
        public void Fetch()
        {
            if (!_mutexFetch.WaitOne(0)) //try get mutex
            {
                //already a fetch in progress
                _mutexFetch.WaitOne(); //wait on finish
                _mutexFetch.ReleaseMutex();
                return;
            }
            if (_providerData == null)
            {
                // InfoUrl = SjInfo.SearchSjDe(Name);
                ProviderData = ProviderManager.GetProvider().FindShow(Name);
                Status       = "Unknown";
            }
            if (_providerData != null)
            {
                ShowInformation si = ProviderManager.GetProvider().GetShowInformation(ProviderData, false, true);
                if (si != null)
                {
                    Status = si.Status;
                    PreviousEpisodeDate      = si.PreviousEpisodeDate;
                    PreviousEpisodeSeasonNr  = si.PreviousEpisodeSeasonNr;
                    PreviousEpisodeEpisodeNr = si.PreviousEpisodeEpisodeNr;
                    NextEpisodeDate          = si.NextEpisodeDate;
                    NextEpisodeEpisodeNr     = si.NextEpisodeEpisodeNr;
                    NextEpisodeSeasonNr      = si.NextEpisodeSeasonNr;
                }
            }

            try
            {
                IsLoading = true;
                String cover;
                var    episodes = SjInfo.ParseSjOrgSite(_show, out cover, Settings.Instance.UploadCache);
                AllDownloads = episodes;
                if (cover != "")
                {
                    Cover = cover;
                }
                _mutexFetch.ReleaseMutex();
                if (_resetOnRefresh)
                {
                    _resetOnRefresh = false;
                    ApplyFilter(true);
                }
                else
                {
                    ApplyFilter(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                IsLoading = false;
            }
        }
Example #2
0
        public void Fetch()
        {
            if (!_mutexFetch.WaitOne(0)) //try get mutex
            {
                //already a fetch in progress
                _mutexFetch.WaitOne(); //wait on finish
                _mutexFetch.ReleaseMutex();
                return;
            }
            if (_providerData == null)
            {
                // InfoUrl = SjInfo.SearchSjDe(Name);
                ProviderData = ProviderManager.GetProvider().FindShow(Name);
            }

            try
            {
                IsLoading = true;
                String cover;
                var    episodes = SjInfo.ParseSjOrgSite(_show, out cover, Settings.Instance.UploadCache);
                AllDownloads = episodes;
                if (cover != "")
                {
                    Cover = cover;
                }
                _mutexFetch.ReleaseMutex();
                if (_resetOnRefresh)
                {
                    _resetOnRefresh = false;
                    ApplyFilter(true);
                }
                else
                {
                    ApplyFilter(false);
                }
            }
            finally
            {
                IsLoading = false;
            }
        }