Ejemplo n.º 1
0
        public static void Run(EpisodeTorrentSearcherResult torrent)
        {
            var fileName = @"torrents\" + torrent.Title + ".torrent";
            Logger.Get("General").Build().Message("Starting process: " + fileName).Debug();

            Process.Start(fileName);
        }
Ejemplo n.º 2
0
        Torrent Download(Episode episode, EpisodeTorrentSearcherResult result)
        {
            var webClient = new CustomWebClient();
            if(!Directory.Exists("Torrents")) Directory.CreateDirectory("Torrents");

            var fileName = @"torrents\" + result.Title + ".torrent";

            try {
                webClient.DownloadFile(result.DownloadURL, fileName);
            } catch(Exception e) {
                Logger.Build().Episode(episode.ID).Message("Error downloading torrent: " + result.DownloadURL + " - " + e).Error();
                return null;
            }

            Torrent torrent;
            try {
                torrent = TorrentParser.ParseFile(fileName);
            } catch(Exception e) {
                Logger.Build().Episode(Episode.ID).Message("Error parsing torrent file: " + fileName + "-->" + e).Error();
                return null;
            }

            return torrent;
        }
Ejemplo n.º 3
0
 string DisplayResult(EpisodeTorrentSearcherResult result)
 {
     return String.Format("{0} ({1}/{2}) {3}MB", result.Title, result.Seeds, result.Leechs, result.MB);
 }
Ejemplo n.º 4
0
        void LogDownload(EpisodeTrackerDBContext db, Episode episode, EpisodeTorrentSearcherResult result)
        {
            var ids = db.Episodes.Where(ep => ep.SeriesID == episode.SeriesID)
                .WhereTVMatch(result.Match)
                .Select(ep => ep.ID)
                .ToArray();

            Logger.Build()
                .Episode(episode.ID)
                .Message("Logging download for episode IDs: " + String.Join(", ", ids))
                .Debug();

            foreach(var id in ids) {
                db.EpisodeDownloadLog.Add(new EpisodeDownloadLog {
                    EpisodeID = id,
                    Date = DateTime.Now,
                    URL = result.DownloadURL.OriginalString
                });
            }

            db.SaveChanges();
        }