Beispiel #1
0
        //public override bool HasAnimeMovie => false;

        public override object StoreData(bool isMovie, TempThread tempThred)
        {
            try {
                var list = TheMovieHelper.SearchQuary(activeMovie.title.name, core);
                if (!GetThredActive(tempThred))
                {
                    return(null);
                }
                ;                                                 // COPY UPDATE PROGRESS
                MovieType mType   = activeMovie.title.movieType;
                string    compare = ToDown(activeMovie.title.name, true, "");
                var       watchMovieSeasonsData = new Dictionary <int, string>();

                if (mType.IsMovie())
                {
                    //string mustContain = mType == MovieType.AnimeMovie ? "/anime-info/" : "/series/";
                    string mustContain = isMovie ? "/movie/" : "/series/";
                    TheMovieHelper.TheMovieTitle[] matching = list.Where(t => ToDown(t.name, true, "") == compare && t.season == -1 && t.href.Contains(mustContain)).ToArray();
                    if (matching.Length > 0)
                    {
                        TheMovieHelper.TheMovieTitle title = matching[0];
                        print("LOADED:::::::::-->>>1 " + title.href);

                        string d     = DownloadString(title.href);
                        int    maxEp = TheMovieHelper.GetMaxEp(d, title.href);
                        if (maxEp == 0 || maxEp == 1)
                        {
                            string rEp = title.href + "/" + (maxEp - 1); //+ "-episode-" + maxEp;
                            watchMovieSeasonsData[-1] = rEp;
                            print("LOADED:::::::::-->>>2 " + rEp);
                        }
                    }
                }
                else
                {
                    var episodes = list.Where(t => !t.isDub && t.season != -1 && ToDown(t.name, true, "") == compare && t.href.Contains("/series/")).ToList().OrderBy(t => t.season).ToArray();

                    for (int i = 0; i < episodes.Length; i++)
                    {
                        watchMovieSeasonsData[episodes[i].season] = episodes[i].href;
                    }
                }
                return(watchMovieSeasonsData);
            }
            catch { return(null); }
        }
        public override NonBloatSeasonData GetSeasonData(MALSeason ms, TempThread tempThread, string year, object storedData)
        {
            NonBloatSeasonData setData = new NonBloatSeasonData()
            {
                dubEpisodes = new List <string>(), subEpisodes = new List <string>()
            };

            try {
                string name = ms.name;
                var    list = (List <TheMovieTitle>)storedData;

                string compare = ToDown(name, true, "");
                var    end     = list.Where(t => (t.href.Contains("/anime-info/")) && ToDown(t.name, true, "") == compare).OrderBy(t => { FuzzyMatch(t.name, name, out int score); return(-score); }).ToArray();

                bool   subExists = false;
                bool   dubExists = false;
                string subUrl    = "";
                string dubUrl    = "";
                for (int k = 0; k < end.Length; k++)
                {
                    if (!subExists && !end[k].isDub)
                    {
                        subExists = true;
                        subUrl    = end[k].href;
                    }
                    if (!dubExists && end[k].isDub)
                    {
                        dubExists = true;
                        dubUrl    = end[k].href;
                    }
                }

                try {
                    int maxSubbedEp = subExists ? TheMovieHelper.GetMaxEp(DownloadString(subUrl), subUrl) : 0;
                    if (!GetThredActive(tempThread))
                    {
                        return(setData);
                    }
                    ;                                                     // COPY UPDATE PROGRESS
                    int maxDubbedEp = dubExists ? TheMovieHelper.GetMaxEp(DownloadString(dubUrl), dubUrl) : 0;
                    if (!GetThredActive(tempThread))
                    {
                        return(setData);
                    }
                    ;                                                     // COPY UPDATE PROGRESS

                    for (int i = 0; i < maxDubbedEp; i++)
                    {
                        setData.dubEpisodes.Add(dubUrl);
                    }

                    for (int i = 0; i < maxSubbedEp; i++)
                    {
                        setData.subEpisodes.Add(subUrl);
                    }
                    return(setData);
                }
                catch (Exception _ex) {
                    print("ANIME ERROROROROOR.::" + _ex);
                    return(setData);
                }
            }
            catch (Exception) {
                return(setData);
            }
        }