private void btnGenres_Click(object sender, EventArgs e) { if (_dvdTitle != null) { List <string> items = new List <string>(); items.AddRange(_dvdTitle.Genres); items.Sort(); EditList("Genres", items); _dvdTitle.RemoveAllGenres(); foreach (string item in items) { _dvdTitle.AddGenre(item); } } }
private void btnSave_Click(object sender, EventArgs e) { int i = 0; foreach (GenreMapping map in _genreMapping) { ComboBoxEdit cbeGenre = tableLayoutPanel1.Controls.Find("cbeGenre" + i, false)[0] as ComboBoxEdit; RadioGroup grpActions = tableLayoutPanel1.Controls.Find("grpActions" + i, false)[0] as RadioGroup; if (grpActions.SelectedIndex == 0) { // ignore genre if (_title.Genres.Contains(map.SourceGenre)) { _title.RemoveGenre(map.SourceGenre); } OMLEngine.Dao.GenreMapping mapping = new OMLEngine.Dao.GenreMapping(); mapping.GenreName = map.SourceGenre; mapping.GenreMapTo = string.Empty; OMLEngine.Settings.SettingsManager.GenreMap_Add(mapping); } else { // map genre if (_title.Genres.Contains(map.SourceGenre)) { _title.RemoveGenre(map.SourceGenre); } if (!_title.Genres.Contains(cbeGenre.Text)) { _title.AddGenre(cbeGenre.Text); } OMLEngine.Settings.SettingsManager.GenreMap_Remove(map.SourceGenre); OMLEngine.Dao.GenreMapping mapping = new OMLEngine.Dao.GenreMapping(); mapping.GenreName = map.SourceGenre; mapping.GenreMapTo = cbeGenre.Text; OMLEngine.Settings.SettingsManager.GenreMap_Add(mapping); } i++; } }
public static Title ConvertOMLSDKTitleToTitle(OMLSDKTitle omlsdktitle) { Title _title = new Title(); if (omlsdktitle != null) { _title.NameTrimmed = CopyString(omlsdktitle.Name); _title.OriginalNameTrimmed = CopyString(omlsdktitle.OriginalName); _title.SortNameTrimmed = CopyString(omlsdktitle.SortName); _title.Synopsis = CopyString(omlsdktitle.Synopsis); _title.ProductionYear = omlsdktitle.ProductionYear; _title.ReleaseDate = omlsdktitle.ReleaseDate; _title.DateAdded = omlsdktitle.DateAdded; _title.Runtime = omlsdktitle.Runtime; _title.StudioTrimmed = CopyString(omlsdktitle.Studio); _title.UPCTrimmed = CopyString(omlsdktitle.UPC); _title.WatchedCount = omlsdktitle.WatchedCount; _title.UserStarRating = omlsdktitle.UserStarRating; _title.EpisodeNumber = omlsdktitle.EpisodeNumber; _title.SeasonNumber = omlsdktitle.SeasonNumber; _title.AspectRatioTrimmed = CopyString(omlsdktitle.AspectRatio); _title.VideoDetails = CopyString(omlsdktitle.VideoDetails); _title.VideoResolutionTrimmed = CopyString(omlsdktitle.VideoResolution); _title.VideoStandardTrimmed = CopyString(omlsdktitle.VideoStandard); //_title.VideoFormat = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdktitle.VideoFormat.ToString()); _title.FrontCoverPath = CopyString(omlsdktitle.FrontCoverPath); _title.BackCoverPath = CopyString(omlsdktitle.BackCoverPath); _title.CountryOfOriginTrimmed = CopyString(omlsdktitle.CountryOfOrigin); _title.MetadataSourceIDTrimmed = CopyString(omlsdktitle.MetadataSourceID); _title.MetadataSourceNameTrimmed = CopyString(omlsdktitle.MetadataSourceName); _title.ImporterSourceTrimmed = CopyString(omlsdktitle.ImporterSource); _title.OfficialWebsiteURLTrimmed = CopyString(omlsdktitle.OfficialWebsiteURL); _title.ParentalRatingTrimmed = CopyString(omlsdktitle.ParentalRating); _title.ParentalRatingReasonTrimmed = CopyString(omlsdktitle.ParentalRatingReason); #region Disks foreach (OMLSDKDisk omlsdkdisk in omlsdktitle.Disks) { Disk disk = new Disk(); disk.Name = omlsdkdisk.Name; disk.Path = omlsdkdisk.Path; disk.Format = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdkdisk.Format.ToString()); disk.ExtraOptions = omlsdkdisk.ExtraOptions; _title.AddDisk(disk); } #endregion #region Extra Features _title.ExtraFeatures = omlsdktitle.ExtraFeatures; #endregion #region Trailers foreach (string Trailer in omlsdktitle.Trailers) { _title.AddTrailer(Trailer); } #endregion #region Genres if (omlsdktitle.Genres != null) { foreach (string genre in omlsdktitle.Genres) { _title.AddGenre(genre); } } #endregion #region Actring Roles if (omlsdktitle.ActingRoles != null) { foreach (OMLSDKRole role in omlsdktitle.ActingRoles) { _title.AddActingRole(role.PersonName, role.RoleName); } } #endregion #region Non Acting Roles if (omlsdktitle.NonActingRoles != null) { foreach (OMLSDKRole role in omlsdktitle.NonActingRoles) { _title.AddNonActingRole(role.PersonName, role.RoleName); } } #endregion #region Directors if (omlsdktitle.Directors != null) { foreach (OMLSDKPerson person in omlsdktitle.Directors) { _title.AddDirector(ConvertOMLSDKPersonToPerson(person)); } } #endregion #region Writers if (omlsdktitle.Writers != null) { foreach (OMLSDKPerson person in omlsdktitle.Writers) { _title.AddWriter(ConvertOMLSDKPersonToPerson(person)); } } #endregion #region Producers if (omlsdktitle.Producers != null) { foreach (OMLSDKPerson person in omlsdktitle.Producers) { _title.AddProducer(ConvertOMLSDKPersonToPerson(person)); } } #endregion #region Tags if (omlsdktitle.Tags != null) { foreach (string tag in omlsdktitle.Tags) { _title.AddTag(tag); } } #endregion #region Audio Tracks if (omlsdktitle.AudioTracks != null) { foreach (string track in omlsdktitle.AudioTracks) { _title.AddAudioTrack(track); } } #endregion #region Subtitles if (omlsdktitle.Subtitles != null) { foreach (string subtitles in omlsdktitle.Subtitles) { _title.AddSubtitle(subtitles); } } #endregion #region Fanart Paths if (omlsdktitle.FanArtPaths != null) { foreach (string path in omlsdktitle.FanArtPaths) { _title.AddFanArtImage(path); } } #endregion } return _title; }
/// <summary> /// Looksup the preferred metadata on the passed in search criteria /// </summary> /// <param name="titletype"></param> /// <param name="coverArtOnly"></param> /// <param name="titleNameSearch"></param> /// <param name="EpisodeName"></param> /// <param name="SeasonNo"></param> /// <param name="EpisodeNo"></param> /// <param name="title"></param> /// <returns></returns> public bool MetadataSearchUsingPreferred(TitleTypes titletype, /*bool coverArtOnly,*/ string titleNameSearch, string EpisodeName, int?SeasonNo, int?EpisodeNo, out Title title) { title = null; string preferredplugin = OMLEngine.Settings.OMLSettings.DefaultMetadataPluginMovies; if ((((titletype & TitleTypes.TVShow) != 0) || ((titletype & TitleTypes.Season) != 0) || ((titletype & TitleTypes.Episode) != 0)) && (!string.IsNullOrEmpty(OMLEngine.Settings.OMLSettings.DefaultMetadataPluginTV))) { // If we are looking for an episode and there is a preferred setting for this, use it preferredplugin = OMLEngine.Settings.OMLSettings.DefaultMetadataPluginTV; } if (string.IsNullOrEmpty(preferredplugin)) { return(false); } if (FanArt == null) { FanArt = new List <string>(); } else { FanArt.Clear(); } try { if (titleNameSearch != null) { // Import metadata based on field mappings and configured default plugin Dictionary <string, List <string> > mappings = OMLEngine.Settings.SettingsManager.MetaDataMap_PropertiesByPlugin(); // Loop through configured mappings Type tTitle = typeof(Title); MetaDataPluginDescriptor metadata; bool loadedfanart = false; foreach (KeyValuePair <string, List <string> > map in mappings) { try { if (map.Key == preferredplugin) { continue; } metadata = _metadataPlugins.First(p => p.DataProviderName == map.Key); MetadataSearch(metadata, titletype, titleNameSearch, EpisodeName, SeasonNo, EpisodeNo, out title); if (title != null) { foreach (string property in map.Value) { switch (property) { case "FanArt": if ((metadata.DataProviderCapabilities & MetadataPluginCapabilities.SupportsBackDrops) != 0) { loadedfanart = true; FanArt.AddRange(metadata.PluginDLL.GetBackDropUrlsForTitle().ToList()); } break; case "Genres": foreach (string genre in title.Genres.ToArray <string>()) { title.AddGenre(genre); } break; default: Utilities.DebugLine("[OMLDatabaseEditor] Using value for " + property + " from plugin " + map.Key); System.Reflection.PropertyInfo prop = tTitle.GetProperty(property); prop.SetValue(title, prop.GetValue(title, null), null); break; } } } } catch (Exception ex) { Utilities.DebugLine("[OMLSDK] Processing date from {0} Caused an Exception {1}", map.Key, ex); } } // Use default plugin for remaining fields metadata = _metadataPlugins.First(p => p.DataProviderName == preferredplugin); MetadataSearch(metadata, titletype, titleNameSearch, EpisodeName, SeasonNo, EpisodeNo, out title); title.MetadataSourceName = metadata.DataProviderName; if (title != null) { if (!loadedfanart) { if ((metadata.DataProviderCapabilities & MetadataPluginCapabilities.SupportsBackDrops) != 0) { List <string> images = metadata.PluginDLL.GetBackDropUrlsForTitle(); if (images != null) { FanArt.AddRange(metadata.PluginDLL.GetBackDropUrlsForTitle().ToList()); } } } } ApplyGenreMappings(title, true); return(true); } return(false); } catch (Exception ex) { Utilities.DebugLine("[OMLSDK] Exception {0}", ex); return(false); } }
private void ApplyGenreMappings(Title title, bool removeUnknownGenres) { List <String> genreList = new List <String>(); int genreCount = TitleCollectionManager.GetAllGenreMetaDatas().Count(); if (genreCount > 0) { genreList.AddRange(from gm in TitleCollectionManager.GetAllGenreMetaDatas() select gm.Name); Dictionary <string, string> genreIssuesList = new Dictionary <string, string>(); Dictionary <string, string> genreChanges = new Dictionary <string, string>(); foreach (string genre in title.Genres) { string newGenre = genre.Trim(); if (!genreList.Contains(newGenre)) { // Genre doesn't exists if (OMLEngine.Settings.SettingsManager.GenreMap_GetMapping(newGenre) != null) { // Mapping already exists for genre genreChanges[genre] = OMLEngine.Settings.SettingsManager.GenreMap_GetMapping(newGenre); } else { // Mapping doesn't exists for genre, try trimming off 'film' from the end just incase if (newGenre.EndsWith("Film", true, CultureInfo.InvariantCulture)) { newGenre = newGenre.Replace(" Film", ""); } if (genreList.Contains(newGenre)) { genreIssuesList[genre] = newGenre; } else { string match = genreList.FirstOrDefault(s => s.Split(' ').Intersect(newGenre.Split(' ')).Count() != 0); genreIssuesList[genre] = match; } } } } foreach (string genre in genreChanges.Keys) { title.RemoveGenre(genre); // Mapping contains empty string when user wants a specific genre ignored. if (!String.IsNullOrEmpty(genreChanges[genre]) && !title.Genres.Contains(genreChanges[genre])) { title.AddGenre(genreChanges[genre]); } } if (genreIssuesList.Keys.Count > 0) { if (!removeUnknownGenres) { foreach (string genre in genreIssuesList.Keys) { if (title.Genres.Contains(genre)) { title.RemoveGenre(genre); } } } } } }
public void TEST_BASE_CASE() { Title t = new Title(); t.AspectRatio = "Widescreen"; t.BackCoverPath = "back.jpg"; t.CountryOfOrigin = "US"; t.DateAdded = new DateTime(2008, 01, 01); t.Studio = "Paramount"; Disk disk = new Disk(); disk.Name = "Disk 1"; disk.Path = "myfile.wpl"; disk.Format = VideoFormat.WPL; t.Disks.Add(disk); t.FrontCoverPath = "front.jpg"; t.WatchedCount = 1; t.ImporterSource = "MyMovies"; t.MetadataSourceID = "123"; t.MetadataSourceName = "MyMovies"; t.ParentalRating = "R"; t.Name = "My Movie"; t.OfficialWebsiteURL = "http://www.mymovie.com"; t.OriginalName = "My Movie"; t.ReleaseDate = new DateTime(2008, 1, 1); t.Runtime = 110; t.Synopsis = "This is my long synopsis of my movie"; t.UPC = "123ABC"; t.UserStarRating = 5; t.VideoStandard = "NTSC"; t.AddActingRole("Translucent", "Actor"); t.AddActingRole("taranu", "Actor"); t.AddNonActingRole("KingManon", "crew"); t.AddNonActingRole("Chris", "crew"); t.AddDirector(new Person("Tim")); t.AddGenre("Comedy"); t.AddAudioTrack("English"); t.AddAudioTrack("French"); t.AddProducer(new Person("Sony")); t.AddWriter(new Person("Timothy")); Assert.AreEqual("Widescreen", t.AspectRatio); Assert.AreEqual("back.jpg", t.BackCoverPath); Assert.AreEqual("US", t.CountryOfOrigin); Assert.IsTrue(new DateTime(2008, 01, 01).CompareTo(t.DateAdded) == 0); Assert.AreEqual("Paramount", t.Studio); Assert.AreEqual("myfile.wpl", t.Disks[0].Path); Assert.AreEqual("Disk 1", t.Disks[0].Name); Assert.AreEqual("front.jpg", t.FrontCoverPath); Assert.AreEqual(1, t.WatchedCount); Assert.AreEqual("MyMovies", t.ImporterSource); Assert.AreEqual("123", t.MetadataSourceID); Assert.AreEqual("MyMovies", t.MetadataSourceName); Assert.AreEqual("R", t.ParentalRating); Assert.AreEqual("My Movie", t.Name); Assert.AreEqual("http://www.mymovie.com", t.OfficialWebsiteURL); Assert.AreEqual("My Movie", t.OriginalName); Assert.IsTrue(new DateTime(2008, 01, 01).CompareTo(t.ReleaseDate) == 0); Assert.AreEqual("123ABC", t.UPC); Assert.AreEqual(5, t.UserStarRating); Assert.AreEqual(VideoFormat.WPL, t.Disks[0].Format); Assert.AreEqual("NTSC", t.VideoStandard); Assert.AreEqual(2, t.ActingRoles.Count); IEnumerable <string> actors = t.ActingRoles.Select(a => a.PersonName); Assert.That(actors.Contains("Translucent")); Assert.That(actors.Contains("taranu")); //Assert.AreEqual("KingManon", ((Person)t.Crew[0]).full_name); //Assert.AreEqual("Chris", ((Person)t.Crew[1]).full_name); Assert.AreEqual(1, t.Directors.Count); Assert.AreEqual("Tim", ((Person)t.Directors[0]).full_name); Assert.AreEqual(1, t.Genres.Count); Assert.AreEqual("Comedy", t.Genres[0]); Assert.AreEqual(2, t.AudioTracks.Count); Assert.AreEqual("English", t.AudioTracks[0]); Assert.AreEqual("French", t.AudioTracks[1]); Assert.AreEqual(1, t.Producers.Count); Assert.AreEqual("Sony", t.Producers[0]); Assert.AreEqual(1, t.Writers.Count); Assert.AreEqual("Timothy", ((Person)t.Writers[0]).full_name); }
/// <summary> /// Looksup the preferred metadata on the passed in search criteria /// </summary> /// <param name="titletype"></param> /// <param name="coverArtOnly"></param> /// <param name="titleNameSearch"></param> /// <param name="EpisodeName"></param> /// <param name="SeasonNo"></param> /// <param name="EpisodeNo"></param> /// <param name="title"></param> /// <returns></returns> public bool MetadataSearchUsingPreferred(TitleTypes titletype, /*bool coverArtOnly,*/ string titleNameSearch, string EpisodeName, int? SeasonNo, int? EpisodeNo, out Title title) { title = null; string preferredplugin = OMLEngine.Settings.OMLSettings.DefaultMetadataPluginMovies; if ((((titletype & TitleTypes.TVShow) != 0) || ((titletype & TitleTypes.Season) != 0) || ((titletype & TitleTypes.Episode) != 0)) && (!string.IsNullOrEmpty(OMLEngine.Settings.OMLSettings.DefaultMetadataPluginTV))) { // If we are looking for an episode and there is a preferred setting for this, use it preferredplugin = OMLEngine.Settings.OMLSettings.DefaultMetadataPluginTV; } if (string.IsNullOrEmpty(preferredplugin)) return false; if (FanArt == null) { FanArt = new List<string>(); } else { FanArt.Clear(); } try { if (titleNameSearch != null) { // Import metadata based on field mappings and configured default plugin Dictionary<string, List<string>> mappings = OMLEngine.Settings.SettingsManager.MetaDataMap_PropertiesByPlugin(); // Loop through configured mappings Type tTitle = typeof(Title); MetaDataPluginDescriptor metadata; bool loadedfanart = false; foreach (KeyValuePair<string, List<string>> map in mappings) { try { if (map.Key == preferredplugin) continue; metadata = _metadataPlugins.First(p => p.DataProviderName == map.Key); MetadataSearch(metadata, titletype, titleNameSearch, EpisodeName, SeasonNo, EpisodeNo, out title); if (title != null) { foreach (string property in map.Value) { switch (property) { case "FanArt": if ((metadata.DataProviderCapabilities & MetadataPluginCapabilities.SupportsBackDrops) != 0) { loadedfanart = true; FanArt.AddRange(metadata.PluginDLL.GetBackDropUrlsForTitle().ToList()); } break; case "Genres": foreach (string genre in title.Genres.ToArray<string>()) title.AddGenre(genre); break; default: Utilities.DebugLine("[OMLDatabaseEditor] Using value for " + property + " from plugin " + map.Key); System.Reflection.PropertyInfo prop = tTitle.GetProperty(property); prop.SetValue(title, prop.GetValue(title, null), null); break; } } } } catch (Exception ex) { Utilities.DebugLine("[OMLSDK] Processing date from {0} Caused an Exception {1}", map.Key, ex); } } // Use default plugin for remaining fields metadata = _metadataPlugins.First(p => p.DataProviderName == preferredplugin); MetadataSearch(metadata, titletype, titleNameSearch, EpisodeName, SeasonNo, EpisodeNo, out title); title.MetadataSourceName = metadata.DataProviderName; if (title != null) { if (!loadedfanart) { if ((metadata.DataProviderCapabilities & MetadataPluginCapabilities.SupportsBackDrops) != 0) { List<string> images = metadata.PluginDLL.GetBackDropUrlsForTitle(); if (images != null) { FanArt.AddRange(metadata.PluginDLL.GetBackDropUrlsForTitle().ToList()); } } } } ApplyGenreMappings(title, true); return true; } return false; } catch (Exception ex) { Utilities.DebugLine("[OMLSDK] Exception {0}", ex); return false; } }
private void ApplyGenreMappings(Title title, bool removeUnknownGenres) { List<String> genreList = new List<String>(); int genreCount = TitleCollectionManager.GetAllGenreMetaDatas().Count(); if (genreCount > 0) { genreList.AddRange(from gm in TitleCollectionManager.GetAllGenreMetaDatas() select gm.Name); Dictionary<string, string> genreIssuesList = new Dictionary<string, string>(); Dictionary<string, string> genreChanges = new Dictionary<string, string>(); foreach (string genre in title.Genres) { string newGenre = genre.Trim(); if (!genreList.Contains(newGenre)) { // Genre doesn't exists if (OMLEngine.Settings.SettingsManager.GenreMap_GetMapping(newGenre) != null) { // Mapping already exists for genre genreChanges[genre] = OMLEngine.Settings.SettingsManager.GenreMap_GetMapping(newGenre); } else { // Mapping doesn't exists for genre, try trimming off 'film' from the end just incase if (newGenre.EndsWith("Film", true, CultureInfo.InvariantCulture)) newGenre = newGenre.Replace(" Film", ""); if (genreList.Contains(newGenre)) genreIssuesList[genre] = newGenre; else { string match = genreList.FirstOrDefault(s => s.Split(' ').Intersect(newGenre.Split(' ')).Count() != 0); genreIssuesList[genre] = match; } } } } foreach (string genre in genreChanges.Keys) { title.RemoveGenre(genre); // Mapping contains empty string when user wants a specific genre ignored. if (!String.IsNullOrEmpty(genreChanges[genre]) && !title.Genres.Contains(genreChanges[genre])) title.AddGenre(genreChanges[genre]); } if (genreIssuesList.Keys.Count > 0) { if (!removeUnknownGenres) { foreach (string genre in genreIssuesList.Keys) { if (title.Genres.Contains(genre)) title.RemoveGenre(genre); } } } } }
public void TEST_BASE_CASE() { Title t = new Title(); t.AspectRatio = "Widescreen"; t.BackCoverPath = "back.jpg"; t.CountryOfOrigin = "US"; t.DateAdded = new DateTime(2008, 01, 01); t.Studio = "Paramount"; Disk disk = new Disk(); disk.Name = "Disk 1"; disk.Path = "myfile.wpl"; disk.Format = VideoFormat.WPL; t.Disks.Add(disk); t.FrontCoverPath = "front.jpg"; t.WatchedCount = 1; t.ImporterSource = "MyMovies"; t.MetadataSourceID = "123"; t.MetadataSourceName = "MyMovies"; t.ParentalRating = "R"; t.Name = "My Movie"; t.OfficialWebsiteURL = "http://www.mymovie.com"; t.OriginalName = "My Movie"; t.ReleaseDate = new DateTime(2008, 1, 1); t.Runtime = 110; t.Synopsis = "This is my long synopsis of my movie"; t.UPC = "123ABC"; t.UserStarRating = 5; t.VideoStandard = "NTSC"; t.AddActingRole("Translucent", "Actor"); t.AddActingRole("taranu", "Actor"); t.AddNonActingRole("KingManon", "crew"); t.AddNonActingRole("Chris", "crew"); t.AddDirector(new Person("Tim")); t.AddGenre("Comedy"); t.AddAudioTrack("English"); t.AddAudioTrack("French"); t.AddProducer(new Person("Sony")); t.AddWriter(new Person("Timothy")); Assert.AreEqual("Widescreen", t.AspectRatio); Assert.AreEqual("back.jpg", t.BackCoverPath); Assert.AreEqual("US", t.CountryOfOrigin); Assert.IsTrue(new DateTime(2008, 01, 01).CompareTo(t.DateAdded) == 0); Assert.AreEqual("Paramount", t.Studio); Assert.AreEqual("myfile.wpl", t.Disks[0].Path); Assert.AreEqual("Disk 1", t.Disks[0].Name); Assert.AreEqual("front.jpg", t.FrontCoverPath); Assert.AreEqual(1, t.WatchedCount); Assert.AreEqual("MyMovies", t.ImporterSource); Assert.AreEqual("123", t.MetadataSourceID); Assert.AreEqual("MyMovies", t.MetadataSourceName); Assert.AreEqual("R", t.ParentalRating); Assert.AreEqual("My Movie", t.Name); Assert.AreEqual("http://www.mymovie.com", t.OfficialWebsiteURL); Assert.AreEqual("My Movie", t.OriginalName); Assert.IsTrue(new DateTime(2008, 01, 01).CompareTo(t.ReleaseDate) == 0); Assert.AreEqual("123ABC", t.UPC); Assert.AreEqual(5, t.UserStarRating); Assert.AreEqual(VideoFormat.WPL, t.Disks[0].Format); Assert.AreEqual("NTSC", t.VideoStandard); Assert.AreEqual(2, t.ActingRoles.Count); IEnumerable<string> actors = t.ActingRoles.Select(a => a.PersonName); Assert.That(actors.Contains("Translucent")); Assert.That(actors.Contains("taranu")); //Assert.AreEqual("KingManon", ((Person)t.Crew[0]).full_name); //Assert.AreEqual("Chris", ((Person)t.Crew[1]).full_name); Assert.AreEqual(1, t.Directors.Count); Assert.AreEqual("Tim", ((Person)t.Directors[0]).full_name); Assert.AreEqual(1, t.Genres.Count); Assert.AreEqual("Comedy", t.Genres[0]); Assert.AreEqual(2, t.AudioTracks.Count); Assert.AreEqual("English", t.AudioTracks[0]); Assert.AreEqual("French", t.AudioTracks[1]); Assert.AreEqual(1, t.Producers.Count); Assert.AreEqual("Sony", t.Producers[0]); Assert.AreEqual(1, t.Writers.Count); Assert.AreEqual("Timothy", ((Person)t.Writers[0]).full_name); }
public static Title ConvertOMLSDKTitleToTitle(OMLSDKTitle omlsdktitle) { Title _title = new Title(); if (omlsdktitle != null) { _title.NameTrimmed = CopyString(omlsdktitle.Name); _title.OriginalNameTrimmed = CopyString(omlsdktitle.OriginalName); _title.SortNameTrimmed = CopyString(omlsdktitle.SortName); _title.Synopsis = CopyString(omlsdktitle.Synopsis); _title.ProductionYear = omlsdktitle.ProductionYear; _title.ReleaseDate = omlsdktitle.ReleaseDate; _title.DateAdded = omlsdktitle.DateAdded; _title.Runtime = omlsdktitle.Runtime; _title.StudioTrimmed = CopyString(omlsdktitle.Studio); _title.UPCTrimmed = CopyString(omlsdktitle.UPC); _title.WatchedCount = omlsdktitle.WatchedCount; _title.UserStarRating = omlsdktitle.UserStarRating; _title.EpisodeNumber = omlsdktitle.EpisodeNumber; _title.SeasonNumber = omlsdktitle.SeasonNumber; _title.AspectRatioTrimmed = CopyString(omlsdktitle.AspectRatio); _title.VideoDetails = CopyString(omlsdktitle.VideoDetails); _title.VideoResolutionTrimmed = CopyString(omlsdktitle.VideoResolution); _title.VideoStandardTrimmed = CopyString(omlsdktitle.VideoStandard); //_title.VideoFormat = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdktitle.VideoFormat.ToString()); _title.FrontCoverPath = CopyString(omlsdktitle.FrontCoverPath); _title.BackCoverPath = CopyString(omlsdktitle.BackCoverPath); _title.CountryOfOriginTrimmed = CopyString(omlsdktitle.CountryOfOrigin); _title.MetadataSourceIDTrimmed = CopyString(omlsdktitle.MetadataSourceID); _title.MetadataSourceNameTrimmed = CopyString(omlsdktitle.MetadataSourceName); _title.ImporterSourceTrimmed = CopyString(omlsdktitle.ImporterSource); _title.OfficialWebsiteURLTrimmed = CopyString(omlsdktitle.OfficialWebsiteURL); _title.ParentalRatingTrimmed = CopyString(omlsdktitle.ParentalRating); _title.ParentalRatingReasonTrimmed = CopyString(omlsdktitle.ParentalRatingReason); #region Disks foreach (OMLSDKDisk omlsdkdisk in omlsdktitle.Disks) { Disk disk = new Disk(); disk.Name = omlsdkdisk.Name; disk.Path = omlsdkdisk.Path; disk.Format = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdkdisk.Format.ToString()); disk.ExtraOptions = omlsdkdisk.ExtraOptions; _title.AddDisk(disk); } #endregion #region Extra Features _title.ExtraFeatures = omlsdktitle.ExtraFeatures; #endregion #region Trailers foreach (string Trailer in omlsdktitle.Trailers) { _title.AddTrailer(Trailer); } #endregion #region Genres if (omlsdktitle.Genres != null) { foreach (string genre in omlsdktitle.Genres) { _title.AddGenre(genre); } } #endregion #region Actring Roles if (omlsdktitle.ActingRoles != null) { foreach (OMLSDKRole role in omlsdktitle.ActingRoles) { _title.AddActingRole(role.PersonName, role.RoleName); } } #endregion #region Non Acting Roles if (omlsdktitle.NonActingRoles != null) { foreach (OMLSDKRole role in omlsdktitle.NonActingRoles) { _title.AddNonActingRole(role.PersonName, role.RoleName); } } #endregion #region Directors if (omlsdktitle.Directors != null) { foreach (OMLSDKPerson person in omlsdktitle.Directors) { _title.AddDirector(ConvertOMLSDKPersonToPerson(person)); } } #endregion #region Writers if (omlsdktitle.Writers != null) { foreach (OMLSDKPerson person in omlsdktitle.Writers) { _title.AddWriter(ConvertOMLSDKPersonToPerson(person)); } } #endregion #region Producers if (omlsdktitle.Producers != null) { foreach (OMLSDKPerson person in omlsdktitle.Producers) { _title.AddProducer(ConvertOMLSDKPersonToPerson(person)); } } #endregion #region Tags if (omlsdktitle.Tags != null) { foreach (string tag in omlsdktitle.Tags) { _title.AddTag(tag); } } #endregion #region Audio Tracks if (omlsdktitle.AudioTracks != null) { foreach (string track in omlsdktitle.AudioTracks) { _title.AddAudioTrack(track); } } #endregion #region Subtitles if (omlsdktitle.Subtitles != null) { foreach (string subtitles in omlsdktitle.Subtitles) { _title.AddSubtitle(subtitles); } } #endregion #region Fanart Paths if (omlsdktitle.FanArtPaths != null) { foreach (string path in omlsdktitle.FanArtPaths) { _title.AddFanArtImage(path); } } #endregion } return(_title); }