Beispiel #1
0
        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;
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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);
        }