mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-04-27 03:53:10 -04:00
fix(search): add jellyfin-compatible external item fields
CI / build-and-test (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
This commit is contained in:
@@ -47,6 +47,8 @@ public class JellyfinResponseBuilderTests
|
|||||||
Assert.Equal(1, result["ParentIndexNumber"]);
|
Assert.Equal(1, result["ParentIndexNumber"]);
|
||||||
Assert.Equal(2023, result["ProductionYear"]);
|
Assert.Equal(2023, result["ProductionYear"]);
|
||||||
Assert.Equal(245 * TimeSpan.TicksPerSecond, result["RunTimeTicks"]);
|
Assert.Equal(245 * TimeSpan.TicksPerSecond, result["RunTimeTicks"]);
|
||||||
|
Assert.NotNull(result["AudioInfo"]);
|
||||||
|
Assert.Equal(false, result["CanDelete"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -192,6 +194,9 @@ public class JellyfinResponseBuilderTests
|
|||||||
Assert.Equal("Famous Band", result["AlbumArtist"]);
|
Assert.Equal("Famous Band", result["AlbumArtist"]);
|
||||||
Assert.Equal(2020, result["ProductionYear"]);
|
Assert.Equal(2020, result["ProductionYear"]);
|
||||||
Assert.Equal(12, result["ChildCount"]);
|
Assert.Equal(12, result["ChildCount"]);
|
||||||
|
Assert.Equal("Greatest Hits", result["SortName"]);
|
||||||
|
Assert.NotNull(result["DateCreated"]);
|
||||||
|
Assert.NotNull(result["BasicSyncInfo"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -215,6 +220,9 @@ public class JellyfinResponseBuilderTests
|
|||||||
Assert.Equal("MusicArtist", result["Type"]);
|
Assert.Equal("MusicArtist", result["Type"]);
|
||||||
Assert.Equal(true, result["IsFolder"]);
|
Assert.Equal(true, result["IsFolder"]);
|
||||||
Assert.Equal(5, result["AlbumCount"]);
|
Assert.Equal(5, result["AlbumCount"]);
|
||||||
|
Assert.Equal("The Rockers", result["SortName"]);
|
||||||
|
Assert.Equal(1.0, result["PrimaryImageAspectRatio"]);
|
||||||
|
Assert.NotNull(result["BasicSyncInfo"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -243,6 +251,9 @@ public class JellyfinResponseBuilderTests
|
|||||||
Assert.Equal("DJ Cool", result["AlbumArtist"]);
|
Assert.Equal("DJ Cool", result["AlbumArtist"]);
|
||||||
Assert.Equal(50, result["ChildCount"]);
|
Assert.Equal(50, result["ChildCount"]);
|
||||||
Assert.Equal(2023, result["ProductionYear"]);
|
Assert.Equal(2023, result["ProductionYear"]);
|
||||||
|
Assert.Equal("Summer Vibes [S/P]", result["SortName"]);
|
||||||
|
Assert.NotNull(result["DateCreated"]);
|
||||||
|
Assert.NotNull(result["BasicSyncInfo"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -355,6 +355,7 @@ public class JellyfinResponseBuilder
|
|||||||
["Tags"] = new string[0],
|
["Tags"] = new string[0],
|
||||||
["People"] = new object[0],
|
["People"] = new object[0],
|
||||||
["SortName"] = songTitle,
|
["SortName"] = songTitle,
|
||||||
|
["AudioInfo"] = new Dictionary<string, object?>(),
|
||||||
["ParentLogoItemId"] = song.AlbumId,
|
["ParentLogoItemId"] = song.AlbumId,
|
||||||
["ParentBackdropItemId"] = song.AlbumId,
|
["ParentBackdropItemId"] = song.AlbumId,
|
||||||
["ParentBackdropImageTags"] = new string[0],
|
["ParentBackdropImageTags"] = new string[0],
|
||||||
@@ -405,6 +406,7 @@ public class JellyfinResponseBuilder
|
|||||||
["MediaType"] = "Audio",
|
["MediaType"] = "Audio",
|
||||||
["NormalizationGain"] = 0.0,
|
["NormalizationGain"] = 0.0,
|
||||||
["Path"] = $"/music/{song.Artist}/{song.Album}/{song.Title}.flac",
|
["Path"] = $"/music/{song.Artist}/{song.Album}/{song.Title}.flac",
|
||||||
|
["CanDelete"] = false,
|
||||||
["CanDownload"] = true,
|
["CanDownload"] = true,
|
||||||
["SupportsSync"] = true
|
["SupportsSync"] = true
|
||||||
};
|
};
|
||||||
@@ -539,6 +541,7 @@ public class JellyfinResponseBuilder
|
|||||||
["ServerId"] = "allstarr",
|
["ServerId"] = "allstarr",
|
||||||
["Id"] = album.Id,
|
["Id"] = album.Id,
|
||||||
["PremiereDate"] = album.Year.HasValue ? $"{album.Year}-01-01T05:00:00.0000000Z" : null,
|
["PremiereDate"] = album.Year.HasValue ? $"{album.Year}-01-01T05:00:00.0000000Z" : null,
|
||||||
|
["DateCreated"] = album.Year.HasValue ? $"{album.Year}-01-01T05:00:00.0000000Z" : "1970-01-01T00:00:00.0000000Z",
|
||||||
["ChannelId"] = (object?)null,
|
["ChannelId"] = (object?)null,
|
||||||
["Genres"] = !string.IsNullOrEmpty(album.Genre)
|
["Genres"] = !string.IsNullOrEmpty(album.Genre)
|
||||||
? new[] { album.Genre }
|
? new[] { album.Genre }
|
||||||
@@ -547,6 +550,8 @@ public class JellyfinResponseBuilder
|
|||||||
["ProductionYear"] = album.Year,
|
["ProductionYear"] = album.Year,
|
||||||
["IsFolder"] = true,
|
["IsFolder"] = true,
|
||||||
["Type"] = "MusicAlbum",
|
["Type"] = "MusicAlbum",
|
||||||
|
["SortName"] = albumName,
|
||||||
|
["BasicSyncInfo"] = new Dictionary<string, object?>(),
|
||||||
["GenreItems"] = !string.IsNullOrEmpty(album.Genre)
|
["GenreItems"] = !string.IsNullOrEmpty(album.Genre)
|
||||||
? new[]
|
? new[]
|
||||||
{
|
{
|
||||||
@@ -633,6 +638,9 @@ public class JellyfinResponseBuilder
|
|||||||
["RunTimeTicks"] = 0,
|
["RunTimeTicks"] = 0,
|
||||||
["IsFolder"] = true,
|
["IsFolder"] = true,
|
||||||
["Type"] = "MusicArtist",
|
["Type"] = "MusicArtist",
|
||||||
|
["SortName"] = artistName,
|
||||||
|
["PrimaryImageAspectRatio"] = 1.0,
|
||||||
|
["BasicSyncInfo"] = new Dictionary<string, object?>(),
|
||||||
["GenreItems"] = new Dictionary<string, object?>[0],
|
["GenreItems"] = new Dictionary<string, object?>[0],
|
||||||
["UserData"] = new Dictionary<string, object>
|
["UserData"] = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
@@ -755,6 +763,11 @@ public class JellyfinResponseBuilder
|
|||||||
["RunTimeTicks"] = playlist.Duration * TimeSpan.TicksPerSecond,
|
["RunTimeTicks"] = playlist.Duration * TimeSpan.TicksPerSecond,
|
||||||
["IsFolder"] = true,
|
["IsFolder"] = true,
|
||||||
["Type"] = "MusicAlbum",
|
["Type"] = "MusicAlbum",
|
||||||
|
["SortName"] = $"{playlist.Name} [S/P]",
|
||||||
|
["DateCreated"] = playlist.CreatedDate.HasValue
|
||||||
|
? playlist.CreatedDate.Value.ToString("o")
|
||||||
|
: "1970-01-01T00:00:00.0000000Z",
|
||||||
|
["BasicSyncInfo"] = new Dictionary<string, object?>(),
|
||||||
["GenreItems"] = new Dictionary<string, object?>[0],
|
["GenreItems"] = new Dictionary<string, object?>[0],
|
||||||
["UserData"] = new Dictionary<string, object>
|
["UserData"] = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user