Run tree-wide dotnet format

This commit is contained in:
jakobkukla
2026-04-16 11:38:01 +02:00
parent e63bc1e27c
commit 37350282cc
92 changed files with 466 additions and 465 deletions

View File

@@ -143,16 +143,16 @@ namespace MediaBrowser.LocalMetadata.Parsers
item.Name = reader.ReadNormalizedString();
break;
case "CriticRating":
{
var text = reader.ReadElementContentAsString();
if (float.TryParse(text, CultureInfo.InvariantCulture, out var value))
{
item.CriticRating = value;
}
var text = reader.ReadElementContentAsString();
break;
}
if (float.TryParse(text, CultureInfo.InvariantCulture, out var value))
{
item.CriticRating = value;
}
break;
}
case "SortTitle":
item.ForcedSortName = reader.ReadNormalizedString();
@@ -176,55 +176,55 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
case "LockedFields":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
item.LockedFields = val.Split('|').Select(i =>
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
if (Enum.TryParse(i, true, out MetadataField field))
item.LockedFields = val.Split('|').Select(i =>
{
return (MetadataField?)field;
}
if (Enum.TryParse(i, true, out MetadataField field))
{
return (MetadataField?)field;
}
return null;
}).Where(i => i.HasValue).Select(i => i!.Value).ToArray();
return null;
}).Where(i => i.HasValue).Select(i => i!.Value).ToArray();
}
break;
}
break;
}
case "TagLines":
{
if (!reader.IsEmptyElement)
{
using (var subtree = reader.ReadSubtree())
if (!reader.IsEmptyElement)
{
FetchFromTaglinesNode(subtree, item);
using (var subtree = reader.ReadSubtree())
{
FetchFromTaglinesNode(subtree, item);
}
}
else
{
reader.Read();
}
}
else
{
reader.Read();
}
break;
}
break;
}
case "Countries":
{
if (!reader.IsEmptyElement)
{
reader.Skip();
}
else
{
reader.Read();
}
if (!reader.IsEmptyElement)
{
reader.Skip();
}
else
{
reader.Read();
}
break;
}
break;
}
case "ContentRating":
case "MPAARating":
@@ -307,19 +307,19 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
case "Trailers":
{
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchDataFromTrailersNode(subtree, item);
}
else
{
reader.Read();
}
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchDataFromTrailersNode(subtree, item);
}
else
{
reader.Read();
}
break;
}
break;
}
case "ProductionYear":
if (reader.TryReadInt(out var productionYear) && productionYear > 1850)
@@ -330,20 +330,20 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
case "Rating":
case "IMDBrating":
{
var rating = reader.ReadNormalizedString();
if (!string.IsNullOrEmpty(rating))
{
// All external meta is saving this as '.' for decimal I believe...but just to be sure
if (float.TryParse(rating.Replace(',', '.'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var val))
{
item.CommunityRating = val;
}
}
var rating = reader.ReadNormalizedString();
break;
}
if (!string.IsNullOrEmpty(rating))
{
// All external meta is saving this as '.' for decimal I believe...but just to be sure
if (float.TryParse(rating.Replace(',', '.'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var val))
{
item.CommunityRating = val;
}
}
break;
}
case "BirthDate":
case "PremiereDate":
@@ -370,144 +370,144 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
case "Genres":
{
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchFromGenresNode(subtree, item);
}
else
{
reader.Read();
}
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchFromGenresNode(subtree, item);
}
else
{
reader.Read();
}
break;
}
break;
}
case "Tags":
{
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchFromTagsNode(subtree, item);
}
else
{
reader.Read();
}
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchFromTagsNode(subtree, item);
}
else
{
reader.Read();
}
break;
}
break;
}
case "Persons":
{
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchDataFromPersonsNode(subtree, itemResult);
}
else
{
reader.Read();
}
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchDataFromPersonsNode(subtree, itemResult);
}
else
{
reader.Read();
}
break;
}
break;
}
case "Studios":
{
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchFromStudiosNode(subtree, item);
}
else
{
reader.Read();
}
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
FetchFromStudiosNode(subtree, item);
}
else
{
reader.Read();
}
break;
}
break;
}
case "Shares":
{
if (!reader.IsEmptyElement)
{
using var subtree = reader.ReadSubtree();
if (item is IHasShares hasShares)
if (!reader.IsEmptyElement)
{
FetchFromSharesNode(subtree, hasShares);
using var subtree = reader.ReadSubtree();
if (item is IHasShares hasShares)
{
FetchFromSharesNode(subtree, hasShares);
}
}
else
{
reader.Read();
}
}
else
{
reader.Read();
}
break;
}
break;
}
case "OwnerUserId":
{
var val = reader.ReadNormalizedString();
if (Guid.TryParse(val, out var guid) && !guid.Equals(Guid.Empty))
{
if (item is Playlist playlist)
{
playlist.OwnerUserId = guid;
}
}
var val = reader.ReadNormalizedString();
break;
}
if (Guid.TryParse(val, out var guid) && !guid.Equals(Guid.Empty))
{
if (item is Playlist playlist)
{
playlist.OwnerUserId = guid;
}
}
break;
}
case "Format3D":
{
var val = reader.ReadNormalizedString();
if (item is Video video)
{
if (string.Equals("HSBS", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.HalfSideBySide;
}
else if (string.Equals("HTAB", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
}
else if (string.Equals("FTAB", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.FullTopAndBottom;
}
else if (string.Equals("FSBS", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.FullSideBySide;
}
else if (string.Equals("MVC", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.MVC;
}
}
var val = reader.ReadNormalizedString();
break;
}
if (item is Video video)
{
if (string.Equals("HSBS", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.HalfSideBySide;
}
else if (string.Equals("HTAB", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.HalfTopAndBottom;
}
else if (string.Equals("FTAB", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.FullTopAndBottom;
}
else if (string.Equals("FSBS", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.FullSideBySide;
}
else if (string.Equals("MVC", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.MVC;
}
}
break;
}
default:
{
string readerName = reader.Name;
if (_validProviderIds!.TryGetValue(readerName, out string? providerIdValue))
{
var id = reader.ReadNormalizedString();
item.TrySetProviderId(providerIdValue, id);
}
else
{
reader.Skip();
}
string readerName = reader.Name;
if (_validProviderIds!.TryGetValue(readerName, out string? providerIdValue))
{
var id = reader.ReadNormalizedString();
item.TrySetProviderId(providerIdValue, id);
}
else
{
reader.Skip();
}
break;
}
break;
}
}
}
@@ -526,31 +526,31 @@ namespace MediaBrowser.LocalMetadata.Parsers
switch (reader.Name)
{
case "Share":
{
if (reader.IsEmptyElement)
{
reader.Read();
continue;
}
using (var subReader = reader.ReadSubtree())
{
var child = GetShare(subReader);
if (child is not null)
if (reader.IsEmptyElement)
{
list.Add(child);
reader.Read();
continue;
}
}
break;
}
using (var subReader = reader.ReadSubtree())
{
var child = GetShare(subReader);
if (child is not null)
{
list.Add(child);
}
}
break;
}
default:
{
reader.Skip();
break;
}
{
reader.Skip();
break;
}
}
}
else

View File

@@ -64,32 +64,32 @@ namespace MediaBrowser.LocalMetadata.Parsers
switch (reader.Name)
{
case "CollectionItem":
{
if (!reader.IsEmptyElement)
{
using (var subReader = reader.ReadSubtree())
if (!reader.IsEmptyElement)
{
var child = GetLinkedChild(subReader);
if (child is not null)
using (var subReader = reader.ReadSubtree())
{
list.Add(child);
var child = GetLinkedChild(subReader);
if (child is not null)
{
list.Add(child);
}
}
}
}
else
{
reader.Read();
}
else
{
reader.Read();
}
break;
}
break;
}
default:
{
reader.Skip();
break;
}
{
reader.Skip();
break;
}
}
}
else

View File

@@ -76,25 +76,25 @@ namespace MediaBrowser.LocalMetadata.Parsers
switch (reader.Name)
{
case "PlaylistItem":
{
if (reader.IsEmptyElement)
{
reader.Read();
continue;
}
using (var subReader = reader.ReadSubtree())
{
var child = GetLinkedChild(subReader);
if (child is not null)
if (reader.IsEmptyElement)
{
list.Add(child);
reader.Read();
continue;
}
}
break;
}
using (var subReader = reader.ReadSubtree())
{
var child = GetLinkedChild(subReader);
if (child is not null)
{
list.Add(child);
}
}
break;
}
default:
reader.Skip();