Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            LogFile log = new LogFile();
            string torrentHash = args[0].ToString();

            if (!string.IsNullOrEmpty(torrentHash))
            {
                uTorrentAPI api = new uTorrentAPI(log, torrentHash);

                var label = api.GetLabel();
                if (label == "sick" || label == "couchpotato")
                {
                    api.StopTorrent();
                    var files = api.GetFiles();
                    var folder = api.GetFolder();
                    foreach (var f in files)
                    {
                        string sourceFile = System.IO.Path.Combine(folder, f);
                        string destFile = System.IO.Path.Combine(Constants.basedir + @"\" + label, f);
                        File.Move(sourceFile, destFile);
                    }
                }
                else
                {
                    log.Write("Do nothing (label: " + label + ")");//wrong label
                }
            }
            else
            {
                log.Write("hash parameter empty");
            }

            log.Close();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            LogFile log         = new LogFile();
            string  torrentHash = args[0].ToString();

            if (!string.IsNullOrEmpty(torrentHash))
            {
                uTorrentAPI api = new uTorrentAPI(log, torrentHash);

                var label = api.GetLabel();
                if (label == "sick" || label == "couchpotato")
                {
                    api.StopTorrent();
                    var files  = api.GetFiles();
                    var folder = api.GetFolder();
                    foreach (var f in files)
                    {
                        string sourceFile = System.IO.Path.Combine(folder, f);
                        string destFile   = System.IO.Path.Combine(Constants.basedir + @"\" + label, f);
                        File.Move(sourceFile, destFile);
                    }
                }
                else
                {
                    log.Write("Do nothing (label: " + label + ")");//wrong label
                }
            }
            else
            {
                log.Write("hash parameter empty");
            }

            log.Close();
        }