Exemplo n.º 1
0
 /// <summary>
 /// we assume that the new episode has more up-to-date information
 /// but we dont want to lose any info that is not retrieved automatically
 /// such as file path so we will only merge what we safely can
 /// </summary>
 /// <param name="origEp">original episode</param>
 /// <param name="newEp">new episode</param>
 private void MergeEpisodes(Episode origEp, IEpisode newEp)
 {
     origEp.AiringDateTime = newEp.AiringDateTime;
     if (string.IsNullOrEmpty(origEp.Description))
         origEp.Description = newEp.Description;
     if (origEp.DetailsURI == null )
         origEp.DetailsURI = newEp.DetailsURI;
     if (origEp.File == null)
         origEp.File = newEp.File;
     origEp.Title = newEp.Title;
 }
Exemplo n.º 2
0
        /// <summary>
        /// handles the event from the episode import dialog. we go through each of the MediaFileInfo
        /// objects and if there is no season object already, we add it. we then set the file info
        /// for the appropriate episode in the season
        /// </summary>
        /// <param name="selectedMediaItems"></param>
        private void importDialog_MediaItemsSelected(List<MediaFile> selectedMediaItems)
        {
            foreach (MediaFile mfi in selectedMediaItems)
            {
                int episodeNumber = mfi.EpisodeNumber;
                int seasonNumber = mfi.SeasonNumber;

                ISeason seasonToAdd = showDetails[seasonNumber];
                if (seasonToAdd == null)
                {
                    seasonToAdd = AddSeason(seasonNumber);
                }

                if (seasonToAdd != null)
                {
                    IEpisode ep = seasonToAdd[episodeNumber];
                    if (ep != null)
                    {
                        //                        MessageBox.Show("Setting path for Episode " + ep.EpisodeNumber + ": " + ep.Title + " to " + mfi.FileName);
                        if (ep is Episode)
                        {
                            ((Episode)ep).File = mfi;
                        }
                    }
                    else
                    {
                        ep = new Episode(seasonNumber, episodeNumber, null, mfi.EpisodeTitle, null);
                        if (seasonToAdd is Season)
                        {
                            seasonToAdd.Episodes.Add(ep);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Unable to determine any details for season " + seasonNumber);
                }

            }
        }