示例#1
0
        /// <summary>
        /// Imports the specified input folder.
        /// </summary>
        /// <param name="inputFolder">The input folder.</param>
        private void Import(string inputFolder)
        {
            File.WriteAllLines(@"C:\Users\proud\Desktop\args.txt", new[] { inputFolder });
            var destPath = this.MoveTargetFolder(inputFolder);

            Debug.WriteLine(destPath);
            FileBot.GetSubtitles(destPath);
            PlexMediaScanner.Update();
        }
示例#2
0
        /// <summary>
        /// Handles the type of the video file.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        private string HandleVideoFileType(string path)
        {
            long     duration = DurationProvier.GetDurationAsNanoSeconds(path);
            TimeSpan timeSpan = TimeSpan.FromSeconds(duration / DurationProvier.NANO_SECONDS);

            //DETERMINING VIDEO DURATION
            string foundDurationMessage = timeSpan.Hours + ":" + timeSpan.Minutes + ":" + timeSpan.Seconds;

            //DETERMINING VIDEO TYPE
            DurationProvier.VideoType videoType = DurationProvier.GetVideoTypeFromDuration(duration);
            Logger.Info("PiPlex:HandleVideoFileType", "Duration: " + foundDurationMessage + " - Type: " + videoType.ToString());

            string destPath = null;

            switch (videoType)
            {
            case DurationProvier.VideoType.UNDEFINED:
            case DurationProvier.VideoType.MOVIE:
                destPath = Settings.Default.PlexMovieFolderPath + "\\" + Path.GetFileName(path);
                break;

            case DurationProvier.VideoType.TV_SHOW:
                destPath = Settings.Default.PlexTvShowFolderPath + "\\" + Path.GetFileName(path);
                break;
            }


            //MOVING FILE TO DEST FOLDER
            Logger.Info("PiPlex:HandleVideoFileType", "Moving file to: " + destPath);
            try
            {
                if (File.Exists(destPath))
                {
                    File.Delete(destPath);
                }
                File.Move(path, destPath);
                Logger.Info("PiPlex:HandleVideoFileType", "File moved");
            }
            catch (Exception exception)
            {
                Logger.Error("PiPlex:HandleVideoFileType", "Unable to move file: " + exception.Message);
            }

            //Download subtitles with Filebot
            FileBot.GetSubtitles(destPath);
            return(destPath);
        }