Exemplo n.º 1
0
        public static void ExtractSnaphots(Settings settings, String path, List <Tuple <CardInfo, String> > allEntries, InfoProgress progress)
        {
            foreach (var entry in allEntries)
            {
                if (progress.Cancelled)
                {
                    break;
                }
                progress.ProcessedSteps(1);

                var cardInfoNameTuple = entry;
                var cardInfo          = cardInfoNameTuple.Item1;
                if (!cardInfo.HasImage())
                {
                    continue;
                }

                // create file at given path
                String outputSnapshotFilename = cardInfoNameTuple.Item2;
                String outputSnapshotFilepath = path + Path.DirectorySeparatorChar + outputSnapshotFilename;

                // get file with snapshot information -> video
                UtilsInputFiles.FileDesc videoFileDesc = cardInfo.episodeInfo.VideoFileDesc;

                // extract image
                double scaling   = UtilsVideo.GetMaxScalingByStreamInfo(cardInfo.episodeInfo.VideoStreamInfo, settings.RescaleWidth, settings.RescaleHeight, settings.RescaleMode);
                double timeStamp = UtilsCommon.GetMiddleTime(cardInfo);
                UtilsImage.GetImage(videoFileDesc.filename, timeStamp, outputSnapshotFilepath, scaling);
            }
        }
Exemplo n.º 2
0
        private static List <LineInfo> ParseSubtitleInVideoFile(Settings settings, string filename, Dictionary <String, String> properties)
        {
            StreamInfo subtitleStreamInfo = UtilsVideo.ChooseStreamInfo(filename, properties, StreamInfo.StreamType.ST_SUBTITLE);

            // new subtitle file
            String videoFileHash       = UtilsCommon.GetDateSizeChecksum(filename);
            String newSubtitleFileName = videoFileHash + "_" + subtitleStreamInfo.StreamIndex + GetExtensionByStreamInfo(subtitleStreamInfo);
            string newSubtitleFilePath = InstanceSettings.temporaryFilesPath + newSubtitleFileName;

            // do not extract again when file was already extracted once
            if (!File.Exists(newSubtitleFilePath))
            {
                UtilsVideo.ExtractStream(filename, subtitleStreamInfo, newSubtitleFilePath);
            }

            return(ParseSubtitle(settings, newSubtitleFilePath, properties));
        }