Esempio n. 1
0
 /// <summary>
 /// Creates a new Episode.
 /// </summary>
 /// <param name="season">Season this episode belongs to</param>
 /// <param name="recordedId">ID of this recording used for further Myth API calls about this recording</param>
 /// <param name="filename">Name of this episode's video file (without path)</param>
 /// <param name="name">Name of this episode (without show title)</param>
 /// <param name="number">Episode number (should parse as integer)</param>
 /// <param name="aired">Date first aired</param>
 /// <param name="recorded">Date and time recorded</param>
 /// <param name="endtime">Date and time the recording ended</param>
 /// <param name="status">Status of the recording</param>
 public Episode(Season season, string recordedId, string filename, string name, string number, string aired, string recorded, string endtime, string status)
 {
     _season = season;
       _recordingId = recordedId;
       _filename = filename;
       _name = name;
       int.TryParse(number, out _number);
       bool hasAired = DateTime.TryParse(aired, out _aired);
       if(DateTime.TryParse(recorded, out _recorded)) {
     DateTime.TryParse(endtime, out _doneRecording);
     if(!hasAired)
       _aired = _recorded;
       }
       _inProgress = status.Equals("Recording", StringComparison.CurrentCultureIgnoreCase);
 }
Esempio n. 2
0
 /// <summary>
 /// Check whether the specified season has any recordings.
 /// </summary>
 /// <param name="s">Season to find</param>
 /// <returns>True if there are recordings for the specified Season</returns>
 public bool Contains(Season s)
 {
     return Shows.Contains(s.Show) && s.Show.Seasons.Contains(s);
 }
Esempio n. 3
0
 /// <summary>
 /// Compares this instance to a specified Season and returns an indication of their relative values.
 /// </summary>
 /// <param name="season">Season to compare</param>
 /// <returns>Comparison result for sorting</returns>
 public int CompareTo(Season season)
 {
     return Number.CompareTo(season.Number);
 }
Esempio n. 4
0
 /// <summary>
 /// Find the existing season or add the show if not yet present.
 /// </summary>
 /// <param name="number">Season number (used to match existing seasons; should parse as an integer)</param>
 /// <param name="cover">URL to cover art (only used if season is added)</param>
 /// <returns>Found or added season</returns>
 public Season GetSeason(string number, string cover)
 {
     int epnum = 0;
       int.TryParse(number, out epnum);
       foreach(Season s in Seasons)
     if(s.Number == epnum)
       return s;
       Season season = new Season(this, number, cover);
       Seasons.Add(season);
       return season;
 }
Esempio n. 5
0
 /// <summary>
 /// Show the info panel with information for the specified Season.
 /// </summary>
 /// <param name="s">Season to display</param>
 private void ShowSeasonInfo(Season s)
 {
     _pnlInfo.Controls.Clear();
       _pnlInfo.Tag = s;
       // assume we'll only show season info if it's a valid season (this is not true because sometimes season info is missing)
       _pnlInfo.Controls.Add(MakeInfoTitleLabel(string.Format(Properties.Resources.InfoSeasonTitle, s.Show.Title, s.Number)));
       _pnlInfo.Controls.Add(MakeInfoLabel(string.Format(Properties.Resources.InfoNumEpisodes, s.Episodes.Count)));
       _pnlInfo.Controls.Add(MakeInfoLabel(string.Format(Properties.Resources.InfoRecordedRange, s.OldestEpisode.Recorded, s.NewestEpisode.Recorded)));
       _pnlInfo.Controls.Add(MakeInfoLabel(s.Duration.ToStringUnit()));
       _pnlInfo.Controls.Add(MakeInfoAction(Properties.Resources.Play18, Properties.Resources.ActionPlayOldest, Properties.Resources.TipPlayOldestSeason, btnSeasonPlay_Click));
       _pnlInfo.Controls.Add(MakeInfoAction(Properties.Resources.Export18, Properties.Resources.ActionExport, Properties.Resources.TipExportSeason, btnSeasonExport_Click));
       _pnlInfo.Controls.Add(MakeInfoAction(Properties.Resources.Delete18, Properties.Resources.ActionDeleteOldest, Properties.Resources.TipDeleteOldestSeason, btnSeasonDelete_Click));
 }
Esempio n. 6
0
 /// <summary>
 /// List all recorded episodes for the specified season.
 /// </summary>
 /// <param name="season">Season to list episodes for</param>
 /// <param name="selectName">Episode name to select</param>
 private void ListEpisodes(Season season, string selectName)
 {
     _pnlMain.Controls.Clear();
       _pnlMain.Tag = season;
       _tip.SetToolTip(_pbBack, string.Format(Properties.Resources.BackTo, string.Format(Properties.Resources.RecordedSeasons, season.Show.Title)));
       _pbBack.Enabled = true;
       _lblTitle.Text = season.Number > 0 ? string.Format(Properties.Resources.RecordedSeasonEpisodes, season.Show.Title, season.Number) : string.Format(Properties.Resources.RecordedEpisodes, season.Show.Title);
       bool selectedSomething = false;
       foreach(Episode e in season.Episodes) {
     CaptionedPictureBox cpb = new CaptionedPictureBox();
     cpb.Tag = e;
     cpb.Image = e.Thumb != null ? e.Thumb : Properties.Resources.Static1080p;
     cpb.Text = e.Name ?? e.FirstAired.ToString("M/d/yyyy");
     cpb.Width = 212;
     cpb.Height = 125 + cpb.CaptionHeight;
     cpb.SizeMode = PictureBoxSizeMode.StretchImage;
     cpb.Padding = new Padding(6);
     cpb.Margin = new Padding(5);
     cpb.Click += mainItem_Click;
     cpb.DoubleClick += pbEpisode_DoubleClick;
     cpb.ContextMenuStrip = _cmnuEpisode;
     _pnlMain.Controls.Add(cpb);
     if(e.Name == selectName) {
       Select(cpb);
       selectedSomething = true;
     }
       }
       if(!selectedSomething && _pnlMain.Controls.Count > 0)
     Select(_pnlMain.Controls[0]);
 }
Esempio n. 7
0
 /// <summary>
 /// List all recorded episodes for the specified season.
 /// </summary>
 /// <param name="season">Season to list episodes for</param>
 private void ListEpisodes(Season season)
 {
     ListEpisodes(season, null);
 }
Esempio n. 8
0
 /// <summary>
 /// Export all Episodes of the specified Season with readable filenames to
 /// the specified path with the specified filename format.
 /// </summary>
 /// <param name="s">Season containing the Episodes to export</param>
 /// <param name="exportPath">Path to save exported episodes</param>
 /// <param name="nameFormat">Name format for exported episodes</param>
 private void ExportSeasonEpisodes(Season s, string exportPath, string nameFormat)
 {
     using(FileOperation fo = new FileOperation())
     foreach(Episode e in s.Episodes)
       ExportEpisodeTo(e, exportPath, nameFormat, fo);
 }
Esempio n. 9
0
 /// <summary>
 /// Export all Episodes of the specified Season with readable filenames.
 /// </summary>
 /// <param name="s">Season containing the Episodes to export</param>
 private void ExportSeasonEpisodes(Season s)
 {
     string nameFormat, exportPath;
       if(AskExportDetails(s.OldestEpisode, true, out nameFormat, out exportPath)) {
     Thread exportThread = new Thread(() => ExportSeasonEpisodes(s, exportPath, nameFormat));
     exportThread.TrySetApartmentState(ApartmentState.MTA);
     exportThread.Name = "ExportSeasonEpisodes";
     exportThread.Start();
       }
 }