Пример #1
0
        private static void EnrichAudioInfo(string file, EpisodeData episode)
        {
            var fi = new FileInfo(Path.Combine(_targetDir, file));

            var mediaInfo = GetMediaInfo(fi);

            if (mediaInfo != null)
            {
                var xmlInfo = MediaInfo2XmlConverter.Convert(mediaInfo, episode.OriginalLanguage);

                xmlInfo.Episode = new Episode()
                {
                    SeriesName    = episode.DisplayName,
                    EpisodeNumber = episode.EpisodeID,
                    EpisodeName   = episode.EpisodeName
                };

                XmlWriter.Write(fi, xmlInfo);
            }

            var audioStreams = mediaInfo?.streams?.Where(stream => stream.codec_type == "audio") ?? Enumerable.Empty <FF.Stream>();

            var audioLanguages = audioStreams.Select(stream => stream.tag.GetLanguage() ?? episode.OriginalLanguage).Distinct();

            audioLanguages.ForEach(language => episode.AddAudio(language));

            var subtitleStreams = mediaInfo?.streams?.Where(stream => stream.codec_type == "subtitle") ?? Enumerable.Empty <FF.Stream>();

            var subtitleLanguages = subtitleStreams.Select(stream => stream.tag.GetLanguage() ?? episode.OriginalLanguage).Distinct();

            subtitleLanguages.ForEach(language => episode.AddSubtitle(language));
        }
Пример #2
0
        private static void AppendEpisode(EpisodeData episode, int padSeriesName, int padEpisodeID, int padEpisodeName, int padAddInfo, StringBuilder mailTextBuilder)
        {
            mailTextBuilder.Append(episode.DisplayName.PadRight(padSeriesName + 1));
            mailTextBuilder.Append(episode.EpisodeID.PadLeft(padEpisodeID));
            mailTextBuilder.Append(" \"");

            var episodeName = episode.EpisodeName + "\"";

            episodeName = episodeName.PadRight(padEpisodeName + 1);

            mailTextBuilder.Append(episodeName);
            mailTextBuilder.Append(" ");
            mailTextBuilder.Append(episode.AddInfo.PadRight(padAddInfo));
            mailTextBuilder.Append(" (");
            mailTextBuilder.Append(episode.FileSize.ToString(3));
            mailTextBuilder.AppendLine(")\t");

            var audio = episode.GetAudio();

            var subtitles = episode.GetSubtitles();


            if (!string.IsNullOrEmpty(audio))
            {
                mailTextBuilder.AppendLine($"\t\t\tAudio: {audio}");
            }

            if (!string.IsNullOrEmpty(subtitles))
            {
                mailTextBuilder.AppendLine($"\t\t\tSubtitles: {subtitles}");
            }
        }
Пример #3
0
        private static void AddInfo(ref string addInfo, HashSet <string> names, EpisodeData episode, string text)
        {
            if (names.Contains(episode.SeriesName) == false)
            {
                addInfo += $"New  {text}: {episode.DisplayName}{Environment.NewLine}{Environment.NewLine}";

                names.Add(episode.SeriesName);
            }
        }
Пример #4
0
        private static void AppendEpisode(EpisodeData data, int padSeriesName, int padEpisodeID, int padEpisodeName, int padAddInfo, StringBuilder email)
        {
            email.Append(data.DisplayName.PadRight(padSeriesName + 1));
            email.Append(data.EpisodeID.PadLeft(padEpisodeID));
            email.Append(" \"");

            var episodeName = data.EpisodeName + "\"";

            episodeName = episodeName.PadRight(padEpisodeName + 1);

            email.Append(episodeName);
            email.Append(" ");
            email.Append(data.AddInfo.PadRight(padAddInfo));
            email.Append(" (");
            email.Append(data.FileSize.ToString(3));
            email.AppendLine(")\t");
        }
Пример #5
0
        private static void AddInfo(StringBuilder addInfoBuilder, HashSet <string> names, EpisodeData episode, string text)
        {
            if (names.Contains(episode.SeriesName) == false)
            {
                addInfoBuilder.AppendLine($"Neue {text}: {episode.DisplayName}");

                if (!string.IsNullOrWhiteSpace(episode.Link))
                {
                    addInfoBuilder.AppendLine(episode.Link);
                }

                addInfoBuilder.AppendLine();

                names.Add(episode.SeriesName);
            }
        }