Пример #1
0
 public CopyMoveProgress(TVDoc doc, ActionQueue[] todo)
 {
     this.mDoc = doc;
     this.mToDo = todo;
     this.InitializeComponent();
     this.copyTimer.Start();
 }
Пример #2
0
        // private int mInternalChange;
        // private TheTVDBCodeFinder mTCCF;

        public FolderMonitor(TVDoc doc)
        {
            this.mDoc = doc;

            this.InitializeComponent();

            this.FillFolderStringLists();
        }
Пример #3
0
        public TorrentMatch(TVDoc doc, SetProgressDelegate prog)
        {
            this.SetProgress = prog;
            this.mDoc = doc;

            this.InitializeComponent();

            this.TabBTEnableDisable();
        }
Пример #4
0
        public AutoFolderMonitor(TVDoc Doc,UI ui)
        {
            mDoc = Doc;
            mUI = ui;

            mScanDelayTimer = new System.Timers.Timer(1000);
            mScanDelayTimer.Elapsed += new System.Timers.ElapsedEventHandler(mScanDelayTimer_Elapsed);
            mScanDelayTimer.Stop();
        }
Пример #5
0
        public ActorsGrid(TVDoc doc)
        {
            this.Internal = 0;

            this.InitializeComponent();

            this.mDoc = doc;

            this.BuildData();
            this.DoSort();
        }
Пример #6
0
        public IgnoreEdit(TVDoc doc)
        {
            this.mDoc = doc;
            this.Ignore = new System.Collections.Generic.List<IgnoreItem>();

            foreach (IgnoreItem ii in this.mDoc.Ignore)
                this.Ignore.Add(ii);

            this.InitializeComponent();

            this.FillList();
        }
Пример #7
0
        public Preferences(TVDoc doc, bool goToScanOpts)
        {
            this.InitializeComponent();
            this.LoadLanguageDone += this.LoadLanguageDoneFunc;

            this.SetupRSSGrid();
            this.SetupReplacementsGrid();

            this.mDoc = doc;

            if (goToScanOpts)
                this.tabControl1.SelectedTab = this.tpScanOptions;
        }
Пример #8
0
        public CustomNameDesigner(List<ProcessedEpisode> pel, CustomName cn, TVDoc doc)
        {
            this.Eps = pel;
            this.CN = cn;
            this.mDoc = doc;

            this.InitializeComponent();

            if (this.Eps == null)
                this.lvTest.Enabled = false;
            this.txtTemplate.Text = this.CN.StyleString;

            this.FillExamples();
            this.FillCombos();
        }
Пример #9
0
        public uTorrent(TVDoc doc, SetProgressDelegate progdel)
        {
            this.mDoc = doc;
            this.SetProg = progdel;

            this.InitializeComponent();

            this.watcher.Error += this.WatcherError;

            bool en = false;
            // are there any missing items in the to-do list?
            foreach (Item i in this.mDoc.TheActionList)
            {
                if (i is ItemMissing)
                {
                    en = true;
                    break;
                }
            }
            this.cbUTMatchMissing.Enabled = en;
            this.EnableDisable();

            this.bnUTRefresh_Click(null, null);
        }
Пример #10
0
 public SABnzbdFinder(TVDoc i) : base(i) { }
