Fix: parsing of xbmc style multi episode nfo files (#12268)

This commit is contained in:
TheMelmacian
2024-07-30 17:51:08 +02:00
committed by GitHub
parent 0a1a109b2e
commit d4eeafe53f
5 changed files with 190 additions and 54 deletions

View File

@@ -123,6 +123,30 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
Assert.Equal(2004, item.ProductionYear);
}
[Fact]
public void Fetch_Valid_MultiEpisode_With_Missing_Tags_Success()
{
var result = new MetadataResult<Episode>()
{
Item = new Episode()
};
_parser.Fetch(result, "Test Data/Stargate Atlantis S01E01-E04.nfo", CancellationToken.None);
var item = result.Item;
// <title> provided for episode 1, 3 and 4
Assert.Equal("Rising / Hide and Seek / Thirty-Eight Minutes", item.Name);
// <originaltitle> provided for all episodes
Assert.Equal("Rising (1) / Rising (2) / Hide and Seek / Thirty-Eight Minutes", item.OriginalTitle);
Assert.Equal(1, item.IndexNumber);
Assert.Equal(4, item.IndexNumberEnd);
Assert.Equal(1, item.ParentIndexNumber);
// <plot> only provided for episode 1
Assert.Equal("A new Stargate team embarks on a dangerous mission to a distant galaxy, where they discover a mythical lost city -- and a deadly new enemy.", item.Overview);
Assert.Equal(new DateTime(2004, 7, 16), item.PremiereDate);
Assert.Equal(2004, item.ProductionYear);
}
[Fact]
public void Parse_GivenFileWithThumbWithoutAspect_Success()
{

View File

@@ -7,6 +7,18 @@
<thumb>https://artworks.thetvdb.com/banners/episodes/70851/25333.jpg</thumb>
<watched>false</watched>
<rating>8.0</rating>
<actor>
<name>Joe Flanigan</name>
<role>John Sheppard</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/5AA1ORKIsnMakT6fCVy3JKlzMs6.jpg</thumb>
</actor>
<actor>
<name>David Hewlett</name>
<role>Rodney McKay</role>
<order>1</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/hUcYyssAPCqnZ4GjolhOWXHTWSa.jpg</thumb>
</actor>
</episodedetails>
<episodedetails>
<title>Rising (2)</title>
@@ -17,4 +29,16 @@
<thumb>https://artworks.thetvdb.com/banners/episodes/70851/25334.jpg</thumb>
<watched>false</watched>
<rating>7.9</rating>
<actor>
<name>Joe Flanigan</name>
<role>John Sheppard</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/5AA1ORKIsnMakT6fCVy3JKlzMs6.jpg</thumb>
</actor>
<actor>
<name>David Hewlett</name>
<role>Rodney McKay</role>
<order>1</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/hUcYyssAPCqnZ4GjolhOWXHTWSa.jpg</thumb>
</actor>
</episodedetails>

View File

@@ -0,0 +1,89 @@
<episodedetails>
<title>Rising</title>
<originaltitle>Rising (1)</originaltitle>
<season>1</season>
<episode>1</episode>
<aired>2004-07-16</aired>
<plot>A new Stargate team embarks on a dangerous mission to a distant galaxy, where they discover a mythical lost city -- and a deadly new enemy.</plot>
<thumb>https://artworks.thetvdb.com/banners/episodes/70851/25333.jpg</thumb>
<watched>false</watched>
<rating>8.0</rating>
<actor>
<name>Joe Flanigan</name>
<role>John Sheppard</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/5AA1ORKIsnMakT6fCVy3JKlzMs6.jpg</thumb>
</actor>
<actor>
<name>David Hewlett</name>
<role>Rodney McKay</role>
<order>1</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/hUcYyssAPCqnZ4GjolhOWXHTWSa.jpg</thumb>
</actor>
</episodedetails>
<episodedetails>
<originaltitle>Rising (2)</originaltitle>
<season>1</season>
<episode>2</episode>
<aired>2004-07-16</aired>
<thumb>https://artworks.thetvdb.com/banners/episodes/70851/25334.jpg</thumb>
<watched>false</watched>
<rating>7.9</rating>
<actor>
<name>Joe Flanigan</name>
<role>John Sheppard</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/5AA1ORKIsnMakT6fCVy3JKlzMs6.jpg</thumb>
</actor>
<actor>
<name>David Hewlett</name>
<role>Rodney McKay</role>
<order>1</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/hUcYyssAPCqnZ4GjolhOWXHTWSa.jpg</thumb>
</actor>
</episodedetails>
<episodedetails>
<title>Hide and Seek</title>
<originaltitle>Hide and Seek</originaltitle>
<season>1</season>
<episode>3</episode>
<aired>2004-07-23</aired>
<thumb>https://artworks.thetvdb.com/banners/episodes/70851/25335.jpg</thumb>
<watched>false</watched>
<rating>7.5</rating>
<actor>
<name>Joe Flanigan</name>
<role>John Sheppard</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/5AA1ORKIsnMakT6fCVy3JKlzMs6.jpg</thumb>
</actor>
<actor>
<name>David Hewlett</name>
<role>Rodney McKay</role>
<order>1</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/hUcYyssAPCqnZ4GjolhOWXHTWSa.jpg</thumb>
</actor>
</episodedetails>
<episodedetails>
<title>Thirty-Eight Minutes</title>
<originaltitle>Thirty-Eight Minutes</originaltitle>
<season>1</season>
<episode>4</episode>
<aired>2004-07-23</aired>
<thumb>https://artworks.thetvdb.com/banners/episodes/70851/25336.jpg</thumb>
<watched>false</watched>
<rating>7.5</rating>
<actor>
<name>Joe Flanigan</name>
<role>John Sheppard</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/5AA1ORKIsnMakT6fCVy3JKlzMs6.jpg</thumb>
</actor>
<actor>
<name>David Hewlett</name>
<role>Rodney McKay</role>
<order>1</order>
<thumb>https://image.tmdb.org/t/p/w300_and_h450_bestv2/hUcYyssAPCqnZ4GjolhOWXHTWSa.jpg</thumb>
</actor>
</episodedetails>