Beispiel #1
0
        internal void CopyFrom(TvShowSeason season)
        {
            Season = season.Season;

            var c  = Episodes.Count;
            var ec = season.Episodes.Count;

            while (c > ec)
            {
                Episodes.Remove(Episodes.ElementAt(--c));
            }

            for (var i = 0; i < ec; i++)
            {
                TvShowEpisode episode;
                if (c < i + 1)
                {
                    episode = new TvShowEpisode();
                    Episodes.Add(episode);
                }
                else
                {
                    episode = Episodes.ElementAt(i);
                }

                episode.CopyFrom(season.Episodes.ElementAt(i));
            }
        }
Beispiel #2
0
        public void MergeEpisodes(IEnumerable <ITvShowEpisodeInfo> episodes, bool subtitlesNeeded)
        {
            episodes = episodes.OrderBy(e => e.Season, new SeasonComparer()).ThenBy(e => e.Episode);

            ITvShowEpisodeInfo lastEpisode = null;

            foreach (var episodeInfo in episodes)
            {
                var season = Seasons.FirstOrDefault(s => s.Season == episodeInfo.Season);
                if (season == null)
                {
                    season = new TvShowSeason {
                        TvShowId = Id, TvShow = this, Season = episodeInfo.Season
                    };
                    Seasons.Add(season);
                }

                var episode = season.Episodes.FirstOrDefault(e => e.Episode == episodeInfo.Episode);
                if (episode == null)
                {
                    episode = new TvShowEpisode {
                        TvShowSeason = season
                    };
                    season.Episodes.Add(episode);
                    episode.Episode                    = episodeInfo.Episode;
                    episode.BackgroundDownload         = AutoDownload;
                    episode.BackgroundSubtitleDownload = AutoDownload && subtitlesNeeded;
                }

                episode.AirDate  = episodeInfo.AirDate;
                episode.Name     = episodeInfo.Name;
                episode.Overview = episodeInfo.Overview;

                lastEpisode = episodeInfo;
            }

            if (lastEpisode != null)
            {
                for (var i = Seasons.Count - 1; i >= 0; i--)
                {
                    var season = Seasons.ElementAt(i);
                    if (season.Season > lastEpisode.Season)
                    {
                        Seasons.Remove(season);
                    }
                    else if (season.Season == lastEpisode.Season)
                    {
                        for (var j = season.Episodes.Count - 1; j >= 0; j--)
                        {
                            var episode = season.Episodes.ElementAt(j);
                            if (episode.Episode > lastEpisode.Episode)
                            {
                                season.Episodes.Remove(episode);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
 internal void CopyFrom(TvShowEpisode episode)
 {
     Episode                    = episode.Episode;
     Name                       = episode.Name;
     Overview                   = episode.Overview;
     AirDate                    = episode.AirDate;
     BackgroundDownload         = episode.BackgroundDownload;
     DownloadKey                = episode.DownloadKey;
     NotFound                   = episode.NotFound;
     FilePath                   = episode.FilePath;
     BackgroundSubtitleDownload = episode.BackgroundSubtitleDownload;
     SubtitleNotFound           = episode.SubtitleNotFound;
     SubtitleDownloaded         = episode.SubtitleDownloaded;
     IsWatched                  = episode.IsWatched;
 }
Beispiel #4
0
 internal void CopyFrom(TvShowEpisode episode) {
     Episode = episode.Episode;
     Name = episode.Name;
     Overview = episode.Overview;
     AirDate = episode.AirDate;
     BackgroundDownload = episode.BackgroundDownload;
     DownloadKey = episode.DownloadKey;
     NotFound = episode.NotFound;
     FilePath = episode.FilePath;
     BackgroundSubtitleDownload = episode.BackgroundSubtitleDownload;
     SubtitleNotFound = episode.SubtitleNotFound;
     SubtitleDownloaded = episode.SubtitleDownloaded;
     IsWatched = episode.IsWatched;
 }
Beispiel #5
0
        public void MergeEpisodes(IEnumerable<ITvShowEpisodeInfo> episodes, bool subtitlesNeeded) {
            episodes = episodes.OrderBy(e => e.Season, new SeasonComparer()).ThenBy(e => e.Episode);

            ITvShowEpisodeInfo lastEpisode = null;
            foreach (var episodeInfo in episodes) {
                var season = Seasons.FirstOrDefault(s => s.Season == episodeInfo.Season);
                if (season == null) {
                    season = new TvShowSeason { TvShowId = Id, TvShow = this, Season = episodeInfo.Season };
                    Seasons.Add(season);
                }

                var episode = season.Episodes.FirstOrDefault(e => e.Episode == episodeInfo.Episode);
                if (episode == null) {
                    episode = new TvShowEpisode { TvShowSeason = season };
                    season.Episodes.Add(episode);
                    episode.Episode = episodeInfo.Episode;
                    episode.BackgroundDownload = AutoDownload;
                    episode.BackgroundSubtitleDownload = AutoDownload && subtitlesNeeded;
                }

                episode.AirDate = episodeInfo.AirDate;
                episode.Name = episodeInfo.Name;
                episode.Overview = episodeInfo.Overview;

                lastEpisode = episodeInfo;
            }

            if (lastEpisode != null) {
                for (var i = Seasons.Count - 1; i >= 0; i--) {
                    var season = Seasons.ElementAt(i);
                    if (season.Season > lastEpisode.Season)
                        Seasons.Remove(season);
                    else if (season.Season == lastEpisode.Season) {
                        for (var j = season.Episodes.Count - 1; j >= 0; j--) {
                            var episode = season.Episodes.ElementAt(j);
                            if (episode.Episode > lastEpisode.Episode)
                                season.Episodes.Remove(episode);
                        }
                    }
                }
            }
        }
 private static bool CanPlayTvShowEpisode(TvShowEpisode episode) {
     return episode != null && !string.IsNullOrWhiteSpace(episode.FilePath) && File.Exists(episode.FilePath);
 }
 private static void PlayTvShowEpisode(TvShowEpisode episode) {
     Process.Start(episode.FilePath);
 }
 private static bool CanDeleteTvShowEpisode(TvShowEpisode episode) {
     return episode != null && !string.IsNullOrEmpty(episode.FilePath) && File.Exists(episode.FilePath);
 }
        private async void DeleteTvShowEpisode(TvShowEpisode episode) {
            var result = await DialogService.Confirm(Resources.MontyNi, Resources.AreYouSure);
            if (!result) return;

            Novaroma.Helper.DeleteTvShowEpisode(episode, _exceptionHandler);
        }
 private async Task DownloadTvShowEpisodeSubtitle(TvShowEpisode tvShowEpisode) {
     await Helper.ManualSubtitleDownload(_engine, _exceptionHandler, DialogService, tvShowEpisode);
 }
Beispiel #11
0
 public static Task ManualDownload(INovaromaEngine engine, IExceptionHandler exceptionHandler, IDialogService dialogService, TvShowEpisode episode) {
     var downloadable = (IDownloadable)episode;
     var directory = Novaroma.Helper.GetTvShowSeasonDirectory(engine.TvShowSeasonDirectoryTemplate, episode);
     return ManualDownload(engine, exceptionHandler, dialogService, episode, downloadable.GetSearchQuery(), 
                           downloadable.VideoQuality, downloadable.ExcludeKeywords, downloadable.MinSize, downloadable.MaxSize, directory);
 }
 public void TvShowEpisodeSubtitleDownloaded(TvShowEpisode episode)
 {
     MkvPackage(episode);
 }
 public void TvShowEpisodeDownloaded(TvShowEpisode episode)
 {
 }
Beispiel #14
0
        internal void CopyFrom(TvShowSeason season) {
            Season = season.Season;

            var c = Episodes.Count;
            var ec = season.Episodes.Count;
            while (c > ec) Episodes.Remove(Episodes.ElementAt(--c));

            for (var i = 0; i < ec; i++) {
                TvShowEpisode episode;
                if (c < i + 1) {
                    episode = new TvShowEpisode();
                    Episodes.Add(episode);
                }
                else
                    episode = Episodes.ElementAt(i);

                episode.CopyFrom(season.Episodes.ElementAt(i));
            }
        }