Пример #11
0
    private static int Main(string[] args)
    {
        // Enabling Windows XP visual effects before any controls are created
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        
        // Sort out the command line arguments
        CommandLineArgs clargs = new CommandLineArgs(args);

        // see if we're already running
        bool createdNew = false;
        System.Threading.Mutex mutex = new System.Threading.Mutex(true, "TVRenameMutex", out createdNew);

        if (!createdNew)
        {
            // we're already running

            // tell the already running copy to come to the foreground
            IpcClientChannel clientChannel = new IpcClientChannel();
            ChannelServices.RegisterChannel(clientChannel, true);

            RemotingConfiguration.RegisterWellKnownClientType(typeof (IPCMethods), "ipc://TVRenameChannel/IPCMethods");

            IPCMethods ipc = new IPCMethods();

            // if we were already running, and no command line arguments, then bring application to the foreground
            // and we're done.
            if (args.Length == 0)
            {
                ipc.BringToForeground();
                return 0;
            }

            // Send command-line arguments to already running TVRename via IPC

            CommandLineArgs.MissingFolderBehaviour before = ipc.MissingBehaviour;
            bool renameBefore = ipc.RenameBehaviour;

            if (clargs.RenameCheck == false)
             {
              // Temporarily override behaviour for missing folders
              ipc.RenameBehaviour = false;
            }

            if (clargs.MissingFolder != CommandLineArgs.MissingFolderBehaviour.Ask)
            {
                // Temporarily override behaviour for missing folders
                ipc.MissingBehaviour = clargs.MissingFolder;
            }

            // TODO: Unify command line handling between here and in UI.cs (ProcessArgs).  Just send in clargs via IPC?

            if (clargs.Scan || clargs.DoAll) // doall implies scan
                ipc.Scan();

            if (clargs.DoAll)
                ipc.DoAll();

            if (clargs.Quit)
            {
                ipc.Quit();
                return 0;
            }

            ipc.RenameBehaviour = renameBefore;
            ipc.MissingBehaviour = before;

        return 0;
        }

#if !DEBUG
		try
		{
#endif

        // Starting TVRename...

        // Check arguments for forced recover
        bool ok = true;
        string recoverText = "";

        if (clargs.ForceRecover)
        {
            ok = false; // force recover dialog
            recoverText = "Recover manually requested.";
        }

        // Load settings files
        TVDoc doc = null;
        try
        {
            if (!string.IsNullOrEmpty(clargs.UserFilePath))
                PathManager.SetUserDefinedBasePath(clargs.UserFilePath);
        }
        catch (System.Exception ex)
        {
            MessageBox.Show("Error while setting the User-Defined File Path:" + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            Environment.Exit(1);
        }

        FileInfo tvdbFile = PathManager.TVDBFile;
        FileInfo settingsFile = PathManager.TVDocSettingsFile;

        do // loop until no problems loading settings & tvdb cache files
        {
            if (!ok) // something went wrong last time around, ask the user what to do
            {
                RecoverXML rec = new RecoverXML(recoverText);
                if (rec.ShowDialog() == DialogResult.OK)
                {
                    tvdbFile = rec.DBFile;
                    settingsFile = rec.SettingsFile;
                }
                else
                    return 1;
            }

            // try loading using current settings files, and set up the main
            // classes
            TheTVDB.Instance.setup(tvdbFile, PathManager.TVDBFile, clargs);

            doc = new TVDoc(settingsFile, clargs);

            if (!ok)
                doc.SetDirty();

            ok = doc.LoadOK;

            if (!ok)
            {
                recoverText = "";
                if (!doc.LoadOK && !String.IsNullOrEmpty(doc.LoadErr))
                    recoverText += doc.LoadErr;
                if (!TheTVDB.Instance.LoadOK && !String.IsNullOrEmpty(TheTVDB.Instance.LoadErr))
                    recoverText += "\r\n" + TheTVDB.Instance.LoadErr;
            }
        } while (!ok);

        // Show user interface
        UI theUI = new UI(doc);
        Application.Run(theUI);
        GC.KeepAlive(mutex);

#if !DEBUG
		}
		catch (Exception e)
		{
		  ShowException se = new ShowException(e);
		  se.ShowDialog();
		}
#endif

        return 0;
    }
Пример #12
0
        public DownloadProgress(TVDoc doc)
        {
            this.InitializeComponent();

            this.mDoc = doc;
        }
Пример #13
0
 public Finder(TVDoc doc)
 {
     this.mDoc = doc;
 }
Пример #14
0
 public FileFinder(TVDoc i) : base(i) { }
Пример #15
0
 public FilenameMovieCheck([NotNull] MovieConfiguration movie, TVDoc doc) : base(movie, doc)
 {
 }
 public CustomLanguageTvShowCheck([NotNull] ShowConfiguration show, TVDoc doc) : base(show, doc)
 {
 }
 public FindMissingEpisodesLocally(TVDoc doc) : base(doc)
 {
 }
Пример #18
0
        public static List <ShowItem> FindShows([NotNull] List <string> possibleShowNames, TVDoc doc)
        {
            List <ShowItem> addedShows = new List <ShowItem>();

            foreach (string hint in possibleShowNames)
            {
                //if hint doesn't match existing added shows
                if (LookForSeries(hint, addedShows))
                {
                    Logger.Info($"Ignoring {hint} as it matches existing shows.");
                    continue;
                }

                //If the hint contains certain terms then we'll ignore it
                if (IgnoreHint(hint))
                {
                    Logger.Info($"Ignoring {hint} as it is in the ignore list (from Settings).");
                    continue;
                }

                //If the hint contains certain terms then we'll ignore it
                if (TVSettings.Instance.IgnoredAutoAddHints.Contains(hint))
                {
                    Logger.Info(
                        $"Ignoring {hint} as it is in the list of ignored terms the user has selected to ignore from prior Auto Adds.");

                    continue;
                }

                //Remove any (nnnn) in the hint - probably a year
                string refinedHint = Regex.Replace(hint, @"\(\d{4}\)", "");

                //Remove anything we can from hint to make it cleaner and hence more likely to match
                refinedHint = RemoveSeriesEpisodeIndicators(refinedHint, doc.Library.SeasonWords());

                if (string.IsNullOrWhiteSpace(refinedHint))
                {
                    Logger.Info($"Ignoring {hint} as it refines to nothing.");
                    continue;
                }

                //If there are no LibraryFolders then we cant use the simplified UI
                if (TVSettings.Instance.LibraryFolders.Count == 0)
                {
                    MessageBox.Show(
                        "Please add some monitor (library) folders under 'Bulk Add Shows' to use the 'Auto Add' functionity (Alternatively you can add them or turn it off in settings).",
                        "Can't Auto Add Show", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    continue;
                }

                Logger.Info("****************");
                Logger.Info("Auto Adding New Show");

                //popup dialog
                AutoAddShow askForMatch = new AutoAddShow(refinedHint);

                DialogResult dr = askForMatch.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    //If added add show to collection
                    addedShows.Add(askForMatch.ShowItem);
                }
                else if (dr == DialogResult.Abort)
                {
                    Logger.Info("Skippng Auto Add Process");
                    break;
                }
                else if (dr == DialogResult.Ignore)
                {
                    Logger.Info($"Permenantly Ignoring 'Auto Add' for: {hint}");
                    TVSettings.Instance.IgnoredAutoAddHints.Add(hint);
                }
                else
                {
                    Logger.Info($"Cancelled Auto adding new show {hint}");
                }
            }

            return(addedShows);
        }
Пример #19
0
 public static bool BetterShowsMatch(FileInfo matchedFile, ShowItem currentlyMatchedShow, bool useFullPath, [NotNull] TVDoc doc)
 {
     return(doc.Library.Shows
            .Where(item => item.NameMatch(matchedFile, useFullPath))
            .Where(item => item.TvdbCode != currentlyMatchedShow.TvdbCode)
            .Any(testShow => testShow.ShowName.Contains(currentlyMatchedShow.ShowName)));
 }
Пример #20
0
 public CleanDownloadDirectory(TVDoc doc) : base(doc)
 {
 }
Пример #21
0
 public SubdirectoryMovieCheck([NotNull] MovieConfiguration movie, TVDoc doc) : base(movie, doc)
 {
 }
Пример #22
0
 public CheckAllFoldersExist(TVDoc doc) : base(doc)
 {
 }
Пример #23
0
 private void bnBTSecondOpen_Click(object sender, System.EventArgs e)
 {
     TVDoc.SysOpen(this.txtBTSecondLocation.Text);
 }
Пример #24
0
 protected ScanActivity(TVDoc doc) => MDoc = doc;
Пример #25
0
 public UpcomingRSS(TVDoc i) : base(i) { }
Пример #26
0
 public UpcomingPopup(TVDoc doc)
 {
     mDoc = doc;
     InitializeComponent();
 }
Пример #27
0
 public UpcomingPopup(TVDoc doc)
 {
     this.mDoc = doc;
     this.InitializeComponent();
 }
Пример #28
0
 public BulkAddSeriesManager(TVDoc doc)
 {
     AddItems = new FolderMonitorEntryList();
     mDoc     = doc;
 }
Пример #29
0
 public UpcomingXML(TVDoc i) : base(i) { }
Пример #30
0
 public UpcomingRSS(TVDoc i) : base(i)
 {
 }
Пример #31
0
 public UpcomingExporter(TVDoc doc)
 {
     this.mDoc = doc;
 }
Пример #32
0
 public string ProcessLine(string line, TVDoc doc)
 {
     string[] parts = line.Split(' ');
     if (parts.Length != 3)
         return "";
     if (parts[0].ToUpper() != "GET")
         return "";
     if (parts[1].EndsWith("/upcoming.xml"))
     {
         MemoryStream ms = new MemoryStream();
         doc.GenerateUpcomingXML(ms, doc.NextNShows(doc.Settings.ExportRSSMaxShows, doc.Settings.ExportRSSDaysPast, doc.Settings.ExportRSSMaxDays));
         return System.Text.Encoding.ASCII.GetString(ms.ToArray());
     }
     return Err();
 }
Пример #33
0
 public static void Setup(UI ui, TVDoc doc)
 {
     TheDoc = doc;
     TheUI = ui;
 }
Пример #34
0
 public BugReport(TVDoc doc)
 {
     this.mDoc = doc;
     this.InitializeComponent();
 }
Пример #35
0
        public bool ReadItem(XmlReader r)
        {
            string title       = "";
            string link        = "";
            string description = "";

            r.Read();
            r.Read();
            while (!r.EOF)
            {
                if ((r.Name == "item") && (!r.IsStartElement()))
                {
                    break;
                }
                if (r.Name == "title")
                {
                    title = r.ReadElementContentAsString();
                }
                else if (r.Name == "description")
                {
                    description = r.ReadElementContentAsString();
                }
                else if ((r.Name == "link") && (string.IsNullOrEmpty(link)))
                {
                    link = r.ReadElementContentAsString();
                }
                else if ((r.Name == "enclosure") && (r.GetAttribute("type") == "application/x-bittorrent"))
                {
                    link = r.GetAttribute("url");
                    r.ReadOuterXml();
                }
                else
                {
                    r.ReadOuterXml();
                }
            }
            if ((string.IsNullOrEmpty(title)) || (string.IsNullOrEmpty(link)))
            {
                return(false);
            }

            int    season   = -1;
            int    episode  = -1;
            string showName = "";

            TVDoc.FindSeasEp("", title, out season, out episode, null, this.Rexps);

            try
            {
                Match m = Regex.Match(description, "Show Name: (.*?)[;|$]", RegexOptions.IgnoreCase);
                if (m.Success)
                {
                    showName = m.Groups[1].ToString();
                }
                m = Regex.Match(description, "Season: ([0-9]+)", RegexOptions.IgnoreCase);
                if (m.Success)
                {
                    season = int.Parse(m.Groups[1].ToString());
                }
                m = Regex.Match(description, "Episode: ([0-9]+)", RegexOptions.IgnoreCase);
                if (m.Success)
                {
                    episode = int.Parse(m.Groups[1].ToString());
                }
            }
            catch
            {
            }

            if ((season != -1) && (episode != -1))
            {
                this.Add(new RSSItem(link, title, season, episode, showName));
            }

            return(true);
        }
Пример #36
0
 public MovieProviderCheck([NotNull] MovieConfiguration movie, TVDoc doc) : base(movie, doc)
 {
 }
Пример #37
0
 public RSSFinder(TVDoc i) : base(i)
 {
 }
Пример #38
0
 public string ProcessLine(string line, TVDoc doc)
 {
     string[] parts = line.Split(' ');
     if (parts.Length != 3)
         return "";
     if (parts[0].ToUpper() != "GET")
         return "";
     if (parts[1].EndsWith("/upcoming.xml"))
     {
         UpcomingXML uXML = new UpcomingXML(doc);
         return uXML.produce();
     }
     return Err();
 }
Пример #39
0
 private void bnBTOpenFolder_Click(object sender, System.EventArgs e)
 {
     TVDoc.SysOpen(this.txtFolder.Text);
 }
Пример #40
0
        public TVRenameServer(TVDoc doc)
        {
            for (;;)
            {
                try
                {
                    // Set the TcpListener on port 13000.
                    Int32 port = 8085;
                    IPAddress localAddr = IPAddress.Parse("127.0.0.1");

                    TcpListener server = new TcpListener(localAddr, port);

                    // Start listening for client requests.
                    server.Start();

                    // Buffer for reading data
                    Byte[] bytes = new Byte[256];
                    string data = null;

                    // Enter the listening loop.
                    while (true)
                    {
                        // Perform a blocking call to accept requests.
                        // You could also user server.AcceptSocket() here.
                        TcpClient client = server.AcceptTcpClient();
                        data = null;

                        // Get a stream Object* for reading and writing
                        NetworkStream stream = client.GetStream();
                        Int32 i;

                        // Loop to receive all the data sent by the client.
                        string line = "";
                        string getLine = "";
                        bool done = false;
                        while (!done && ((i = stream.Read(bytes, 0, bytes.Length)) > 0))
                        {
                            // Translate data bytes to a ASCII String*.
                            data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);

                            for (int p = 0; p < data.Length; p++)
                            {
                                char c = data[p];
                                if ((c == 0x0d) || (c == 0x0a))
                                {
                                    if ((c == 0x0d) && ((p + 1) < data.Length) && (data[p + 1] == 0x0a))
                                        p++; // skip LF following CR

                                    if (line.Length > 0)
                                    {
                                        if (line.Substring(0, 4).ToUpper() == "GET ")
                                            getLine = line;
                                    }
                                    else
                                    {
                                        if (!string.IsNullOrEmpty(getLine)) // this line is blank, and we have a GET line saved
                                        {
                                            string res = this.ProcessLine(getLine, doc);
                                            Byte[] msg = System.Text.Encoding.ASCII.GetBytes(res);
                                            stream.Write(msg, 0, msg.Length);
                                            getLine = "";
                                            done = true;
                                            break;
                                        }
                                    }

                                    line = "";
                                }
                                else
                                    line += c;
                            }
                        }
                        client.Close(); // Shutdown and end connection
                    }
                } // try
                catch (SocketException e)
                {
                    System.Windows.Forms.MessageBox.Show(e.ToString());
                }
                catch (ThreadAbortException)
                {
                    // time to stop

                    return; // we're outta here!
                }
            } // loop forever
        }
