public DoubleSubtitle(ISubtitle firstSubtitle, ISubtitle secondSubtitle, string path, string size1 = "40", string color1 = "#ffffff", string size2 = "40", string color2 = "00ff00") { LightAndFontSize1 = $"< font color=\"{color1}\" size={size1}>"; LightAndFontSize2 = $"< font color=\"{color2}\" size={size2}>"; Path = path; CreateDoubleSubtitle(firstSubtitle, secondSubtitle); }
public Film(IFactory factory) { if (factory != null) { sound = factory.Sound(); subtitle = factory.Subtitle(); } }
private void SaveSubtitleToOutput(ISubtitle subtitle, string outputDestination) { var subtitleString = subtitle.ToString(); using (var writer = File.CreateText(outputDestination)) { writer.Write(subtitleString); } }
private void ResortSubtitle(ISubtitle subtitle, string filename) { SubtitleCollection subs = subtitle.Build(filename); foreach (var sub in subs) { if(string.IsNullOrEmpty(sub.Content)) continue; _logger.InfoLine(sub.Content); } }
protected SubtitleAction(ISubtitle subtitle) { if (subtitle == null) { throw new ArgumentNullException(); } _originalSubtitle = (ISubtitle)subtitle.Clone(); Subtitle = subtitle; }
private void ResortSubtitle(ISubtitle subtitle, string filename) { SubtitleCollection subs = subtitle.Build(filename); int startIndex = StartIndex; foreach (SubtitleItem title in subs) { title.Order = startIndex++; } subtitle.Write(filename + ".delay", subs); }
private void RunDelay(ISubtitle subtitle, string filename) { TimeSpan delayValue = DelayTime; SubtitleCollection subs = subtitle.Build(filename); foreach (SubtitleItem title in subs) { title.Start = title.Start.Add(delayValue); title.End = title.End.Add(delayValue); } subtitle.Write(filename + ".delay", subs); }
void CreateDoubleSubtitle(ISubtitle firstSubtitle, ISubtitle secondSubtitle) { int i = 0; while (firstSubtitle.Content.Count > 1 || secondSubtitle.Content.Count > 1) { content.Add(i++.ToString()); int x = firstSubtitle.Content[0].Substring(0, 8).CompareTo(secondSubtitle.Content[0].Substring(0, 8)); if ((firstSubtitle.Content.Count > 1 && secondSubtitle.Content.Count > 1) && x == 0) { //add timeline content.Add(firstSubtitle.Content[0]); //delete time line firstSubtitle.Content.RemoveAt(0); secondSubtitle.Content.RemoveAt(0); //add text line content.Add(LightAndFontSize1 + firstSubtitle.Content[0] + endText); content.Add(LightAndFontSize2 + secondSubtitle.Content[0] + endText); //delate text line firstSubtitle.Content.RemoveAt(0); secondSubtitle.Content.RemoveAt(0); } else if ((firstSubtitle.Content.Count > 1 && secondSubtitle.Content.Count > 1) && x == 1) { //add time line and delete time line content.Add(secondSubtitle.Content[0]); secondSubtitle.Content.RemoveAt(0); //add text line and delete text line content.Add(LightAndFontSize2 + secondSubtitle.Content[0] + endText); secondSubtitle.Content.RemoveAt(0); } else { //add time line and delete time line content.Add(firstSubtitle.Content[0]); firstSubtitle.Content.RemoveAt(0); //add text line and delete text line content.Add(LightAndFontSize1 + firstSubtitle.Content[0] + endText); firstSubtitle.Content.RemoveAt(0); } content.Add("\n"); } }
public static async Task <IEnumerable <ISubtitle> > GetVideoItemSubtitlesAsync(string id) { var res = new List <ISubtitle>(); List <SubtitlePOCO> poco = await YouTubeSite.GetVideoSubtitlesByIdAsync(id).ConfigureAwait(false); res.AddRange(poco.Select(SubtitleFactory.CreateSubtitle)); if (res.Any()) { return(res); } ISubtitle chap = SubtitleFactory.CreateSubtitle(); chap.IsEnabled = false; chap.Language = "Auto"; res.Add(chap); return(res); }
static void Main(string[] args) { try { var options = new SubbedOptionParser(args); if (options.ActionVerb == Verbs.Help) { options.WriteHelp(); return; } var parserFactory = new SubtitleParserFactory(); ISubtitleParser reader = parserFactory.GetReaderFor(options.InputFile); IEnumerable <ISubtitle> subs = reader.Read(options.InputFile); var subManager = new SubtitleManager(subs); switch (options.ActionVerb) { case Verbs.Extrapolate: ISubtitle targetSub = subs.FirstOrDefault(options.SubtitleSelector); subManager.Extrapolate(targetSub, options.TimeDiff); break; case Verbs.StretchBy: subManager.StretchBy(options.Factor); break; case Verbs.TransposeBy: subManager.TransposeBy(options.TimeDiff); break; } subs = subManager.Subtitles; ISubtitleParser writer = parserFactory.GetWriterFor(options.OutputFile); writer.Write(subs, options.OutputFile); } catch (Exception ex) { Console.WriteLine(ex); } }
public SubtitleTranslatorAction(ISubtitle subtitle, CultureInfo culture) : base(subtitle) { _culture = culture; }
private void mainForm_FirstFileOpenClick(object sender, EventArgs e) { firstSubtitle = new Subtitle(mainForm.Path1); }
private void mainForm_SecondFileClick(object sender, EventArgs e) { secondSubtitle = new Subtitle(mainForm.Path2); }
public void Extrapolate(ISubtitle targetSub, TimeSpan diff) { double multiplicationFactor = (targetSub.Begin.Ticks + diff.Ticks) / (double)targetSub.Begin.Ticks; StretchBy(multiplicationFactor); }
public void Set(ISubtitle subtitle) { FilePath = subtitle.FilePath; Items = subtitle.Items; }
public SubtitleTimeOffsetAction(TimeSpan offset, ISubtitle subtitle) : base(subtitle) { _offset = offset; }
public SubtitleController(ISubtitle subtitleHandler) { _subtitleHandler = subtitleHandler; }