/// <summary> /// Reads from the specified media item. /// </summary> /// <param name="item">The item.</param> public void ReadFrom(MediaItem item) { if (item is TvSeries) showDetails = (TvSeries)item; allSeasons = null; lstSeasons.Items.Clear(); grdEpisodes.DataSource = null; foreach (MediaItem child in item.Children) { if (child is ISeason) { lstSeasons.Items.Add(child); } } }
/// <summary> /// returns true if the media file and tv series are compatible. to check this we /// condense the titles for both objects, removing whitespace and removing periods , underscores and dashes. /// if the two titles are the same after that, they are considered compatible. /// </summary> /// <param name="mfi"></param> /// <param name="series"></param> /// <returns>true if the media file and tv series are compatible, otherwise false</returns> private bool IsCompatible( MediaFile mfi, TvSeries series) { string condensedMfiTitle = mfi.Title.ToLower().Replace(" ", "").Replace(".", "").Replace("_", "").Replace("-", "").Replace(":", "").Replace("'", "").Replace("(", "").Replace(")", ""); string condensedSeriesTitle = series.Title.ToLower().Replace(" ", "").Replace(".", "").Replace("_", "").Replace("-", "").Replace(":", "").Replace("'", "").Replace("(", "").Replace(")", ""); return condensedMfiTitle.Equals(condensedSeriesTitle); }