support episodedetails and musicvideo as top-level other video nfo tags (#2098)

This commit is contained in:
Jason Dove
2025-07-01 02:59:18 +00:00
committed by GitHub
parent 3e07bc6136
commit e2ffa70529
3 changed files with 36 additions and 13 deletions
+2
View File
@@ -58,6 +58,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- Allow `Other Video` libraries and `Image` libraries to use the same folders
- Try to mitigate inotify limit error by disabling automatic reloading of `appsettings.json` config files
- Support `movie`, `musicvideo` and `episodedetails` top-level tags in other video NFO files
- Note that no change has been made to the metadata tags that are actually parsed, but this should help with various types of content
### Fixed
- Fix QSV acceleration in docker with older Intel devices
@@ -33,9 +33,12 @@ public class OtherVideoNfoReaderTests
}
[Test]
public async Task MetadataNfo_Should_Return_Nfo()
[TestCase("movie")]
[TestCase("episodedetails")]
[TestCase("musicvideo")]
public async Task MetadataNfo_Should_Return_Nfo(string topLevel)
{
await using var stream = new MemoryStream(Encoding.UTF8.GetBytes(@"<movie></movie>"));
await using var stream = new MemoryStream(Encoding.UTF8.GetBytes(@$"<{topLevel}></{topLevel}>"));
Either<BaseError, OtherVideoNfo> result = await _otherVideoNfoReader.Read(stream);
@@ -43,11 +46,14 @@ public class OtherVideoNfoReaderTests
}
[Test]
public async Task CombinationNfo_Should_Return_Nfo()
[TestCase("movie")]
[TestCase("episodedetails")]
[TestCase("musicvideo")]
public async Task CombinationNfo_Should_Return_Nfo(string topLevel)
{
await using var stream = new MemoryStream(
Encoding.UTF8.GetBytes(
@"<movie></movie>
@$"<{topLevel}></{topLevel}>
https://www.themoviedb.org/movie/11-star-wars"));
Either<BaseError, OtherVideoNfo> result = await _otherVideoNfoReader.Read(stream);
@@ -56,12 +62,15 @@ https://www.themoviedb.org/movie/11-star-wars"));
}
[Test]
public async Task FullSample_Should_Return_Nfo()
[TestCase("movie")]
[TestCase("episodedetails")]
[TestCase("musicvideo")]
public async Task FullSample_Should_Return_Nfo(string topLevel)
{
await using var stream = new MemoryStream(
Encoding.UTF8.GetBytes(
@"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes"" ?>
<movie>
@$"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes"" ?>
<{topLevel}>
<title>Zack Snyder&apos;s Justice League</title>
<originaltitle>Zack Snyder&apos;s Justice League</originaltitle>
<sorttitle>Justice League 2</sorttitle>
@@ -166,7 +175,7 @@ https://www.themoviedb.org/movie/11-star-wars"));
<total>0.000000</total>
</resume>
<dateadded>2021-03-26 11:35:50</dateadded>
</movie>"));
</{topLevel}>"));
Either<BaseError, OtherVideoNfo> result = await _otherVideoNfoReader.Read(stream);
@@ -223,9 +232,12 @@ https://www.themoviedb.org/movie/11-star-wars"));
}
[Test]
public async Task MetadataNfo_With_Tag_Should_Return_Nfo()
[TestCase("movie")]
[TestCase("episodedetails")]
[TestCase("musicvideo")]
public async Task MetadataNfo_With_Tag_Should_Return_Nfo(string topLevel)
{
await using var stream = new MemoryStream(Encoding.UTF8.GetBytes(@"<movie><tag>Test Tag</tag></movie>"));
await using var stream = new MemoryStream(Encoding.UTF8.GetBytes(@$"<{topLevel}><tag>Test Tag</tag></{topLevel}>"));
Either<BaseError, OtherVideoNfo> result = await _otherVideoNfoReader.Read(stream);
@@ -237,10 +249,13 @@ https://www.themoviedb.org/movie/11-star-wars"));
}
[Test]
public async Task MetadataNfo_With_Outline_Should_Return_Nfo()
[TestCase("movie")]
[TestCase("episodedetails")]
[TestCase("musicvideo")]
public async Task MetadataNfo_With_Outline_Should_Return_Nfo(string topLevel)
{
await using var stream =
new MemoryStream(Encoding.UTF8.GetBytes(@"<movie><outline>Test Outline</outline></movie>"));
new MemoryStream(Encoding.UTF8.GetBytes(@$"<{topLevel}><outline>Test Outline</outline></{topLevel}>"));
Either<BaseError, OtherVideoNfo> result = await _otherVideoNfoReader.Read(stream);
@@ -49,7 +49,13 @@ public class OtherVideoNfoReader : NfoReader<OtherVideoNfo>, IOtherVideoNfoReade
case XmlNodeType.Element:
switch (reader.Name.ToLowerInvariant())
{
case "episodedetails":
case "movie":
case "musicvideo":
if (nfo is not null)
{
throw new InvalidOperationException("Cannot have multiple opening tags");
}
nfo = new OtherVideoNfo();
break;
case "title":
@@ -107,7 +113,7 @@ public class OtherVideoNfoReader : NfoReader<OtherVideoNfo>, IOtherVideoNfoReade
break;
case XmlNodeType.EndElement:
if (reader.Name == "movie")
if (reader.Name is "episodedetails" or "movie" or "musicvideo")
{
done = true;
}