Exemple #1
0
        private void txtOtherFormat_Validating(object sender, CancelEventArgs e)
        {
            //04 - TV Show.avi
            //02x04 - TV Show.avi
            //04 - TV Show.avi (format)
            //02x04 - TV Show.avi (format)
            //S01E01 - TV Show.avi
            //Custom

            // rename a test show and extract the ep number
            MetaDataFinder mdf = new MetaDataFinder();

            mdf.ShowFormat = txtOtherFormat.Text;
            var testFile = txtOtherFormat.Text;

            testFile = testFile.Replace("{2}", "2");
            testFile = testFile.Replace("{3}", "12");

            var newFile = mdf.formatFileName("Show", 2, 12, "Episode Name", testFile);
            // Now lets try to extract the epno
            var epNo = MetaDataFinder.GetEpisode(newFile);

            if (epNo != 12)
            {
                MessageBox.Show("If you used this format and processed the files twice you would end up with incorrectly named files, please post a comment on the website if you think this could be wrong");
                e.Cancel = true;
            }
        }
Exemple #2
0
        private int getLastEpisode(string show, int season)
        {
            var seasonpath = string.Format(@"{0}\Season {1}", show, season);
            var eps        = Directory.GetFiles(Path.Combine(ShowFolder, seasonpath));

            var lastep = (from s in eps
                          let f = new FileInfo(s)
                                  where mediaTypes.Contains(f.Extension)
                                  orderby f.Name descending
                                  select f.Name).FirstOrDefault();

            if (lastep == null)
            {
                return(-1);
            }
            return(MetaDataFinder.GetEpisode(lastep));
        }