Пример #41
0
 public uTorrentFinder(TVDoc i) : base(i) { }
Пример #42
0
 protected ScanMovieActivity([NotNull] TVDoc doc) : base(doc)
 {
 }
Пример #43
0
        public UI(TVDoc doc)
        {
            this.mDoc = doc;

            this.Busy = 0;
            this.mLastEpClicked = null;
            this.mLastFolderClicked = null;
            this.mLastSeasonClicked = null;
            this.mLastShowsClicked = null;
            this.mLastActionsClicked = null;

            this.mInternalChange = 0;
            this.mFoldersToOpen = new List<String>();

            this.InternalCheckChange = false;

            this.InitializeComponent();

            this.SetupIPC();

            try
            {
                this.LoadLayoutXML();
            }
            catch
            {
                // silently fail, doesn't matter too much
            }

            this.SetProgress += this.SetProgressActual;

            this.lvWhenToWatch.ListViewItemSorter = new DateSorterWTW();

            if (this.mDoc.Args.Hide)
            {
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.Hide();
            }

            this.Text = this.Text + " " + Version.DisplayVersionString();

            this.FillMyShows();
            this.UpdateSearchButton();
            this.SetGuideHTMLbody("");
            this.mDoc.DoWhenToWatch(true);
            this.FillWhenToWatchList();
            this.mDoc.WriteUpcomingRSSandXML();
            this.ShowHideNotificationIcon();

            int t = this.mDoc.Settings.StartupTab;
            if (t < this.tabControl1.TabCount)
                this.tabControl1.SelectedIndex = this.mDoc.Settings.StartupTab;
            this.tabControl1_SelectedIndexChanged(null, null);

            this.mAutoFolderMonitor = new TVRename.AutoFolderMonitor(mDoc,this);
            if (this.mDoc.Settings.MonitorFolders)
                this.mAutoFolderMonitor.StartMonitor();


        }
Пример #44
0
 protected UpcomingExporter(TVDoc doc)
 {
     this.doc = doc;
 }