예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="series"></param>
        /// <param name="episode"></param>
        /// <param name="quality"></param>
        /// <returns></returns>
        public override SearchResult FindTorrent(Series series,
                                                 Episode episode,
                                                 Global.EpisodeQuality quality)
        {
            var rssFeed = from r in _rssShows where r.Item2.ToLower() == series.Name.ToLower() select r;
            if (rssFeed.Any() == false)
            {
                // Log
                return null;
            }

            List<RssResult> rssResults = GetShowRssResults(rssFeed.First().Item1, series.Id);

            var result = from r in rssResults
                         where
                             r.SeasonNumber == episode.SeasonNumber & r.EpisodeNumber == episode.EpisodeNumber &
                             r.Quality == quality
                         select r;

            // Need a fall back option on the quality
            if (result.Any() == false)
            {
                return null;
            }

            SearchResult searchResult = new SearchResult();
            searchResult.Url = result.First().Url;
            searchResult.Quality = result.First().Quality;

            return searchResult;
        }
예제 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="series"></param>
 /// <param name="episode"></param>
 /// <param name="quality"></param>
 /// <returns></returns>
 public abstract SearchResult FindTorrent(Series series, Episode episode, Global.EpisodeQuality quality);
예제 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="series"></param>
        /// <param name="episode"></param>
        private void UpdateEpisodeList(Series series, Episode episode)
        {
            MethodInvoker methodInvoker = delegate
            {
                if (listSeries.SelectedObject == null)
                {
                    return;
                }

                // If we are currently displaying the series that has just updated, then update the episode list
                Series tempSeries = (Series)listSeries.SelectedObject;
                if (tempSeries.Guid != series.Guid)
                {
                    return;
                }

                List<Episode> tempEpisodes = listEpisodes.Objects.Cast<Episode>().ToList();
                var tempEpisode = (from e in tempEpisodes where e.Id == episode.Id select e).SingleOrDefault();
                if (tempEpisode == null)
                {
                    return;
                }

                tempEpisode.Path = episode.Path;
                tempEpisode.FileName = episode.FileName;
                tempEpisode.Folder = episode.Folder;
                tempEpisode.Quality = episode.Quality;
                tempEpisode.Status = episode.Status;

                listEpisodes.RefreshObject(tempEpisode);
            };

            if (listEpisodes.InvokeRequired == true)
            {
                this.BeginInvoke(methodInvoker);
            }
            else
            {
                methodInvoker.Invoke();
            }
        }
예제 #4
0
        /// <summary>
        /// 
        /// </summary>
        private void OnManager_SeriesFound(Series series)
        {
            MethodInvoker methodInvoker = delegate
            {
                _configuration.Shows.Add(series);
                listSeries.AddObject(series);
                listSeries.SelectedObject = series;
            };

            if (listEpisodes.InvokeRequired == true)
            {
                this.BeginInvoke(methodInvoker);
            }
            else
            {
                methodInvoker.Invoke();
            }
        }
예제 #5
0
        /// <summary>
        /// 
        /// </summary>
        private void StartShows()
        {
            // Series ID?, Path?
            foreach (Tuple<int, string> item in _shows.GetConsumingEnumerable())
            {
                // Need to go and download the series info and store locally? Need to wait until it has been downloaded before searching for episodes
                var temp = (from s in _configuration.Shows where s.Id == item.Item1 select s).SingleOrDefault();
                if (temp != null)
                {
                    // This in theory should never happen.
                    _logger.Info("Cannot add new show as it already exists: SeriesID:" + item.Item1 + "#Path:" + item.Item2);
                    OnError("Series already exists");
                    continue;
                }

                Series series = new Series();
                series.Id = item.Item1;
                series.Path = item.Item2;

                _retriever.DownloadSeries(item.Item1,
                                          Helper.GetSeriesCacheFolderPath(item.Item1));

                // Update the cache path
                series.CachePath = Helper.GetSeriesCacheFilePath(item.Item1);

                // Now we have the baseline data from TVDB, we populate our
                // local data store with all known seasons and episodes

                TvDbSeries seriesCache = Cache.Series(item.Item1, Helper.GetSeriesCacheFilePath(series.Id));
                series.Name = seriesCache.Name;
                series.Overview = seriesCache.Description;
                series.FirstAired = seriesCache.FirstAired;
                series.ImdbId = seriesCache.ImdbId;

                foreach (TvDbEpisode episodeCache in Cache.Episodes(item.Item1, Helper.GetSeriesCacheFilePath(series.Id)))
                {
                    Episode episode = new Episode();
                    episode.SeriesId = series.Id;
                    episode.EpisodeNumber = episodeCache.EpisodeNumber;
                    episode.SeasonNumber = episodeCache.SeasonNumber;
                    episode.Name = episodeCache.EpisodeName;
                    episode.Overview = episodeCache.Overview;
                    episode.Id = episodeCache.Id;
                    series.Episodes.Add(episode);
                }

                OnSeriesFound(series);
                EnumerateFiles(item.Item1, item.Item2);
            }
        }
예제 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="series"></param>
 private void OnSeriesFound(Series series)
 {
     var handler = SeriesFound;
     if (handler != null)
     {
         handler(series);
     }
 }
예제 #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="series"></param>
 /// <param name="episode"></param>
 public void AddTorrent(Series series, Episode episode)
 {
     _torrents.Add(new Tuple<Series, Episode>(series, episode));
 }