mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-11 21:02:10 +01:00
fix SA1513/SA1516
This commit is contained in:
@@ -229,6 +229,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
{
|
||||
return inJellyfinPath;
|
||||
}
|
||||
|
||||
var values = Environment.GetEnvironmentVariable("PATH");
|
||||
|
||||
foreach (var path in values.Split(Path.PathSeparator))
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
overview = FFProbeHelpers.GetDictionaryValue(tags, "description");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(overview))
|
||||
{
|
||||
overview = FFProbeHelpers.GetDictionaryValue(tags, "desc");
|
||||
@@ -274,10 +275,12 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
ReadFromDictNode(subtree, info);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
reader.Skip();
|
||||
@@ -319,6 +322,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
ProcessPairs(currentKey, pairs, info);
|
||||
}
|
||||
|
||||
currentKey = reader.ReadElementContentAsString();
|
||||
pairs = new List<NameValuePair>();
|
||||
break;
|
||||
@@ -332,6 +336,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
Value = value
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
case "array":
|
||||
if (reader.IsEmptyElement)
|
||||
@@ -339,6 +344,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(currentKey))
|
||||
@@ -346,6 +352,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
pairs.AddRange(ReadValueArray(subtree));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
reader.Skip();
|
||||
@@ -381,6 +388,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
reader.Read();
|
||||
continue;
|
||||
}
|
||||
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
var dict = GetNameValuePair(subtree);
|
||||
@@ -389,6 +397,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
pairs.Add(dict);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
reader.Skip();
|
||||
@@ -948,6 +957,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
peoples.Add(new BaseItemPerson { Name = person, Type = PersonType.Composer });
|
||||
}
|
||||
|
||||
audio.People = peoples.ToArray();
|
||||
}
|
||||
|
||||
@@ -979,6 +989,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
peoples.Add(new BaseItemPerson { Name = person, Type = PersonType.Writer });
|
||||
}
|
||||
|
||||
audio.People = peoples.ToArray();
|
||||
}
|
||||
|
||||
@@ -1012,6 +1023,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
albumArtist = FFProbeHelpers.GetDictionaryValue(tags, "album artist");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(albumArtist))
|
||||
{
|
||||
albumArtist = FFProbeHelpers.GetDictionaryValue(tags, "album_artist");
|
||||
@@ -1175,6 +1187,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (info.AlbumArtists.Contains(studio, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
string line;
|
||||
while (reader.ReadLine() != "[Events]")
|
||||
{ }
|
||||
|
||||
var headers = ParseFieldHeaders(reader.ReadLine());
|
||||
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
@@ -56,6 +57,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
trackEvents.Add(subEvent);
|
||||
}
|
||||
}
|
||||
|
||||
trackInfo.TrackEvents = trackEvents.ToArray();
|
||||
return trackInfo;
|
||||
}
|
||||
@@ -112,11 +114,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
pre = s.Substring(0, 5) + "}";
|
||||
}
|
||||
|
||||
int indexOfEnd = p.Text.IndexOf('}');
|
||||
p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1);
|
||||
|
||||
indexOfBegin = p.Text.IndexOf('{');
|
||||
}
|
||||
|
||||
p.Text = pre + p.Text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var subEvent = new SubtitleTrackEvent { Id = line };
|
||||
line = reader.ReadLine();
|
||||
|
||||
@@ -52,6 +53,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
_logger.LogWarning("Unrecognized line in srt: {0}", line);
|
||||
continue;
|
||||
}
|
||||
|
||||
subEvent.StartPositionTicks = GetTicks(time[0]);
|
||||
var endTime = time[1];
|
||||
var idx = endTime.IndexOf(" ", StringComparison.Ordinal);
|
||||
@@ -65,8 +67,10 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
multiline.Add(line);
|
||||
}
|
||||
|
||||
subEvent.Text = string.Join(ParserValues.NewLine, multiline);
|
||||
subEvent.Text = subEvent.Text.Replace(@"\N", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase);
|
||||
subEvent.Text = Regex.Replace(subEvent.Text, @"\{(?:\\\d?[\w.-]+(?:\([^\)]*\)|&H?[0-9A-Fa-f]+&|))+\}", string.Empty, RegexOptions.IgnoreCase);
|
||||
@@ -76,6 +80,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
trackEvents.Add(subEvent);
|
||||
}
|
||||
}
|
||||
|
||||
trackInfo.TrackEvents = trackEvents.ToArray();
|
||||
return trackInfo;
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
|
||||
// subtitle.Renumber(1);
|
||||
}
|
||||
|
||||
trackInfo.TrackEvents = trackEvents.ToArray();
|
||||
return trackInfo;
|
||||
}
|
||||
@@ -302,6 +303,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
return count;
|
||||
index = text.IndexOf(tag, index + 1);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -329,6 +331,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
rest = string.Empty;
|
||||
}
|
||||
|
||||
extraTags += " size=\"" + fontSize.Substring(2) + "\"";
|
||||
}
|
||||
else if (rest.StartsWith("fn") && rest.Length > 2)
|
||||
@@ -344,6 +347,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
rest = string.Empty;
|
||||
}
|
||||
|
||||
extraTags += " face=\"" + fontName.Substring(2) + "\"";
|
||||
}
|
||||
else if (rest.StartsWith("c") && rest.Length > 2)
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(mediaSourceId))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mediaSourceId));
|
||||
@@ -271,8 +272,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
}
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public MediaProtocol Protocol { get; set; }
|
||||
|
||||
public string Format { get; set; }
|
||||
|
||||
public bool IsExternal { get; set; }
|
||||
}
|
||||
|
||||
@@ -287,10 +291,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
return new SrtParser(_logger);
|
||||
}
|
||||
|
||||
if (string.Equals(format, SubtitleFormat.SSA, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new SsaParser();
|
||||
}
|
||||
|
||||
if (string.Equals(format, SubtitleFormat.ASS, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new AssParser();
|
||||
@@ -315,14 +321,17 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
return new JsonWriter();
|
||||
}
|
||||
|
||||
if (string.Equals(format, SubtitleFormat.SRT, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new SrtWriter();
|
||||
}
|
||||
|
||||
if (string.Equals(format, SubtitleFormat.VTT, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new VttWriter();
|
||||
}
|
||||
|
||||
if (string.Equals(format, SubtitleFormat.TTML, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new TtmlWriter();
|
||||
|
||||
Reference in New Issue
Block a user