private void LoadData() { relations.Clear(); mainAnime = null; serMain = null; serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (serMain != null) { mainAnime = serMain.AniDB_Anime; } if (mainAnime == null) { return; } try { relations = mainAnime.RelatedAnimeLinks; } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
private void ShowPosters() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); List <PosterContainer> allPosters = new List <PosterContainer>(); string displayname = ""; AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { displayname = ser.SeriesName; if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } BaseConfig.MyAnimeLog.Write("ShowPosters for {0} - {1}", displayname, AnimeID); foreach (PosterContainer pstr in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllPosters) { if (!File.Exists(pstr.FullImagePath)) { continue; } allPosters.Add(pstr); } GUIListItem item = null; foreach (PosterContainer poster in allPosters) { item = new GUIListItem(); item.IconImage = item.IconImageBig = poster.FullImagePath; item.TVTag = poster; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; // Work around for Filmstrip not allowing to programmatically select item if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip) { } PosterContainer selectedPoster = m_Facade.SelectedListItem.TVTag as PosterContainer; if (selectedPoster != null) { SetPosterProperties(selectedPoster); } GUIControl.FocusControl(GetID, 50); } }
private void ShowFanart() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); List <FanartContainer> allFanart = new List <FanartContainer>(); AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } if (ser == null) { return; } BaseConfig.MyAnimeLog.Write("ShowFanart for {0}", AnimeID); GUIListItem item = null; foreach (FanartContainer fanart in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllFanarts) { if (!File.Exists(fanart.FullImagePath)) { continue; } item = new GUIListItem(); item.IconImage = item.IconImageBig = fanart.FullThumbnailPath; item.TVTag = fanart; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; // Work around for Filmstrip not allowing to programmatically select item if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip) { } FanartContainer selectedFanart = m_Facade.SelectedListItem.TVTag as FanartContainer; if (selectedFanart != null) { setFanartPreviewBackground(selectedFanart); } GUIControl.FocusControl(GetID, 50); } }
private void LoadInfo() { if (MainWindow.GlobalSeriesID > 0) { serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (serMain != null) { MainAnime = serMain.AniDB_Anime; } } }
private void ShowWideBanners() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } if (ser != null) { List <TvDB_ImageWideBannerVM> tvDBWideBanners = ser.AniDB_Anime.AniDB_AnimeCrossRefs.TvDBImageWideBanners; GUIListItem item = null; foreach (TvDB_ImageWideBannerVM banner in tvDBWideBanners) { item = new GUIListItem(); item.IconImage = item.IconImageBig = banner.FullImagePath; item.TVTag = banner; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; TvDB_ImageWideBannerVM selectedBanner = m_Facade.SelectedListItem.TVTag as TvDB_ImageWideBannerVM; if (selectedBanner != null) { SetWideBannerProperties(selectedBanner); } GUIControl.FocusControl(GetID, 50); } } }
private void ShowEpisodeDetails(AnimeEpisodeVM ep) { dummyEpisodeSearch.Visible = false; AnimeSeriesVM series = JMMServerHelper.GetSeries(ep.AnimeSeriesID); if (series != null && series.AniDB_Anime != null) { SetGUIProperty(GuiProperty.SubGroup_AnimeName, series.AniDB_Anime.FormattedTitle); SetGUIProperty(GuiProperty.SubGroup_EpisodeName, ep.EpisodeNumberAndName); List<GroupVideoQualityVM> videoQualityRecords = new List<GroupVideoQualityVM>(); List<JMMServerBinary.Contract_GroupVideoQuality> summ = new List<Contract_GroupVideoQuality>(JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(series.AniDB_Anime.AnimeID)); foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ) { GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract); videoQualityRecords.Add(vidQual); } // apply sorting if (videoQualityRecords.Count > 0) { List<SortPropOrFieldAndDirection> sortlist = new List<SortPropOrFieldAndDirection>(); sortlist.Add(new SortPropOrFieldAndDirection("FileCountNormal", true, SortType.eInteger)); videoQualityRecords = Sorting.MultiSort<GroupVideoQualityVM>(videoQualityRecords, sortlist); string fileDetails = ""; foreach (GroupVideoQualityVM gvq in videoQualityRecords) fileDetails += string.Format("{0}({1}/{2}/{3}bit) - {4} Files ({5})", gvq.GroupNameShort, gvq.Resolution, gvq.VideoSource, gvq.VideoBitDepth, gvq.FileCountNormal, gvq.NormalEpisodeNumberSummary) + Environment.NewLine; SetGUIProperty(GuiProperty.SubGroup_FileDetails, fileDetails); } else { ClearGUIProperty(GuiProperty.SubGroup_FileDetails); } dummyEpisodeSearch.Visible = true; } }
private void ShowCharacters() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); if (dummyMainCharExists != null) { dummyMainCharExists.Visible = false; } if (dummyMainActorExists != null) { dummyMainActorExists.Visible = false; } if (dummySeriesExists != null) { dummySeriesExists.Visible = false; } clearGUIProperty("Title"); clearGUIProperty("Character.Name"); clearGUIProperty("Character.KanjiName"); clearGUIProperty("Actor.Name"); clearGUIProperty("Actor.KanjiName"); clearGUIProperty("Character.CharacterCount"); BaseConfig.MyAnimeLog.Write("CharWindow.GlobalSeriesID = {0}", MainWindow.GlobalSeriesID.ToString()); charList.Clear(); mainAnime = null; serMain = null; serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (serMain != null) { mainAnime = serMain.AniDB_Anime; } else { return; } if (mainAnime == null) { return; } setGUIProperty("Character.Main.Title", mainAnime.FormattedTitle); charList = mainAnime.Characters; if (dummyCharactersExist != null) { if (charList.Count > 0) { dummyCharactersExist.Visible = true; } else { dummyCharactersExist.Visible = false; } } setGUIProperty("Character.CharacterCount", charList.Count.ToString()); setGUIProperty("Title", serMain.SeriesName); string imagePathNoPicture = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png"; foreach (AniDB_CharacterVM aniChar in charList) { string imagePath = imagePathNoPicture; if (!string.IsNullOrEmpty(aniChar.PosterPath) && File.Exists(aniChar.PosterPath)) { imagePath = aniChar.PosterPath; } GUIListItem item = new GUIListItem(""); item.IconImage = item.IconImageBig = imagePath; item.TVTag = aniChar; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; AniDB_CharacterVM aniChar = m_Facade.SelectedListItem.TVTag as AniDB_CharacterVM; if (aniChar != null) { SetCharacterProperties(aniChar); } } }
public List <string> GetParms() { List <string> parms = new List <string>(); if (searchType == DownloadSearchType.Episode) { AnimeEpisodeVM ep = searchParameter as AnimeEpisodeVM; AnimeSeriesVM series = JMMServerHelper.GetSeries(ep.AnimeSeriesID); if (series == null) { return(parms); } AniDB_AnimeVM anime = series.AniDB_Anime; if (anime == null) { return(parms); } // only use the first 2 words of the anime's title string[] titles = anime.MainTitle.Split(' '); int i = 0; foreach (string s in titles) { i++; parms.Add(s.Trim()); if (i == 2) { break; } } parms.Add(ep.EpisodeNumber.ToString().PadLeft(2, '0')); } if (searchType == DownloadSearchType.Series) { AniDB_AnimeVM anime = searchParameter as AniDB_AnimeVM; // only use the first 2 words of the anime's title string[] titles = anime.MainTitle.Split(' '); int i = 0; foreach (string s in titles) { i++; parms.Add(s.Trim()); if (i == 2) { break; } } } if (searchType == DownloadSearchType.Manual) { string[] titles = searchParameter.ToString().Split(' '); foreach (string s in titles) { parms.Add(s.Trim()); } } return(parms); }
public static List <TorrentLink> SearchTorrents(DownloadSearchCriteria search) { List <string> parms = search.GetParms(); List <TorrentLink> links = new List <TorrentLink>(); TorrentsAnimeSuki suki = new TorrentsAnimeSuki(); TorrentsBakaUpdates bakau = new TorrentsBakaUpdates(); List <string> episodeGroupParms = new List <string>(); // lets do something special for episodes if (BaseConfig.Settings.TorrentPreferOwnGroups && search.SearchType == DownloadSearchType.Episode) { AnimeEpisodeVM ep = search.SearchParameter as AnimeEpisodeVM; AnimeSeriesVM series = JMMServerHelper.GetSeries(ep.AnimeSeriesID); if (series != null && series.AniDB_Anime != null) { List <GroupVideoQualityVM> videoQualityRecords = new List <GroupVideoQualityVM>(); List <JMMServerBinary.Contract_GroupVideoQuality> summ = JMMServerVM.Instance.clientBinaryHTTP.GetGroupVideoQualitySummary(series.AniDB_Anime.AnimeID); foreach (JMMServerBinary.Contract_GroupVideoQuality contract in summ) { GroupVideoQualityVM vidQual = new GroupVideoQualityVM(contract); videoQualityRecords.Add(vidQual); } // apply sorting if (videoQualityRecords.Count > 0) { List <SortPropOrFieldAndDirection> sortlist = new List <SortPropOrFieldAndDirection>(); sortlist.Add(new SortPropOrFieldAndDirection("FileCountNormal", true, SortType.eInteger)); videoQualityRecords = Sorting.MultiSort <GroupVideoQualityVM>(videoQualityRecords, sortlist); } //only use the first 2 int i = 0; foreach (GroupVideoQualityVM gvq in videoQualityRecords) { if (i == 2) { break; } if (!episodeGroupParms.Contains(gvq.GroupNameShort)) { episodeGroupParms.Add(gvq.GroupNameShort); i++; } } } } // if searching by series and BakaBT is enabled, use that first bool doneBakaBT = false; if (BaseConfig.Settings.TorrentSources.Contains(MyAnimePlugin3.Constants.TorrentSourceNames.BakaBT) && search.SearchType == DownloadSearchType.Series) { doneBakaBT = true; TorrentsBakaBT bakbt = new TorrentsBakaBT(); List <TorrentLink> bakbtLinks = bakbt.GetTorrents(parms); links.AddRange(bakbtLinks); } bool doneAnimeBytes = false; if (BaseConfig.Settings.TorrentSources.Contains(MyAnimePlugin3.Constants.TorrentSourceNames.AnimeBytes) && search.SearchType == DownloadSearchType.Series) { doneAnimeBytes = true; TorrentsAnimeBytes abytes = new TorrentsAnimeBytes(); List <TorrentLink> abytesLinks = abytes.GetTorrents(parms); links.AddRange(abytesLinks); } foreach (string src in BaseConfig.Settings.TorrentSources) { if (src == MyAnimePlugin3.Constants.TorrentSourceNames.BakaBT && !doneBakaBT) { TorrentsBakaBT bakbt = new TorrentsBakaBT(); List <TorrentLink> bakbtLinks = bakbt.GetTorrents(parms); links.AddRange(bakbtLinks); } if (src == MyAnimePlugin3.Constants.TorrentSourceNames.BakaBT && !doneAnimeBytes) { TorrentsAnimeBytes abytes = new TorrentsAnimeBytes(); List <TorrentLink> abytesLinks = abytes.GetTorrents(parms); links.AddRange(abytesLinks); } if (src == MyAnimePlugin3.Constants.TorrentSourceNames.Nyaa) { TorrentsNyaa nyaa = new TorrentsNyaa(); List <TorrentLink> ttLinks = null; Dictionary <string, TorrentLink> dictLinks = new Dictionary <string, TorrentLink>(); foreach (string grp in episodeGroupParms) { List <string> tempParms = new List <string>(); foreach (string parmTemp in parms) { tempParms.Add(parmTemp); } tempParms.Insert(0, grp); ttLinks = nyaa.GetTorrents(tempParms); BaseConfig.MyAnimeLog.Write("Searching for: " + search.ToString() + "(" + grp + ")"); // only use the first 20 int x = 0; foreach (TorrentLink link in ttLinks) { if (x == 20) { break; } dictLinks[link.TorrentDownloadLink] = link; BaseConfig.MyAnimeLog.Write("Adding link: " + link.ToString()); } } BaseConfig.MyAnimeLog.Write("Searching for: " + search.ToString()); ttLinks = nyaa.GetTorrents(parms); foreach (TorrentLink link in ttLinks) { dictLinks[link.TorrentDownloadLink] = link; BaseConfig.MyAnimeLog.Write("Adding link: " + link.ToString()); } links.AddRange(dictLinks.Values); } if (src == MyAnimePlugin3.Constants.TorrentSourceNames.AnimeSuki) { List <TorrentLink> sukiLinks = suki.GetTorrents(parms); links.AddRange(sukiLinks); } if (src == MyAnimePlugin3.Constants.TorrentSourceNames.TT) { TorrentsTokyoToshokan tt = new TorrentsTokyoToshokan(); List <TorrentLink> ttLinks = null; Dictionary <string, TorrentLink> dictLinks = new Dictionary <string, TorrentLink>(); foreach (string grp in episodeGroupParms) { List <string> tempParms = new List <string>(); foreach (string parmTemp in parms) { tempParms.Add(parmTemp); } tempParms.Insert(0, grp); ttLinks = tt.GetTorrents(tempParms); BaseConfig.MyAnimeLog.Write("Searching for: " + search.ToString() + "(" + grp + ")"); // only use the first 20 int x = 0; foreach (TorrentLink link in ttLinks) { if (x == 20) { break; } dictLinks[link.TorrentDownloadLink] = link; BaseConfig.MyAnimeLog.Write("Adding link: " + link.ToString()); } } BaseConfig.MyAnimeLog.Write("Searching for: " + search.ToString()); ttLinks = tt.GetTorrents(parms); foreach (TorrentLink link in ttLinks) { dictLinks[link.TorrentDownloadLink] = link; BaseConfig.MyAnimeLog.Write("Adding link: " + link.ToString()); } links.AddRange(dictLinks.Values); } if (src == MyAnimePlugin3.Constants.TorrentSourceNames.BakaUpdates) { List <TorrentLink> bakauLinks = bakau.GetTorrents(parms); links.AddRange(bakauLinks); } } return(links); }