public async Task <IActionResult> GetDescriptionAsync( [Required][FromQuery] string baseUrl, [Required][FromQuery] string torrentPath, [Required][FromQuery] TorrentSource source) { var dataSource = _helper.Sources()[source]; if (!dataSource.GetSources().Contains(baseUrl)) { return(BadRequest(new ResponseMessage("Base url is not part of known values for this source", baseUrl))); } dataSource.UpdateUsedSource(baseUrl); try { var response = await dataSource.GetTorrentDescriptionAsync(torrentPath); return(Ok(new DescriptionResponse(response))); } catch (Exception ex) { var fullUrl = Path.Combine(baseUrl, torrentPath); _logger.Information(ex, $"Error retrieving description for {source} {fullUrl}"); return(NotFound(new ResponseMessage("Description not found", fullUrl))); } }
public static string GetTorrentSourceDescription(TorrentSource source) { switch (source) { case TorrentSource.AnimeSuki: return MyAnimePlugin3.Constants.TorrentSourceNames.AnimeSuki; case TorrentSource.BakaBT: return MyAnimePlugin3.Constants.TorrentSourceNames.BakaBT; case TorrentSource.BakaUpdates: return MyAnimePlugin3.Constants.TorrentSourceNames.BakaUpdates; case TorrentSource.Nyaa: return MyAnimePlugin3.Constants.TorrentSourceNames.Nyaa; case TorrentSource.TokyoToshokan: return MyAnimePlugin3.Constants.TorrentSourceNames.TT; case TorrentSource.AnimeBytes: return MyAnimePlugin3.Constants.TorrentSourceNames.AnimeBytes; } return "Undefined"; }
private ContextMenuAction ShowBrowseSources(TorrentLink torLink) { ContextMenu cmenu = new ContextMenu(Translation.SelectSource); cmenu.Add("<<< " + Translation.Browse, () => ShowContextMenuBrowse(torLink)); foreach (TorrentSource src in Enum.GetValues(typeof(TorrentSource))) { TorrentSource local = src; cmenu.AddAction(DownloadHelper.GetTorrentSourceDescription(src), () => { curBrowseSource = local; PerformTorrentBrowseAsync(); }); } return cmenu.Show(); }
protected override void OnPageLoad() { base.OnPageLoad(); curBrowseSource = BaseConfig.Settings.DefaultTorrentSource; clearGUIProperty("Download.Status"); setGUIProperty("Torrent.Summary", "Starting..."); setGUIProperty("Search.ResultDescription", "0 Results"); setGUIProperty("Search.Summary", "-"); clearGUIProperty("TorrentLink.Name"); clearGUIProperty("TorrentLink.Size"); clearGUIProperty("TorrentLink.Seeders"); clearGUIProperty("TorrentLink.Leechers"); clearGUIProperty("TorrentLink.Source"); clearGUIProperty("TorrentLink.SourceLong"); // torrent details clearGUIProperty("Torrent.Name"); clearGUIProperty("Torrent.Size"); clearGUIProperty("Torrent.Done"); clearGUIProperty("Torrent.DownloadSpeed"); clearGUIProperty("Torrent.UploadSpeed"); clearGUIProperty("Torrent.Downloaded"); clearGUIProperty("Torrent.Uploaded"); clearGUIProperty("Torrent.Ratio"); clearGUIProperty("Torrent.Seeds"); clearGUIProperty("Torrent.SInSwarm"); clearGUIProperty("Torrent.Peers"); clearGUIProperty("Torrent.PInSwarm"); if (!MainWindow.uTorrent.Initialised) { MainWindow.uTorrent.Init(); } ShowPageTorrents(); // this means we are in search mode if (MainWindow.currentDownloadSearch != null) { ShowPageSearch(false); PerformTorrentSearchAsync(); btnSearchPage.Focus = true; } }
public static List<TorrentLink> BrowseTorrents(TorrentSource source) { List<TorrentLink> links = new List<TorrentLink>(); if (source == TorrentSource.Nyaa) { TorrentsNyaa nyaa = new TorrentsNyaa(); List<TorrentLink> ttLinks = nyaa.BrowseTorrents(); links.AddRange(ttLinks); } if (source == TorrentSource.TokyoToshokan) { TorrentsTokyoToshokan tt = new TorrentsTokyoToshokan(); List<TorrentLink> ttLinks = tt.BrowseTorrents(); links.AddRange(ttLinks); } if (source == TorrentSource.AnimeSuki) { TorrentsAnimeSuki suki = new TorrentsAnimeSuki(); List<TorrentLink> sukiLinks = suki.BrowseTorrents(); links.AddRange(sukiLinks); } if (source == TorrentSource.BakaUpdates) { TorrentsBakaUpdates bakau = new TorrentsBakaUpdates(); List<TorrentLink> bakauLinks = bakau.BrowseTorrents(); links.AddRange(bakauLinks); } if (source == TorrentSource.BakaBT) { TorrentsBakaBT bakbt = new TorrentsBakaBT(); List<TorrentLink> bakbtLinks = bakbt.BrowseTorrents(); links.AddRange(bakbtLinks); } if (source == TorrentSource.AnimeBytes) { TorrentsAnimeBytes abytes = new TorrentsAnimeBytes(); List<TorrentLink> abytesLinks = abytes.BrowseTorrents(); links.AddRange(abytesLinks); } return links; }
public static List <TorrentLink> BrowseTorrents(TorrentSource source) { List <TorrentLink> links = new List <TorrentLink>(); if (source == TorrentSource.Nyaa) { TorrentsNyaa nyaa = new TorrentsNyaa(); List <TorrentLink> ttLinks = nyaa.BrowseTorrents(); links.AddRange(ttLinks); } if (source == TorrentSource.TokyoToshokan) { TorrentsTokyoToshokan tt = new TorrentsTokyoToshokan(); List <TorrentLink> ttLinks = tt.BrowseTorrents(); links.AddRange(ttLinks); } if (source == TorrentSource.AnimeSuki) { TorrentsAnimeSuki suki = new TorrentsAnimeSuki(); List <TorrentLink> sukiLinks = suki.BrowseTorrents(); links.AddRange(sukiLinks); } if (source == TorrentSource.BakaUpdates) { TorrentsBakaUpdates bakau = new TorrentsBakaUpdates(); List <TorrentLink> bakauLinks = bakau.BrowseTorrents(); links.AddRange(bakauLinks); } if (source == TorrentSource.BakaBT) { TorrentsBakaBT bakbt = new TorrentsBakaBT(); List <TorrentLink> bakbtLinks = bakbt.BrowseTorrents(); links.AddRange(bakbtLinks); } if (source == TorrentSource.AnimeBytes) { TorrentsAnimeBytes abytes = new TorrentsAnimeBytes(); List <TorrentLink> abytesLinks = abytes.BrowseTorrents(); links.AddRange(abytesLinks); } return(links); }
private void AddTorrentSource(TorrentSource source, ITorrentDataSource dataSource, int startPage, string sourceName) { Model.AvailableSources.Add(new DisplaySource { Selected = true, SourceName = sourceName, Source = source, }); _torrentSourceDictionary.Add(source, new SourceInformation { DataSource = dataSource ?? throw new ArgumentNullException(nameof(dataSource)), CurrentPage = startPage, StartPage = startPage, LastPage = false });
public TorrentSource GetTorrents(Configuration config) { this._config = config; TorrentSource torrentData = new TorrentSource(); torrentData.TorrentItems = new List <TorrentItem>(); torrentData.Name = "HorribleSubs"; torrentData.DateRetrieved = DateTime.Now; foreach (string show in config.Shows) { var item = GetTorrentItemByShowName(show); torrentData.TorrentItems.Add(GetTorrentsByHorribleSubsOutput(item)); } return(torrentData); }
public static string GetTorrentSourceDescription(TorrentSource source) { switch (source) { case TorrentSource.AnimeSuki: return(MyAnimePlugin3.Constants.TorrentSourceNames.AnimeSuki); case TorrentSource.BakaBT: return(MyAnimePlugin3.Constants.TorrentSourceNames.BakaBT); case TorrentSource.BakaUpdates: return(MyAnimePlugin3.Constants.TorrentSourceNames.BakaUpdates); case TorrentSource.Nyaa: return(MyAnimePlugin3.Constants.TorrentSourceNames.Nyaa); case TorrentSource.TokyoToshokan: return(MyAnimePlugin3.Constants.TorrentSourceNames.TT); case TorrentSource.AnimeBytes: return(MyAnimePlugin3.Constants.TorrentSourceNames.AnimeBytes); } return("Undefined"); }
private void ShowBrowseSources(TorrentLink torLink) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading("Select Source"); dlg.Add("<<< Browse"); dlg.Add("Anime Suki"); dlg.Add("Baka Updates"); dlg.Add("Nyaa Torrents"); dlg.Add("Tokyo Toshokan"); dlg.Add("Baka BT"); dlg.Add("Anime Byt.es"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedLabel) { case 0: ShowContextMenuBrowse(torLink); return; case 1: curBrowseSource = TorrentSource.AnimeSuki; break; case 2: curBrowseSource = TorrentSource.BakaUpdates; break; case 3: curBrowseSource = TorrentSource.Nyaa; break; case 4: curBrowseSource = TorrentSource.TokyoToshokan; break; case 5: curBrowseSource = TorrentSource.BakaBT; break; case 6: curBrowseSource = TorrentSource.AnimeBytes; break; } PerformTorrentBrowseAsync(); }
private void AddTorrentSource(TorrentSource source, ITorrentDataSource dataSource, int startPage, string siteName) { var availableSite = new DisplaySource { Selected = true, SourceName = siteName, Source = source }; foreach (var sourceName in dataSource.GetSources()) { availableSite.SourceStates.Add(new SourceStateUI(sourceName, isAlive: false, selected: false)); } Model.Settings.AvailableSources.Add(availableSite); _torrentSourceDictionary.Add(source, new SourceInformation { DataSource = dataSource ?? throw new ArgumentNullException(nameof(dataSource)), CurrentPage = startPage, StartPage = startPage, LastPage = false });
public string SourceName(TorrentSource torrentSource) => torrentSource switch {
private string FormedTorrentLink(TorrentSource source, string torrentUri) { return(_torrentSourceDictionary[source].DataSource.FullTorrentUrl(torrentUri)); }
private void ShowBrowseSources(TorrentLink torLink) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) return; dlg.Reset(); dlg.SetHeading("Select Source"); dlg.Add("<<< Browse"); dlg.Add("Anime Suki"); dlg.Add("Baka Updates"); dlg.Add("Nyaa Torrents"); dlg.Add("Tokyo Toshokan"); dlg.Add("Baka BT"); dlg.Add("Anime Byt.es"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedLabel) { case 0: ShowContextMenuBrowse(torLink); return; case 1: curBrowseSource = TorrentSource.AnimeSuki; break; case 2: curBrowseSource = TorrentSource.BakaUpdates; break; case 3: curBrowseSource = TorrentSource.Nyaa; break; case 4: curBrowseSource = TorrentSource.TokyoToshokan; break; case 5: curBrowseSource = TorrentSource.BakaBT; break; case 6: curBrowseSource = TorrentSource.AnimeBytes; break; } PerformTorrentBrowseAsync(); }
protected override void OnPageLoad() { base.OnPageLoad(); curBrowseSource = BaseConfig.Settings.DefaultTorrentSource; clearGUIProperty("Download.Status"); setGUIProperty("Torrent.Summary", "Starting..."); setGUIProperty("Search.ResultDescription", "0 Results"); setGUIProperty("Search.Summary", "-"); clearGUIProperty("TorrentLink.Name"); clearGUIProperty("TorrentLink.Size"); clearGUIProperty("TorrentLink.Seeders"); clearGUIProperty("TorrentLink.Leechers"); clearGUIProperty("TorrentLink.Source"); clearGUIProperty("TorrentLink.SourceLong"); // torrent details clearGUIProperty("Torrent.Name"); clearGUIProperty("Torrent.Size"); clearGUIProperty("Torrent.Done"); clearGUIProperty("Torrent.DownloadSpeed"); clearGUIProperty("Torrent.UploadSpeed"); clearGUIProperty("Torrent.Downloaded"); clearGUIProperty("Torrent.Uploaded"); clearGUIProperty("Torrent.Ratio"); clearGUIProperty("Torrent.Seeds"); clearGUIProperty("Torrent.SInSwarm"); clearGUIProperty("Torrent.Peers"); clearGUIProperty("Torrent.PInSwarm"); if (!MainWindow.uTorrent.Initialised) MainWindow.uTorrent.Init(); ShowPageTorrents(); // this means we are in search mode if (MainWindow.currentDownloadSearch != null) { ShowPageSearch(false); PerformTorrentSearchAsync(); btnSearchPage.Focus = true; } }