Esempio n. 1
0
        private (IndexerResult Result, int?Range) ParseEzTvTorrent(EzTvGetTorrentsResponse.Torrent torrent)
        {
            var result = new IndexerResult(this, torrent.title, torrent.magnet_url, torrent.seeds, torrent.peers)
            {
                Date      = DateTimeOffset.FromUnixTimeSeconds(torrent.date_released_unix).UtcDateTime,
                SizeBytes = torrent.size_bytes.ToLong() ?? 0,
                Season    = torrent.season.ToInt(),
                Episode   = torrent.episode.ToInt()
            };

            var numbering = GetNumbering(torrent.title);

            if (!result.Episode.HasValue && !result.Season.HasValue)
            {
                result.Episode = numbering.Episode;
                result.Season  = numbering.Season;
            }

            return(result, numbering.Range);
        }
Esempio n. 2
0
        private IndexerResult ParseNyaaTorrent(NyaaTorrentResponse.Torrent torrent, Media media)
        {
            var idxr = new IndexerResult(this, torrent.name, torrent.magnet, torrent.seeders, torrent.leechers)
            {
                Date      = torrent.date,
                SizeBytes = torrent.filesize
            };

            var numbering = GetNumbering(torrent.name);

            idxr.Season  = numbering.Season;
            idxr.Episode = numbering.Episode;

            if (media is Episode episode)
            {
                if (numbering.Range.HasValue && numbering.Range >= episode.Number)
                {
                    if (!idxr.Season.HasValue)
                    {
                        idxr.Season = episode.Season;
                    }

                    if (numbering.Episode == 1 && numbering.Range >= episode.TotalEpisodesInSeason)
                    {
                        idxr.Episode = null;
                    }
                    else
                    {
                        idxr.Episode = episode.Number;
                    }
                }
                if (!idxr.Season.HasValue && !idxr.Episode.HasValue && (new Regex(@"(\sCOMPLETE\s)|(?:\[)(Complete)").IsMatch(torrent.name)))
                {
                    idxr.Season = episode.Season;
                }
            }


            return(idxr);
        }