mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add full test coverage to Jellyfin (#86974)
* Add full test coverage * Remove unreachable exception * Remove comment line. Conflicting with codecov * Use auto fixture and syrupy
This commit is contained in:
parent
d202b7c3c7
commit
1aecbb9bd5
@ -21,7 +21,6 @@ from homeassistant.core import HomeAssistant
|
||||
from .const import (
|
||||
COLLECTION_TYPE_MOVIES,
|
||||
COLLECTION_TYPE_MUSIC,
|
||||
COLLECTION_TYPE_TVSHOWS,
|
||||
DOMAIN,
|
||||
ITEM_KEY_COLLECTION_TYPE,
|
||||
ITEM_KEY_ID,
|
||||
@ -155,10 +154,7 @@ class JellyfinSource(MediaSource):
|
||||
return await self._build_music_library(library, include_children)
|
||||
if collection_type == COLLECTION_TYPE_MOVIES:
|
||||
return await self._build_movie_library(library, include_children)
|
||||
if collection_type == COLLECTION_TYPE_TVSHOWS:
|
||||
return await self._build_tv_library(library, include_children)
|
||||
|
||||
raise BrowseError(f"Unsupported collection type {collection_type}")
|
||||
return await self._build_tv_library(library, include_children)
|
||||
|
||||
async def _build_music_library(
|
||||
self, library: dict[str, Any], include_children: bool
|
||||
|
@ -74,6 +74,8 @@ def mock_api() -> MagicMock:
|
||||
jf_api.sessions.return_value = load_json_fixture("sessions.json")
|
||||
|
||||
jf_api.artwork.side_effect = api_artwork_side_effect
|
||||
jf_api.audio_url.side_effect = api_audio_url_side_effect
|
||||
jf_api.video_url.side_effect = api_video_url_side_effect
|
||||
jf_api.user_items.side_effect = api_user_items_side_effect
|
||||
jf_api.get_item.side_effect = api_get_item_side_effect
|
||||
jf_api.get_media_folders.return_value = load_json_fixture("get-media-folders.json")
|
||||
@ -86,7 +88,7 @@ def mock_api() -> MagicMock:
|
||||
def mock_config() -> MagicMock:
|
||||
"""Return a mocked JellyfinClient."""
|
||||
jf_config = create_autospec(Config)
|
||||
jf_config.data = {}
|
||||
jf_config.data = {"auth.server": "http://localhost"}
|
||||
|
||||
return jf_config
|
||||
|
||||
@ -138,6 +140,18 @@ def api_artwork_side_effect(*args, **kwargs):
|
||||
return f"http://localhost/Items/{item_id}/Images/{art}.{ext}"
|
||||
|
||||
|
||||
def api_audio_url_side_effect(*args, **kwargs):
|
||||
"""Handle variable responses for audio_url method."""
|
||||
item_id = args[0]
|
||||
return f"http://localhost/Audio/{item_id}/universal?UserId=test-username,DeviceId=TEST-UUID,MaxStreamingBitrate=140000000"
|
||||
|
||||
|
||||
def api_video_url_side_effect(*args, **kwargs):
|
||||
"""Handle variable responses for video_url method."""
|
||||
item_id = args[0]
|
||||
return f"http://localhost/Videos/{item_id}/stream?static=true,DeviceId=TEST-UUID,api_key=TEST-API-KEY"
|
||||
|
||||
|
||||
def api_get_item_side_effect(*args):
|
||||
"""Handle variable responses for get_item method."""
|
||||
return load_json_fixture("get-item-collection.json")
|
||||
|
12
tests/components/jellyfin/fixtures/album.json
Normal file
12
tests/components/jellyfin/fixtures/album.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "ALBUM-UUID",
|
||||
"ImageTags": {},
|
||||
"IsFolder": true,
|
||||
"Name": "ALBUM",
|
||||
"PrimaryImageAspectRatio": 1,
|
||||
"ServerId": "ServerId",
|
||||
"Type": "MusicAlbum"
|
||||
}
|
16
tests/components/jellyfin/fixtures/albums.json
Normal file
16
tests/components/jellyfin/fixtures/albums.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "ALBUM-UUID",
|
||||
"ImageTags": {},
|
||||
"IsFolder": true,
|
||||
"Name": "ALBUM",
|
||||
"PrimaryImageAspectRatio": 1,
|
||||
"ServerId": "ServerId",
|
||||
"Type": "MusicAlbum"
|
||||
}
|
||||
]
|
||||
}
|
15
tests/components/jellyfin/fixtures/artist.json
Normal file
15
tests/components/jellyfin/fixtures/artist.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"AlbumCount": 1,
|
||||
"Id": "ARTIST-UUID",
|
||||
"ImageTags": {
|
||||
"Logo": "string",
|
||||
"Primary": "string"
|
||||
},
|
||||
"IsFolder": true,
|
||||
"Name": "ARTIST",
|
||||
"ParentId": "MUSIC-COLLECTION-FOLDER-UUID",
|
||||
"Path": "/media/music/artist",
|
||||
"PrimaryImageAspectRatio": 1,
|
||||
"ServerId": "string",
|
||||
"Type": "MusicArtist"
|
||||
}
|
19
tests/components/jellyfin/fixtures/artists.json
Normal file
19
tests/components/jellyfin/fixtures/artists.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"AlbumCount": 1,
|
||||
"Id": "ARTIST-UUID",
|
||||
"ImageTags": {
|
||||
"Logo": "string",
|
||||
"Primary": "string"
|
||||
},
|
||||
"IsFolder": true,
|
||||
"Name": "ARTIST",
|
||||
"ParentId": "MUSIC-COLLECTION-FOLDER-UUID",
|
||||
"Path": "/media/music/artist",
|
||||
"PrimaryImageAspectRatio": 1,
|
||||
"ServerId": "string",
|
||||
"Type": "MusicArtist"
|
||||
}
|
||||
]
|
||||
}
|
504
tests/components/jellyfin/fixtures/episode.json
Normal file
504
tests/components/jellyfin/fixtures/episode.json
Normal file
@ -0,0 +1,504 @@
|
||||
{
|
||||
"Name": "EPISODE",
|
||||
"OriginalTitle": "string",
|
||||
"ServerId": "SERVER-UUID",
|
||||
"Id": "EPISODE-UUID",
|
||||
"Etag": "string",
|
||||
"SourceType": "string",
|
||||
"PlaylistItemId": "string",
|
||||
"DateCreated": "2019-08-24T14:15:22Z",
|
||||
"DateLastMediaAdded": "2019-08-24T14:15:22Z",
|
||||
"ExtraType": "string",
|
||||
"AirsBeforeSeasonNumber": 0,
|
||||
"AirsAfterSeasonNumber": 0,
|
||||
"AirsBeforeEpisodeNumber": 0,
|
||||
"CanDelete": true,
|
||||
"CanDownload": true,
|
||||
"HasSubtitles": true,
|
||||
"PreferredMetadataLanguage": "string",
|
||||
"PreferredMetadataCountryCode": "string",
|
||||
"SupportsSync": true,
|
||||
"Container": "string",
|
||||
"SortName": "string",
|
||||
"ForcedSortName": "string",
|
||||
"Video3DFormat": "HalfSideBySide",
|
||||
"PremiereDate": "2019-08-24T14:15:22Z",
|
||||
"ExternalUrls": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Url": "string"
|
||||
}
|
||||
],
|
||||
"MediaSources": [
|
||||
{
|
||||
"Protocol": "File",
|
||||
"Id": "string",
|
||||
"Path": "/media/tvshows/Series/Season 01/S01E01.mp4",
|
||||
"EncoderPath": "string",
|
||||
"EncoderProtocol": "File",
|
||||
"Type": "Default",
|
||||
"Container": "string",
|
||||
"Size": 0,
|
||||
"Name": "string",
|
||||
"IsRemote": true,
|
||||
"ETag": "string",
|
||||
"RunTimeTicks": 0,
|
||||
"ReadAtNativeFramerate": true,
|
||||
"IgnoreDts": true,
|
||||
"IgnoreIndex": true,
|
||||
"GenPtsInput": true,
|
||||
"SupportsTranscoding": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsDirectPlay": true,
|
||||
"IsInfiniteStream": true,
|
||||
"RequiresOpening": true,
|
||||
"OpenToken": "string",
|
||||
"RequiresClosing": true,
|
||||
"LiveStreamId": "string",
|
||||
"BufferMs": 0,
|
||||
"RequiresLooping": true,
|
||||
"SupportsProbing": true,
|
||||
"VideoType": "VideoFile",
|
||||
"IsoType": "Dvd",
|
||||
"Video3DFormat": "HalfSideBySide",
|
||||
"MediaStreams": [
|
||||
{
|
||||
"Codec": "string",
|
||||
"CodecTag": "string",
|
||||
"Language": "string",
|
||||
"ColorRange": "string",
|
||||
"ColorSpace": "string",
|
||||
"ColorTransfer": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"DvVersionMajor": 0,
|
||||
"DvVersionMinor": 0,
|
||||
"DvProfile": 0,
|
||||
"DvLevel": 0,
|
||||
"RpuPresentFlag": 0,
|
||||
"ElPresentFlag": 0,
|
||||
"BlPresentFlag": 0,
|
||||
"DvBlSignalCompatibilityId": 0,
|
||||
"Comment": "string",
|
||||
"TimeBase": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"Title": "string",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"VideoDoViTitle": "string",
|
||||
"LocalizedUndefined": "string",
|
||||
"LocalizedDefault": "string",
|
||||
"LocalizedForced": "string",
|
||||
"LocalizedExternal": "string",
|
||||
"DisplayTitle": "string",
|
||||
"NalLengthSize": "string",
|
||||
"IsInterlaced": true,
|
||||
"IsAVC": true,
|
||||
"ChannelLayout": "string",
|
||||
"BitRate": 0,
|
||||
"BitDepth": 0,
|
||||
"RefFrames": 0,
|
||||
"PacketLength": 0,
|
||||
"Channels": 0,
|
||||
"SampleRate": 0,
|
||||
"IsDefault": true,
|
||||
"IsForced": true,
|
||||
"Height": 0,
|
||||
"Width": 0,
|
||||
"AverageFrameRate": 0,
|
||||
"RealFrameRate": 0,
|
||||
"Profile": "string",
|
||||
"Type": "Audio",
|
||||
"AspectRatio": "string",
|
||||
"Index": 0,
|
||||
"Score": 0,
|
||||
"IsExternal": true,
|
||||
"DeliveryMethod": "Encode",
|
||||
"DeliveryUrl": "string",
|
||||
"IsExternalUrl": true,
|
||||
"IsTextSubtitleStream": true,
|
||||
"SupportsExternalStream": true,
|
||||
"Path": "string",
|
||||
"PixelFormat": "string",
|
||||
"Level": 0,
|
||||
"IsAnamorphic": true
|
||||
}
|
||||
],
|
||||
"MediaAttachments": [
|
||||
{
|
||||
"Codec": "string",
|
||||
"CodecTag": "string",
|
||||
"Comment": "string",
|
||||
"Index": 0,
|
||||
"FileName": "string",
|
||||
"MimeType": "string",
|
||||
"DeliveryUrl": "string"
|
||||
}
|
||||
],
|
||||
"Formats": ["string"],
|
||||
"Bitrate": 0,
|
||||
"Timestamp": "None",
|
||||
"RequiredHttpHeaders": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"TranscodingUrl": "string",
|
||||
"TranscodingSubProtocol": "string",
|
||||
"TranscodingContainer": "string",
|
||||
"AnalyzeDurationMs": 0,
|
||||
"DefaultAudioStreamIndex": 0,
|
||||
"DefaultSubtitleStreamIndex": 0
|
||||
}
|
||||
],
|
||||
"CriticRating": 0,
|
||||
"ProductionLocations": ["string"],
|
||||
"Path": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"OfficialRating": "string",
|
||||
"CustomRating": "string",
|
||||
"ChannelId": "04b0b2a5-93cb-474d-8ea9-3df0f84eb0ff",
|
||||
"ChannelName": "string",
|
||||
"Overview": "string",
|
||||
"Taglines": ["string"],
|
||||
"Genres": ["string"],
|
||||
"CommunityRating": 0,
|
||||
"CumulativeRunTimeTicks": 0,
|
||||
"RunTimeTicks": 0,
|
||||
"PlayAccess": "Full",
|
||||
"AspectRatio": "string",
|
||||
"ProductionYear": 0,
|
||||
"IsPlaceHolder": true,
|
||||
"Number": "string",
|
||||
"ChannelNumber": "string",
|
||||
"IndexNumber": 0,
|
||||
"IndexNumberEnd": 0,
|
||||
"ParentIndexNumber": 0,
|
||||
"RemoteTrailers": [
|
||||
{
|
||||
"Url": "string",
|
||||
"Name": "string"
|
||||
}
|
||||
],
|
||||
"ProviderIds": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"IsHD": true,
|
||||
"IsFolder": false,
|
||||
"ParentId": "FOLDER-UUID",
|
||||
"Type": "Episode",
|
||||
"People": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43",
|
||||
"Role": "string",
|
||||
"Type": "string",
|
||||
"PrimaryImageTag": "string",
|
||||
"ImageBlurHashes": {
|
||||
"Primary": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Art": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Backdrop": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Banner": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Logo": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Thumb": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Disc": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Box": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Screenshot": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Menu": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Chapter": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"BoxRear": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Profile": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Studios": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"GenreItems": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"ParentLogoItemId": "c78d400f-de5c-421e-8714-4fb05d387233",
|
||||
"ParentBackdropItemId": "c22fd826-17fc-44f4-9b04-1eb3e8fb9173",
|
||||
"ParentBackdropImageTags": ["string"],
|
||||
"LocalTrailerCount": 0,
|
||||
"UserData": {
|
||||
"Rating": 0,
|
||||
"PlayedPercentage": 0,
|
||||
"UnplayedItemCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"PlayCount": 0,
|
||||
"IsFavorite": true,
|
||||
"Likes": true,
|
||||
"LastPlayedDate": "2019-08-24T14:15:22Z",
|
||||
"Played": true,
|
||||
"Key": "string",
|
||||
"ItemId": "string"
|
||||
},
|
||||
"RecursiveItemCount": 0,
|
||||
"ChildCount": 0,
|
||||
"SeriesName": "string",
|
||||
"SeriesId": "c7b70af4-4902-4a7e-95ab-28349b6c7afc",
|
||||
"SeasonId": "badb6463-e5b7-45c5-8141-71204420ec8f",
|
||||
"SpecialFeatureCount": 0,
|
||||
"DisplayPreferencesId": "string",
|
||||
"Status": "string",
|
||||
"AirTime": "string",
|
||||
"AirDays": ["Sunday"],
|
||||
"Tags": ["string"],
|
||||
"PrimaryImageAspectRatio": 0,
|
||||
"Artists": ["string"],
|
||||
"ArtistItems": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"Album": "string",
|
||||
"CollectionType": "string",
|
||||
"DisplayOrder": "string",
|
||||
"AlbumId": "21af9851-8e39-43a9-9c47-513d3b9e99fc",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"SeriesPrimaryImageTag": "string",
|
||||
"AlbumArtist": "string",
|
||||
"AlbumArtists": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"SeasonName": "string",
|
||||
"MediaStreams": [
|
||||
{
|
||||
"Codec": "string",
|
||||
"CodecTag": "string",
|
||||
"Language": "string",
|
||||
"ColorRange": "string",
|
||||
"ColorSpace": "string",
|
||||
"ColorTransfer": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"DvVersionMajor": 0,
|
||||
"DvVersionMinor": 0,
|
||||
"DvProfile": 0,
|
||||
"DvLevel": 0,
|
||||
"RpuPresentFlag": 0,
|
||||
"ElPresentFlag": 0,
|
||||
"BlPresentFlag": 0,
|
||||
"DvBlSignalCompatibilityId": 0,
|
||||
"Comment": "string",
|
||||
"TimeBase": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"Title": "string",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"VideoDoViTitle": "string",
|
||||
"LocalizedUndefined": "string",
|
||||
"LocalizedDefault": "string",
|
||||
"LocalizedForced": "string",
|
||||
"LocalizedExternal": "string",
|
||||
"DisplayTitle": "string",
|
||||
"NalLengthSize": "string",
|
||||
"IsInterlaced": true,
|
||||
"IsAVC": true,
|
||||
"ChannelLayout": "string",
|
||||
"BitRate": 0,
|
||||
"BitDepth": 0,
|
||||
"RefFrames": 0,
|
||||
"PacketLength": 0,
|
||||
"Channels": 0,
|
||||
"SampleRate": 0,
|
||||
"IsDefault": true,
|
||||
"IsForced": true,
|
||||
"Height": 0,
|
||||
"Width": 0,
|
||||
"AverageFrameRate": 0,
|
||||
"RealFrameRate": 0,
|
||||
"Profile": "string",
|
||||
"Type": "Audio",
|
||||
"AspectRatio": "string",
|
||||
"Index": 0,
|
||||
"Score": 0,
|
||||
"IsExternal": true,
|
||||
"DeliveryMethod": "Encode",
|
||||
"DeliveryUrl": "string",
|
||||
"IsExternalUrl": true,
|
||||
"IsTextSubtitleStream": true,
|
||||
"SupportsExternalStream": true,
|
||||
"Path": "string",
|
||||
"PixelFormat": "string",
|
||||
"Level": 0,
|
||||
"IsAnamorphic": true
|
||||
}
|
||||
],
|
||||
"VideoType": "VideoFile",
|
||||
"PartCount": 0,
|
||||
"MediaSourceCount": 0,
|
||||
"ImageTags": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"BackdropImageTags": ["string"],
|
||||
"ScreenshotImageTags": ["string"],
|
||||
"ParentLogoImageTag": "string",
|
||||
"ParentArtItemId": "10c1875b-b82c-48e8-bae9-939a5e68dc2f",
|
||||
"ParentArtImageTag": "string",
|
||||
"SeriesThumbImageTag": "string",
|
||||
"ImageBlurHashes": {
|
||||
"Primary": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Art": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Backdrop": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Banner": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Logo": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Thumb": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Disc": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Box": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Screenshot": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Menu": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Chapter": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"BoxRear": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Profile": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
}
|
||||
},
|
||||
"SeriesStudio": "string",
|
||||
"ParentThumbItemId": "ae6ff707-333d-4994-be6d-b83ca1b35f46",
|
||||
"ParentThumbImageTag": "string",
|
||||
"ParentPrimaryImageItemId": "string",
|
||||
"ParentPrimaryImageTag": "string",
|
||||
"Chapters": [
|
||||
{
|
||||
"StartPositionTicks": 0,
|
||||
"Name": "string",
|
||||
"ImagePath": "string",
|
||||
"ImageDateModified": "2019-08-24T14:15:22Z",
|
||||
"ImageTag": "string"
|
||||
}
|
||||
],
|
||||
"LocationType": "FileSystem",
|
||||
"IsoType": "Dvd",
|
||||
"MediaType": "string",
|
||||
"EndDate": "2019-08-24T14:15:22Z",
|
||||
"LockedFields": ["Cast"],
|
||||
"TrailerCount": 0,
|
||||
"MovieCount": 0,
|
||||
"SeriesCount": 0,
|
||||
"ProgramCount": 0,
|
||||
"EpisodeCount": 0,
|
||||
"SongCount": 0,
|
||||
"AlbumCount": 0,
|
||||
"ArtistCount": 0,
|
||||
"MusicVideoCount": 0,
|
||||
"LockData": true,
|
||||
"Width": 0,
|
||||
"Height": 0,
|
||||
"CameraMake": "string",
|
||||
"CameraModel": "string",
|
||||
"Software": "string",
|
||||
"ExposureTime": 0,
|
||||
"FocalLength": 0,
|
||||
"ImageOrientation": "TopLeft",
|
||||
"Aperture": 0,
|
||||
"ShutterSpeed": 0,
|
||||
"Latitude": 0,
|
||||
"Longitude": 0,
|
||||
"Altitude": 0,
|
||||
"IsoSpeedRating": 0,
|
||||
"SeriesTimerId": "string",
|
||||
"ProgramId": "string",
|
||||
"ChannelPrimaryImageTag": "string",
|
||||
"StartDate": "2019-08-24T14:15:22Z",
|
||||
"CompletionPercentage": 0,
|
||||
"IsRepeat": true,
|
||||
"EpisodeTitle": "string",
|
||||
"ChannelType": "TV",
|
||||
"Audio": "Mono",
|
||||
"IsMovie": true,
|
||||
"IsSports": true,
|
||||
"IsSeries": true,
|
||||
"IsLive": true,
|
||||
"IsNews": true,
|
||||
"IsKids": true,
|
||||
"IsPremiere": true,
|
||||
"TimerId": "string",
|
||||
"CurrentProgram": {}
|
||||
}
|
509
tests/components/jellyfin/fixtures/episodes.json
Normal file
509
tests/components/jellyfin/fixtures/episodes.json
Normal file
@ -0,0 +1,509 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"Name": "EPISODE",
|
||||
"OriginalTitle": "string",
|
||||
"ServerId": "SERVER-UUID",
|
||||
"Id": "EPISODE-UUID",
|
||||
"Etag": "string",
|
||||
"SourceType": "string",
|
||||
"PlaylistItemId": "string",
|
||||
"DateCreated": "2019-08-24T14:15:22Z",
|
||||
"DateLastMediaAdded": "2019-08-24T14:15:22Z",
|
||||
"ExtraType": "string",
|
||||
"AirsBeforeSeasonNumber": 0,
|
||||
"AirsAfterSeasonNumber": 0,
|
||||
"AirsBeforeEpisodeNumber": 0,
|
||||
"CanDelete": true,
|
||||
"CanDownload": true,
|
||||
"HasSubtitles": true,
|
||||
"PreferredMetadataLanguage": "string",
|
||||
"PreferredMetadataCountryCode": "string",
|
||||
"SupportsSync": true,
|
||||
"Container": "string",
|
||||
"SortName": "string",
|
||||
"ForcedSortName": "string",
|
||||
"Video3DFormat": "HalfSideBySide",
|
||||
"PremiereDate": "2019-08-24T14:15:22Z",
|
||||
"ExternalUrls": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Url": "string"
|
||||
}
|
||||
],
|
||||
"MediaSources": [
|
||||
{
|
||||
"Protocol": "File",
|
||||
"Id": "string",
|
||||
"Path": "/media/tvshows/Series/Season 01/S01E01.mp4",
|
||||
"EncoderPath": "string",
|
||||
"EncoderProtocol": "File",
|
||||
"Type": "Default",
|
||||
"Container": "string",
|
||||
"Size": 0,
|
||||
"Name": "string",
|
||||
"IsRemote": true,
|
||||
"ETag": "string",
|
||||
"RunTimeTicks": 0,
|
||||
"ReadAtNativeFramerate": true,
|
||||
"IgnoreDts": true,
|
||||
"IgnoreIndex": true,
|
||||
"GenPtsInput": true,
|
||||
"SupportsTranscoding": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsDirectPlay": true,
|
||||
"IsInfiniteStream": true,
|
||||
"RequiresOpening": true,
|
||||
"OpenToken": "string",
|
||||
"RequiresClosing": true,
|
||||
"LiveStreamId": "string",
|
||||
"BufferMs": 0,
|
||||
"RequiresLooping": true,
|
||||
"SupportsProbing": true,
|
||||
"VideoType": "VideoFile",
|
||||
"IsoType": "Dvd",
|
||||
"Video3DFormat": "HalfSideBySide",
|
||||
"MediaStreams": [
|
||||
{
|
||||
"Codec": "string",
|
||||
"CodecTag": "string",
|
||||
"Language": "string",
|
||||
"ColorRange": "string",
|
||||
"ColorSpace": "string",
|
||||
"ColorTransfer": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"DvVersionMajor": 0,
|
||||
"DvVersionMinor": 0,
|
||||
"DvProfile": 0,
|
||||
"DvLevel": 0,
|
||||
"RpuPresentFlag": 0,
|
||||
"ElPresentFlag": 0,
|
||||
"BlPresentFlag": 0,
|
||||
"DvBlSignalCompatibilityId": 0,
|
||||
"Comment": "string",
|
||||
"TimeBase": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"Title": "string",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"VideoDoViTitle": "string",
|
||||
"LocalizedUndefined": "string",
|
||||
"LocalizedDefault": "string",
|
||||
"LocalizedForced": "string",
|
||||
"LocalizedExternal": "string",
|
||||
"DisplayTitle": "string",
|
||||
"NalLengthSize": "string",
|
||||
"IsInterlaced": true,
|
||||
"IsAVC": true,
|
||||
"ChannelLayout": "string",
|
||||
"BitRate": 0,
|
||||
"BitDepth": 0,
|
||||
"RefFrames": 0,
|
||||
"PacketLength": 0,
|
||||
"Channels": 0,
|
||||
"SampleRate": 0,
|
||||
"IsDefault": true,
|
||||
"IsForced": true,
|
||||
"Height": 0,
|
||||
"Width": 0,
|
||||
"AverageFrameRate": 0,
|
||||
"RealFrameRate": 0,
|
||||
"Profile": "string",
|
||||
"Type": "Audio",
|
||||
"AspectRatio": "string",
|
||||
"Index": 0,
|
||||
"Score": 0,
|
||||
"IsExternal": true,
|
||||
"DeliveryMethod": "Encode",
|
||||
"DeliveryUrl": "string",
|
||||
"IsExternalUrl": true,
|
||||
"IsTextSubtitleStream": true,
|
||||
"SupportsExternalStream": true,
|
||||
"Path": "string",
|
||||
"PixelFormat": "string",
|
||||
"Level": 0,
|
||||
"IsAnamorphic": true
|
||||
}
|
||||
],
|
||||
"MediaAttachments": [
|
||||
{
|
||||
"Codec": "string",
|
||||
"CodecTag": "string",
|
||||
"Comment": "string",
|
||||
"Index": 0,
|
||||
"FileName": "string",
|
||||
"MimeType": "string",
|
||||
"DeliveryUrl": "string"
|
||||
}
|
||||
],
|
||||
"Formats": ["string"],
|
||||
"Bitrate": 0,
|
||||
"Timestamp": "None",
|
||||
"RequiredHttpHeaders": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"TranscodingUrl": "string",
|
||||
"TranscodingSubProtocol": "string",
|
||||
"TranscodingContainer": "string",
|
||||
"AnalyzeDurationMs": 0,
|
||||
"DefaultAudioStreamIndex": 0,
|
||||
"DefaultSubtitleStreamIndex": 0
|
||||
}
|
||||
],
|
||||
"CriticRating": 0,
|
||||
"ProductionLocations": ["string"],
|
||||
"Path": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"OfficialRating": "string",
|
||||
"CustomRating": "string",
|
||||
"ChannelId": "04b0b2a5-93cb-474d-8ea9-3df0f84eb0ff",
|
||||
"ChannelName": "string",
|
||||
"Overview": "string",
|
||||
"Taglines": ["string"],
|
||||
"Genres": ["string"],
|
||||
"CommunityRating": 0,
|
||||
"CumulativeRunTimeTicks": 0,
|
||||
"RunTimeTicks": 0,
|
||||
"PlayAccess": "Full",
|
||||
"AspectRatio": "string",
|
||||
"ProductionYear": 0,
|
||||
"IsPlaceHolder": true,
|
||||
"Number": "string",
|
||||
"ChannelNumber": "string",
|
||||
"IndexNumber": 0,
|
||||
"IndexNumberEnd": 0,
|
||||
"ParentIndexNumber": 0,
|
||||
"RemoteTrailers": [
|
||||
{
|
||||
"Url": "string",
|
||||
"Name": "string"
|
||||
}
|
||||
],
|
||||
"ProviderIds": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"IsHD": true,
|
||||
"IsFolder": false,
|
||||
"ParentId": "FOLDER-UUID",
|
||||
"Type": "Episode",
|
||||
"People": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43",
|
||||
"Role": "string",
|
||||
"Type": "string",
|
||||
"PrimaryImageTag": "string",
|
||||
"ImageBlurHashes": {
|
||||
"Primary": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Art": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Backdrop": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Banner": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Logo": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Thumb": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Disc": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Box": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Screenshot": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Menu": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Chapter": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"BoxRear": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Profile": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Studios": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"GenreItems": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"ParentLogoItemId": "c78d400f-de5c-421e-8714-4fb05d387233",
|
||||
"ParentBackdropItemId": "c22fd826-17fc-44f4-9b04-1eb3e8fb9173",
|
||||
"ParentBackdropImageTags": ["string"],
|
||||
"LocalTrailerCount": 0,
|
||||
"UserData": {
|
||||
"Rating": 0,
|
||||
"PlayedPercentage": 0,
|
||||
"UnplayedItemCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"PlayCount": 0,
|
||||
"IsFavorite": true,
|
||||
"Likes": true,
|
||||
"LastPlayedDate": "2019-08-24T14:15:22Z",
|
||||
"Played": true,
|
||||
"Key": "string",
|
||||
"ItemId": "string"
|
||||
},
|
||||
"RecursiveItemCount": 0,
|
||||
"ChildCount": 0,
|
||||
"SeriesName": "string",
|
||||
"SeriesId": "c7b70af4-4902-4a7e-95ab-28349b6c7afc",
|
||||
"SeasonId": "badb6463-e5b7-45c5-8141-71204420ec8f",
|
||||
"SpecialFeatureCount": 0,
|
||||
"DisplayPreferencesId": "string",
|
||||
"Status": "string",
|
||||
"AirTime": "string",
|
||||
"AirDays": ["Sunday"],
|
||||
"Tags": ["string"],
|
||||
"PrimaryImageAspectRatio": 0,
|
||||
"Artists": ["string"],
|
||||
"ArtistItems": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"Album": "string",
|
||||
"CollectionType": "string",
|
||||
"DisplayOrder": "string",
|
||||
"AlbumId": "21af9851-8e39-43a9-9c47-513d3b9e99fc",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"SeriesPrimaryImageTag": "string",
|
||||
"AlbumArtist": "string",
|
||||
"AlbumArtists": [
|
||||
{
|
||||
"Name": "string",
|
||||
"Id": "38a5a5bb-dc30-49a2-b175-1de0d1488c43"
|
||||
}
|
||||
],
|
||||
"SeasonName": "string",
|
||||
"MediaStreams": [
|
||||
{
|
||||
"Codec": "string",
|
||||
"CodecTag": "string",
|
||||
"Language": "string",
|
||||
"ColorRange": "string",
|
||||
"ColorSpace": "string",
|
||||
"ColorTransfer": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"DvVersionMajor": 0,
|
||||
"DvVersionMinor": 0,
|
||||
"DvProfile": 0,
|
||||
"DvLevel": 0,
|
||||
"RpuPresentFlag": 0,
|
||||
"ElPresentFlag": 0,
|
||||
"BlPresentFlag": 0,
|
||||
"DvBlSignalCompatibilityId": 0,
|
||||
"Comment": "string",
|
||||
"TimeBase": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"Title": "string",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"VideoDoViTitle": "string",
|
||||
"LocalizedUndefined": "string",
|
||||
"LocalizedDefault": "string",
|
||||
"LocalizedForced": "string",
|
||||
"LocalizedExternal": "string",
|
||||
"DisplayTitle": "string",
|
||||
"NalLengthSize": "string",
|
||||
"IsInterlaced": true,
|
||||
"IsAVC": true,
|
||||
"ChannelLayout": "string",
|
||||
"BitRate": 0,
|
||||
"BitDepth": 0,
|
||||
"RefFrames": 0,
|
||||
"PacketLength": 0,
|
||||
"Channels": 0,
|
||||
"SampleRate": 0,
|
||||
"IsDefault": true,
|
||||
"IsForced": true,
|
||||
"Height": 0,
|
||||
"Width": 0,
|
||||
"AverageFrameRate": 0,
|
||||
"RealFrameRate": 0,
|
||||
"Profile": "string",
|
||||
"Type": "Audio",
|
||||
"AspectRatio": "string",
|
||||
"Index": 0,
|
||||
"Score": 0,
|
||||
"IsExternal": true,
|
||||
"DeliveryMethod": "Encode",
|
||||
"DeliveryUrl": "string",
|
||||
"IsExternalUrl": true,
|
||||
"IsTextSubtitleStream": true,
|
||||
"SupportsExternalStream": true,
|
||||
"Path": "string",
|
||||
"PixelFormat": "string",
|
||||
"Level": 0,
|
||||
"IsAnamorphic": true
|
||||
}
|
||||
],
|
||||
"VideoType": "VideoFile",
|
||||
"PartCount": 0,
|
||||
"MediaSourceCount": 0,
|
||||
"ImageTags": {
|
||||
"Primary": "string"
|
||||
},
|
||||
"BackdropImageTags": ["string"],
|
||||
"ScreenshotImageTags": ["string"],
|
||||
"ParentLogoImageTag": "string",
|
||||
"ParentArtItemId": "10c1875b-b82c-48e8-bae9-939a5e68dc2f",
|
||||
"ParentArtImageTag": "string",
|
||||
"SeriesThumbImageTag": "string",
|
||||
"ImageBlurHashes": {
|
||||
"Primary": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Art": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Backdrop": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Banner": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Logo": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Thumb": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Disc": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Box": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Screenshot": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Menu": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Chapter": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"BoxRear": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"Profile": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
}
|
||||
},
|
||||
"SeriesStudio": "string",
|
||||
"ParentThumbItemId": "ae6ff707-333d-4994-be6d-b83ca1b35f46",
|
||||
"ParentThumbImageTag": "string",
|
||||
"ParentPrimaryImageItemId": "string",
|
||||
"ParentPrimaryImageTag": "string",
|
||||
"Chapters": [
|
||||
{
|
||||
"StartPositionTicks": 0,
|
||||
"Name": "string",
|
||||
"ImagePath": "string",
|
||||
"ImageDateModified": "2019-08-24T14:15:22Z",
|
||||
"ImageTag": "string"
|
||||
}
|
||||
],
|
||||
"LocationType": "FileSystem",
|
||||
"IsoType": "Dvd",
|
||||
"MediaType": "string",
|
||||
"EndDate": "2019-08-24T14:15:22Z",
|
||||
"LockedFields": ["Cast"],
|
||||
"TrailerCount": 0,
|
||||
"MovieCount": 0,
|
||||
"SeriesCount": 0,
|
||||
"ProgramCount": 0,
|
||||
"EpisodeCount": 0,
|
||||
"SongCount": 0,
|
||||
"AlbumCount": 0,
|
||||
"ArtistCount": 0,
|
||||
"MusicVideoCount": 0,
|
||||
"LockData": true,
|
||||
"Width": 0,
|
||||
"Height": 0,
|
||||
"CameraMake": "string",
|
||||
"CameraModel": "string",
|
||||
"Software": "string",
|
||||
"ExposureTime": 0,
|
||||
"FocalLength": 0,
|
||||
"ImageOrientation": "TopLeft",
|
||||
"Aperture": 0,
|
||||
"ShutterSpeed": 0,
|
||||
"Latitude": 0,
|
||||
"Longitude": 0,
|
||||
"Altitude": 0,
|
||||
"IsoSpeedRating": 0,
|
||||
"SeriesTimerId": "string",
|
||||
"ProgramId": "string",
|
||||
"ChannelPrimaryImageTag": "string",
|
||||
"StartDate": "2019-08-24T14:15:22Z",
|
||||
"CompletionPercentage": 0,
|
||||
"IsRepeat": true,
|
||||
"EpisodeTitle": "string",
|
||||
"ChannelType": "TV",
|
||||
"Audio": "Mono",
|
||||
"IsMovie": true,
|
||||
"IsSports": true,
|
||||
"IsSeries": true,
|
||||
"IsLive": true,
|
||||
"IsNews": true,
|
||||
"IsKids": true,
|
||||
"IsPremiere": true,
|
||||
"TimerId": "string",
|
||||
"CurrentProgram": {}
|
||||
}
|
||||
],
|
||||
"TotalRecordCount": 1,
|
||||
"StartIndex": 0
|
||||
}
|
@ -298,7 +298,7 @@
|
||||
}
|
||||
],
|
||||
"Album": "string",
|
||||
"CollectionType": "string",
|
||||
"CollectionType": "tvshows",
|
||||
"DisplayOrder": "string",
|
||||
"AlbumId": "21af9851-8e39-43a9-9c47-513d3b9e99fc",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
|
23
tests/components/jellyfin/fixtures/media-source-root.json
Normal file
23
tests/components/jellyfin/fixtures/media-source-root.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"title": "Jellyfin",
|
||||
"media_class": "directory",
|
||||
"media_content_type": "",
|
||||
"media_content_id": "media-source://jellyfin",
|
||||
"children_media_class": "directory",
|
||||
"can_play": false,
|
||||
"can_expand": true,
|
||||
"thumbnail": null,
|
||||
"not_shown": 0,
|
||||
"children": [
|
||||
{
|
||||
"title": "COLLECTION FOLDER",
|
||||
"media_class": "directory",
|
||||
"media_content_type": "",
|
||||
"media_content_id": "media-source://jellyfin/COLLECTION-FOLDER-UUID",
|
||||
"children_media_class": null,
|
||||
"can_play": false,
|
||||
"can_expand": true,
|
||||
"thumbnail": null
|
||||
}
|
||||
]
|
||||
}
|
45
tests/components/jellyfin/fixtures/movie-collection.json
Normal file
45
tests/components/jellyfin/fixtures/movie-collection.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"BackdropImageTags": [],
|
||||
"CanDelete": false,
|
||||
"CanDownload": false,
|
||||
"ChannelId": "",
|
||||
"ChildCount": 1,
|
||||
"CollectionType": "movies",
|
||||
"DateCreated": "string",
|
||||
"DisplayPreferencesId": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"Etag": "string",
|
||||
"ExternalUrls": [],
|
||||
"GenreItems": [],
|
||||
"Genres": [],
|
||||
"Id": "MOVIE-COLLECTION-FOLDER-UUID",
|
||||
"ImageBlurHashes": { "Primary": { "string": "string" } },
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IsFolder": true,
|
||||
"LocalTrailerCount": 0,
|
||||
"LocationType": "FileSystem",
|
||||
"LockData": false,
|
||||
"LockedFields": [],
|
||||
"Name": "Movies",
|
||||
"ParentId": "string",
|
||||
"Path": "string",
|
||||
"People": [],
|
||||
"PlayAccess": "Full",
|
||||
"PrimaryImageAspectRatio": 1.7777777777777777,
|
||||
"ProviderIds": {},
|
||||
"RemoteTrailers": [],
|
||||
"ServerId": "string",
|
||||
"SortName": "movies",
|
||||
"SpecialFeatureCount": 0,
|
||||
"Studios": [],
|
||||
"Taglines": [],
|
||||
"Tags": [],
|
||||
"Type": "CollectionFolder",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false
|
||||
}
|
||||
}
|
153
tests/components/jellyfin/fixtures/movie.json
Normal file
153
tests/components/jellyfin/fixtures/movie.json
Normal file
@ -0,0 +1,153 @@
|
||||
{
|
||||
"BackdropImageTags": ["string"],
|
||||
"CanDelete": true,
|
||||
"CanDownload": true,
|
||||
"ChannelId": "",
|
||||
"Chapters": [],
|
||||
"CommunityRating": 0,
|
||||
"Container": "string",
|
||||
"CriticRating": 0,
|
||||
"DateCreated": "string",
|
||||
"DisplayPreferencesId": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"Etag": "string",
|
||||
"ExternalUrls": [],
|
||||
"GenreItems": [],
|
||||
"Genres": ["string"],
|
||||
"Height": 0,
|
||||
"Id": "MOVIE-UUID",
|
||||
"ImageBlurHashes": {
|
||||
"Backdrop": { "string": "string" },
|
||||
"Primary": { "string": "string" }
|
||||
},
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IsFolder": false,
|
||||
"IsHD": true,
|
||||
"LocalTrailerCount": 0,
|
||||
"LocationType": "FileSystem",
|
||||
"LockData": false,
|
||||
"LockedFields": [],
|
||||
"MediaSources": [
|
||||
{
|
||||
"Bitrate": 0,
|
||||
"Container": "string",
|
||||
"DefaultAudioStreamIndex": 1,
|
||||
"ETag": "string",
|
||||
"Formats": [],
|
||||
"GenPtsInput": false,
|
||||
"Id": "string",
|
||||
"IgnoreDts": false,
|
||||
"IgnoreIndex": false,
|
||||
"IsInfiniteStream": false,
|
||||
"IsRemote": false,
|
||||
"MediaAttachments": [],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"AspectRatio": "string",
|
||||
"AverageFrameRate": 0,
|
||||
"BitRate": 0,
|
||||
"Codec": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"ColorTransfer": "string",
|
||||
"DisplayTitle": "string",
|
||||
"Height": 0,
|
||||
"Index": 0,
|
||||
"IsDefault": true,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"PixelFormat": "string",
|
||||
"Profile": "Main",
|
||||
"RealFrameRate": 0,
|
||||
"RefFrames": 0,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "string",
|
||||
"Type": "Video",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"Width": 0
|
||||
}
|
||||
],
|
||||
"Name": "MOVIE",
|
||||
"Path": "/media/movies/MOVIE/MOVIE.mp4",
|
||||
"Protocol": "File",
|
||||
"ReadAtNativeFramerate": false,
|
||||
"RequiredHttpHeaders": {},
|
||||
"RequiresClosing": false,
|
||||
"RequiresLooping": false,
|
||||
"RequiresOpening": false,
|
||||
"RunTimeTicks": 0,
|
||||
"Size": 0,
|
||||
"SupportsDirectPlay": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsProbing": true,
|
||||
"SupportsTranscoding": false,
|
||||
"Type": "Default",
|
||||
"VideoType": "VideoFile"
|
||||
}
|
||||
],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"AspectRatio": "string",
|
||||
"AverageFrameRate": 0,
|
||||
"BitRate": 0,
|
||||
"Codec": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"ColorTransfer": "string",
|
||||
"DisplayTitle": "string",
|
||||
"Height": 0,
|
||||
"Index": 0,
|
||||
"IsDefault": true,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"PixelFormat": "string",
|
||||
"Profile": "string",
|
||||
"RealFrameRate": 0,
|
||||
"RefFrames": 0,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "string",
|
||||
"Type": "Video",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"Width": 0
|
||||
}
|
||||
],
|
||||
"MediaType": "Video",
|
||||
"Name": "MOVIE",
|
||||
"OfficialRating": "string",
|
||||
"OriginalTitle": "MOVIE",
|
||||
"Overview": "string",
|
||||
"Path": "/media/movies/MOVIE/MOVIE.mp4",
|
||||
"People": [],
|
||||
"PlayAccess": "string",
|
||||
"PremiereDate": "string",
|
||||
"PrimaryImageAspectRatio": 0,
|
||||
"ProductionLocations": ["string"],
|
||||
"ProductionYear": 0,
|
||||
"ProviderIds": { "Imdb": "string", "Tmdb": "string" },
|
||||
"RemoteTrailers": [],
|
||||
"RunTimeTicks": 0,
|
||||
"ServerId": "string",
|
||||
"SortName": "string",
|
||||
"SpecialFeatureCount": 0,
|
||||
"Studios": [],
|
||||
"Taglines": ["string"],
|
||||
"Tags": [],
|
||||
"Type": "Movie",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "0",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false
|
||||
},
|
||||
"VideoType": "VideoFile",
|
||||
"Width": 0
|
||||
}
|
159
tests/components/jellyfin/fixtures/movies.json
Normal file
159
tests/components/jellyfin/fixtures/movies.json
Normal file
@ -0,0 +1,159 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"BackdropImageTags": ["string"],
|
||||
"CanDelete": true,
|
||||
"CanDownload": true,
|
||||
"ChannelId": "",
|
||||
"Chapters": [],
|
||||
"CommunityRating": 0,
|
||||
"Container": "string",
|
||||
"CriticRating": 0,
|
||||
"DateCreated": "string",
|
||||
"DisplayPreferencesId": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"Etag": "string",
|
||||
"ExternalUrls": [],
|
||||
"GenreItems": [],
|
||||
"Genres": ["string"],
|
||||
"Height": 0,
|
||||
"Id": "MOVIE-UUID",
|
||||
"ImageBlurHashes": {
|
||||
"Backdrop": { "string": "string" },
|
||||
"Primary": { "string": "string" }
|
||||
},
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IsFolder": false,
|
||||
"IsHD": true,
|
||||
"LocalTrailerCount": 0,
|
||||
"LocationType": "FileSystem",
|
||||
"LockData": false,
|
||||
"LockedFields": [],
|
||||
"MediaSources": [
|
||||
{
|
||||
"Bitrate": 0,
|
||||
"Container": "string",
|
||||
"DefaultAudioStreamIndex": 1,
|
||||
"ETag": "string",
|
||||
"Formats": [],
|
||||
"GenPtsInput": false,
|
||||
"Id": "string",
|
||||
"IgnoreDts": false,
|
||||
"IgnoreIndex": false,
|
||||
"IsInfiniteStream": false,
|
||||
"IsRemote": false,
|
||||
"MediaAttachments": [],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"AspectRatio": "string",
|
||||
"AverageFrameRate": 0,
|
||||
"BitRate": 0,
|
||||
"Codec": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"ColorTransfer": "string",
|
||||
"DisplayTitle": "string",
|
||||
"Height": 0,
|
||||
"Index": 0,
|
||||
"IsDefault": true,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"PixelFormat": "string",
|
||||
"Profile": "Main",
|
||||
"RealFrameRate": 0,
|
||||
"RefFrames": 0,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "string",
|
||||
"Type": "Video",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"Width": 0
|
||||
}
|
||||
],
|
||||
"Name": "MOVIE",
|
||||
"Path": "/media/movies/MOVIE/MOVIE.mp4",
|
||||
"Protocol": "File",
|
||||
"ReadAtNativeFramerate": false,
|
||||
"RequiredHttpHeaders": {},
|
||||
"RequiresClosing": false,
|
||||
"RequiresLooping": false,
|
||||
"RequiresOpening": false,
|
||||
"RunTimeTicks": 0,
|
||||
"Size": 0,
|
||||
"SupportsDirectPlay": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsProbing": true,
|
||||
"SupportsTranscoding": false,
|
||||
"Type": "Default",
|
||||
"VideoType": "VideoFile"
|
||||
}
|
||||
],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"AspectRatio": "string",
|
||||
"AverageFrameRate": 0,
|
||||
"BitRate": 0,
|
||||
"Codec": "string",
|
||||
"CodecTimeBase": "string",
|
||||
"ColorPrimaries": "string",
|
||||
"ColorTransfer": "string",
|
||||
"DisplayTitle": "string",
|
||||
"Height": 0,
|
||||
"Index": 0,
|
||||
"IsDefault": true,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"PixelFormat": "string",
|
||||
"Profile": "string",
|
||||
"RealFrameRate": 0,
|
||||
"RefFrames": 0,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "string",
|
||||
"Type": "Video",
|
||||
"VideoRange": "string",
|
||||
"VideoRangeType": "string",
|
||||
"Width": 0
|
||||
}
|
||||
],
|
||||
"MediaType": "Video",
|
||||
"Name": "MOVIE",
|
||||
"OfficialRating": "string",
|
||||
"OriginalTitle": "MOVIE",
|
||||
"Overview": "string",
|
||||
"Path": "/media/movies/MOVIE/MOVIE.mp4",
|
||||
"People": [],
|
||||
"PlayAccess": "string",
|
||||
"PremiereDate": "string",
|
||||
"PrimaryImageAspectRatio": 0,
|
||||
"ProductionLocations": ["string"],
|
||||
"ProductionYear": 0,
|
||||
"ProviderIds": { "Imdb": "string", "Tmdb": "string" },
|
||||
"RemoteTrailers": [],
|
||||
"RunTimeTicks": 0,
|
||||
"ServerId": "string",
|
||||
"SortName": "string",
|
||||
"SpecialFeatureCount": 0,
|
||||
"Studios": [],
|
||||
"Taglines": ["string"],
|
||||
"Tags": [],
|
||||
"Type": "Movie",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "0",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false
|
||||
},
|
||||
"VideoType": "VideoFile",
|
||||
"Width": 0
|
||||
}
|
||||
],
|
||||
"StartIndex": 0,
|
||||
"TotalRecordCount": 1
|
||||
}
|
45
tests/components/jellyfin/fixtures/music-collection.json
Normal file
45
tests/components/jellyfin/fixtures/music-collection.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"BackdropImageTags": [],
|
||||
"CanDelete": false,
|
||||
"CanDownload": false,
|
||||
"ChannelId": "",
|
||||
"ChildCount": 0,
|
||||
"CollectionType": "music",
|
||||
"DateCreated": "string",
|
||||
"DisplayPreferencesId": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"Etag": "string",
|
||||
"ExternalUrls": [],
|
||||
"GenreItems": [],
|
||||
"Genres": [],
|
||||
"Id": "MUSIC-COLLECTION-FOLDER-UUID",
|
||||
"ImageBlurHashes": { "Primary": { "string": "string" } },
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IsFolder": true,
|
||||
"LocalTrailerCount": 0,
|
||||
"LocationType": "FileSystem",
|
||||
"LockData": false,
|
||||
"LockedFields": [],
|
||||
"Name": "Music",
|
||||
"ParentId": "string",
|
||||
"Path": "string",
|
||||
"People": [],
|
||||
"PlayAccess": "Full",
|
||||
"PrimaryImageAspectRatio": 1.7777777777777777,
|
||||
"ProviderIds": {},
|
||||
"RemoteTrailers": [],
|
||||
"ServerId": "string",
|
||||
"SortName": "music",
|
||||
"SpecialFeatureCount": 0,
|
||||
"Studios": [],
|
||||
"Taglines": [],
|
||||
"Tags": [],
|
||||
"Type": "CollectionFolder",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false
|
||||
}
|
||||
}
|
23
tests/components/jellyfin/fixtures/season.json
Normal file
23
tests/components/jellyfin/fixtures/season.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"BackdropImageTags": [],
|
||||
"ChannelId": "string",
|
||||
"Id": "SEASON-UUID",
|
||||
"ImageBlurHashes": {},
|
||||
"ImageTags": {},
|
||||
"IndexNumber": 0,
|
||||
"IsFolder": true,
|
||||
"LocationType": "FileSystem",
|
||||
"Name": "SEASON",
|
||||
"SeriesId": "SERIES-UUID",
|
||||
"SeriesName": "SERIES",
|
||||
"ServerId": "SEASON-UUID",
|
||||
"Type": "Season",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false,
|
||||
"UnplayedItemCount": 0
|
||||
}
|
||||
}
|
29
tests/components/jellyfin/fixtures/seasons.json
Normal file
29
tests/components/jellyfin/fixtures/seasons.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"BackdropImageTags": [],
|
||||
"ChannelId": "string",
|
||||
"Id": "SEASON-UUID",
|
||||
"ImageBlurHashes": {},
|
||||
"ImageTags": {},
|
||||
"IndexNumber": 0,
|
||||
"IsFolder": true,
|
||||
"LocationType": "FileSystem",
|
||||
"Name": "SEASON",
|
||||
"SeriesId": "SERIES-UUID",
|
||||
"SeriesName": "SERIES",
|
||||
"ServerId": "SEASON-UUID",
|
||||
"Type": "Season",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false,
|
||||
"UnplayedItemCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"StartIndex": 0,
|
||||
"TotalRecordCount": 1
|
||||
}
|
34
tests/components/jellyfin/fixtures/series-list.json
Normal file
34
tests/components/jellyfin/fixtures/series-list.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"AirDays": ["string"],
|
||||
"AirTime": "string",
|
||||
"BackdropImageTags": [],
|
||||
"ChannelId": "string",
|
||||
"CommunityRating": 0,
|
||||
"EndDate": "string",
|
||||
"Id": "SERIES-UUID",
|
||||
"ImageBlurHashes": { "Banner": { "string": "string" } },
|
||||
"ImageTags": { "Banner": "string" },
|
||||
"IsFolder": true,
|
||||
"LocationType": "FileSystem",
|
||||
"Name": "SERIES",
|
||||
"PremiereDate": "string",
|
||||
"ProductionYear": 0,
|
||||
"RunTimeTicks": 0,
|
||||
"ServerId": "string",
|
||||
"Status": "string",
|
||||
"Type": "Series",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false,
|
||||
"UnplayedItemCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"TotalRecordCount": 1,
|
||||
"StartIndex": 0
|
||||
}
|
28
tests/components/jellyfin/fixtures/series.json
Normal file
28
tests/components/jellyfin/fixtures/series.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"AirDays": ["string"],
|
||||
"AirTime": "string",
|
||||
"BackdropImageTags": [],
|
||||
"ChannelId": "string",
|
||||
"CommunityRating": 0,
|
||||
"EndDate": "string",
|
||||
"Id": "SERIES-UUID",
|
||||
"ImageBlurHashes": { "Banner": { "string": "string" } },
|
||||
"ImageTags": { "Banner": "string" },
|
||||
"IsFolder": true,
|
||||
"LocationType": "FileSystem",
|
||||
"Name": "SERIES",
|
||||
"PremiereDate": "string",
|
||||
"ProductionYear": 0,
|
||||
"RunTimeTicks": 0,
|
||||
"ServerId": "string",
|
||||
"Status": "string",
|
||||
"Type": "Series",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false,
|
||||
"UnplayedItemCount": 0
|
||||
}
|
||||
}
|
91
tests/components/jellyfin/fixtures/track.json
Normal file
91
tests/components/jellyfin/fixtures/track.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"Album": "ALBUM_NAME",
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"AlbumId": "ALBUM-UUID",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"ArtistItems": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "TRACK-UUID",
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IndexNumber": 1,
|
||||
"IsFolder": false,
|
||||
"MediaSources": [
|
||||
{
|
||||
"Bitrate": 1,
|
||||
"Container": "flac",
|
||||
"DefaultAudioStreamIndex": 0,
|
||||
"Formats": [],
|
||||
"GenPtsInput": false,
|
||||
"Id": "string",
|
||||
"IgnoreDts": false,
|
||||
"IgnoreIndex": false,
|
||||
"IsInfiniteStream": false,
|
||||
"IsRemote": false,
|
||||
"MediaAttachments": [],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"Name": "string",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.flac",
|
||||
"Protocol": "string",
|
||||
"ReadAtNativeFramerate": false,
|
||||
"RequiredHttpHeaders": {},
|
||||
"RequiresClosing": false,
|
||||
"RequiresLooping": false,
|
||||
"RequiresOpening": false,
|
||||
"RunTimeTicks": 2954933248,
|
||||
"Size": 30074476,
|
||||
"SupportsDirectPlay": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsProbing": true,
|
||||
"SupportsTranscoding": true,
|
||||
"Type": "Default"
|
||||
}
|
||||
],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"MediaType": "Audio",
|
||||
"Name": "TRACK",
|
||||
"ParentId": "ALBUM-UUID",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.flac",
|
||||
"ServerId": "string",
|
||||
"Type": "Audio"
|
||||
}
|
93
tests/components/jellyfin/fixtures/tracks-nopath.json
Normal file
93
tests/components/jellyfin/fixtures/tracks-nopath.json
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"Album": "ALBUM_NAME",
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"AlbumId": "ALBUM-UUID",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"ArtistItems": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "TRACK-UUID",
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IndexNumber": 1,
|
||||
"IsFolder": false,
|
||||
"MediaSources": [
|
||||
{
|
||||
"Bitrate": 1,
|
||||
"Container": "flac",
|
||||
"DefaultAudioStreamIndex": 0,
|
||||
"Formats": [],
|
||||
"GenPtsInput": false,
|
||||
"Id": "string",
|
||||
"IgnoreDts": false,
|
||||
"IgnoreIndex": false,
|
||||
"IsInfiniteStream": false,
|
||||
"IsRemote": false,
|
||||
"MediaAttachments": [],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"Name": "string",
|
||||
"Protocol": "string",
|
||||
"ReadAtNativeFramerate": false,
|
||||
"RequiredHttpHeaders": {},
|
||||
"RequiresClosing": false,
|
||||
"RequiresLooping": false,
|
||||
"RequiresOpening": false,
|
||||
"RunTimeTicks": 2954933248,
|
||||
"Size": 30074476,
|
||||
"SupportsDirectPlay": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsProbing": true,
|
||||
"SupportsTranscoding": true,
|
||||
"Type": "Default"
|
||||
}
|
||||
],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"MediaType": "Audio",
|
||||
"Name": "TRACK",
|
||||
"ParentId": "ALBUM-UUID",
|
||||
"ServerId": "string",
|
||||
"Type": "Audio"
|
||||
}
|
||||
]
|
||||
}
|
23
tests/components/jellyfin/fixtures/tracks-nosource.json
Normal file
23
tests/components/jellyfin/fixtures/tracks-nosource.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"Album": "ALBUM_NAME",
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"AlbumId": "ALBUM-UUID",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"ArtistItems": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "TRACK-UUID",
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IndexNumber": 1,
|
||||
"IsFolder": false,
|
||||
"MediaType": "Audio",
|
||||
"Name": "TRACK",
|
||||
"ParentId": "ALBUM-UUID",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.flac",
|
||||
"ServerId": "string",
|
||||
"Type": "Audio"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"Album": "ALBUM_NAME",
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"AlbumId": "ALBUM-UUID",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"ArtistItems": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "TRACK-UUID",
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IndexNumber": 1,
|
||||
"IsFolder": false,
|
||||
"MediaSources": [
|
||||
{
|
||||
"Bitrate": 1,
|
||||
"Container": "flac",
|
||||
"DefaultAudioStreamIndex": 0,
|
||||
"Formats": [],
|
||||
"GenPtsInput": false,
|
||||
"Id": "string",
|
||||
"IgnoreDts": false,
|
||||
"IgnoreIndex": false,
|
||||
"IsInfiniteStream": false,
|
||||
"IsRemote": false,
|
||||
"MediaAttachments": [],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"Name": "string",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.uke",
|
||||
"Protocol": "string",
|
||||
"ReadAtNativeFramerate": false,
|
||||
"RequiredHttpHeaders": {},
|
||||
"RequiresClosing": false,
|
||||
"RequiresLooping": false,
|
||||
"RequiresOpening": false,
|
||||
"RunTimeTicks": 2954933248,
|
||||
"Size": 30074476,
|
||||
"SupportsDirectPlay": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsProbing": true,
|
||||
"SupportsTranscoding": true,
|
||||
"Type": "Default"
|
||||
}
|
||||
],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"MediaType": "Audio",
|
||||
"Name": "TRACK",
|
||||
"ParentId": "ALBUM-UUID",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.uke",
|
||||
"ServerId": "string",
|
||||
"Type": "Audio"
|
||||
}
|
||||
]
|
||||
}
|
95
tests/components/jellyfin/fixtures/tracks.json
Normal file
95
tests/components/jellyfin/fixtures/tracks.json
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"Items": [
|
||||
{
|
||||
"Album": "ALBUM_NAME",
|
||||
"AlbumArtist": "ARTIST",
|
||||
"AlbumArtists": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"AlbumId": "ALBUM-UUID",
|
||||
"AlbumPrimaryImageTag": "string",
|
||||
"ArtistItems": [{ "Id": "ARTIST-UUID", "Name": "ARTIST" }],
|
||||
"Artists": ["ARTIST"],
|
||||
"Id": "TRACK-UUID",
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IndexNumber": 1,
|
||||
"IsFolder": false,
|
||||
"MediaSources": [
|
||||
{
|
||||
"Bitrate": 1,
|
||||
"Container": "flac",
|
||||
"DefaultAudioStreamIndex": 0,
|
||||
"Formats": [],
|
||||
"GenPtsInput": false,
|
||||
"Id": "string",
|
||||
"IgnoreDts": false,
|
||||
"IgnoreIndex": false,
|
||||
"IsInfiniteStream": false,
|
||||
"IsRemote": false,
|
||||
"MediaAttachments": [],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"Name": "string",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.flac",
|
||||
"Protocol": "string",
|
||||
"ReadAtNativeFramerate": false,
|
||||
"RequiredHttpHeaders": {},
|
||||
"RequiresClosing": false,
|
||||
"RequiresLooping": false,
|
||||
"RequiresOpening": false,
|
||||
"RunTimeTicks": 2954933248,
|
||||
"Size": 30074476,
|
||||
"SupportsDirectPlay": true,
|
||||
"SupportsDirectStream": true,
|
||||
"SupportsProbing": true,
|
||||
"SupportsTranscoding": true,
|
||||
"Type": "Default"
|
||||
}
|
||||
],
|
||||
"MediaStreams": [
|
||||
{
|
||||
"BitDepth": 16,
|
||||
"ChannelLayout": "stereo",
|
||||
"Channels": 2,
|
||||
"Codec": "flac",
|
||||
"CodecTimeBase": "1/44100",
|
||||
"DisplayTitle": "FLAC - Stereo",
|
||||
"Index": 0,
|
||||
"IsDefault": false,
|
||||
"IsExternal": false,
|
||||
"IsForced": false,
|
||||
"IsInterlaced": false,
|
||||
"IsTextSubtitleStream": false,
|
||||
"Level": 0,
|
||||
"SampleRate": 44100,
|
||||
"SupportsExternalStream": false,
|
||||
"TimeBase": "1/44100",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"MediaType": "Audio",
|
||||
"Name": "TRACK",
|
||||
"ParentId": "ALBUM-UUID",
|
||||
"Path": "/media/music/MockArtist/MockAlbum/01 - Track - MockAlbum - MockArtist.flac",
|
||||
"ServerId": "string",
|
||||
"Type": "Audio"
|
||||
}
|
||||
]
|
||||
}
|
45
tests/components/jellyfin/fixtures/tv-collection.json
Normal file
45
tests/components/jellyfin/fixtures/tv-collection.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"BackdropImageTags": [],
|
||||
"CanDelete": false,
|
||||
"CanDownload": false,
|
||||
"ChannelId": "",
|
||||
"ChildCount": 0,
|
||||
"CollectionType": "tvshows",
|
||||
"DateCreated": "string",
|
||||
"DisplayPreferencesId": "string",
|
||||
"EnableMediaSourceDisplay": true,
|
||||
"Etag": "string",
|
||||
"ExternalUrls": [],
|
||||
"GenreItems": [],
|
||||
"Genres": [],
|
||||
"Id": "TV-COLLECTION-FOLDER-UUID",
|
||||
"ImageBlurHashes": { "Primary": { "string": "string" } },
|
||||
"ImageTags": { "Primary": "string" },
|
||||
"IsFolder": true,
|
||||
"LocalTrailerCount": 0,
|
||||
"LocationType": "FileSystem",
|
||||
"LockData": false,
|
||||
"LockedFields": [],
|
||||
"Name": "TVShows",
|
||||
"ParentId": "string",
|
||||
"Path": "string",
|
||||
"People": [],
|
||||
"PlayAccess": "Full",
|
||||
"PrimaryImageAspectRatio": 1.7777777777777777,
|
||||
"ProviderIds": {},
|
||||
"RemoteTrailers": [],
|
||||
"ServerId": "string",
|
||||
"SortName": "music",
|
||||
"SpecialFeatureCount": 0,
|
||||
"Studios": [],
|
||||
"Taglines": [],
|
||||
"Tags": [],
|
||||
"Type": "CollectionFolder",
|
||||
"UserData": {
|
||||
"IsFavorite": false,
|
||||
"Key": "string",
|
||||
"PlayCount": 0,
|
||||
"PlaybackPositionTicks": 0,
|
||||
"Played": false
|
||||
}
|
||||
}
|
5
tests/components/jellyfin/fixtures/unsupported-item.json
Normal file
5
tests/components/jellyfin/fixtures/unsupported-item.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"Id": "Unsupported-UUID",
|
||||
"Type": "Unsupported",
|
||||
"MediaType": "Unsupported"
|
||||
}
|
135
tests/components/jellyfin/snapshots/test_media_source.ambr
Normal file
135
tests/components/jellyfin/snapshots/test_media_source.ambr
Normal file
@ -0,0 +1,135 @@
|
||||
# serializer version: 1
|
||||
# name: test_movie_library
|
||||
dict({
|
||||
'can_expand': False,
|
||||
'can_play': True,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'MOVIE-UUID',
|
||||
'media_class': <MediaClass.MOVIE: 'movie'>,
|
||||
'media_content_id': 'media-source://jellyfin/MOVIE-UUID',
|
||||
'media_content_type': 'video/mp4',
|
||||
'not_shown': 0,
|
||||
'thumbnail': 'http://localhost/Items/MOVIE-UUID/Images/Primary.jpg',
|
||||
'title': 'MOVIE',
|
||||
})
|
||||
# ---
|
||||
# name: test_music_library
|
||||
dict({
|
||||
'can_expand': True,
|
||||
'can_play': False,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'ALBUM-UUID',
|
||||
'media_class': <MediaClass.ARTIST: 'artist'>,
|
||||
'media_content_id': 'media-source://jellyfin/ALBUM-UUID',
|
||||
'media_content_type': '',
|
||||
'not_shown': 0,
|
||||
'thumbnail': None,
|
||||
'title': 'ALBUM',
|
||||
})
|
||||
# ---
|
||||
# name: test_music_library.1
|
||||
dict({
|
||||
'can_expand': True,
|
||||
'can_play': False,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'ALBUM-UUID',
|
||||
'media_class': <MediaClass.ALBUM: 'album'>,
|
||||
'media_content_id': 'media-source://jellyfin/ALBUM-UUID',
|
||||
'media_content_type': '',
|
||||
'not_shown': 0,
|
||||
'thumbnail': None,
|
||||
'title': 'ALBUM',
|
||||
})
|
||||
# ---
|
||||
# name: test_music_library.2
|
||||
dict({
|
||||
'can_expand': False,
|
||||
'can_play': True,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'TRACK-UUID',
|
||||
'media_class': <MediaClass.TRACK: 'track'>,
|
||||
'media_content_id': 'media-source://jellyfin/TRACK-UUID',
|
||||
'media_content_type': 'audio/flac',
|
||||
'not_shown': 0,
|
||||
'thumbnail': 'http://localhost/Items/TRACK-UUID/Images/Primary.jpg',
|
||||
'title': 'TRACK',
|
||||
})
|
||||
# ---
|
||||
# name: test_resolve
|
||||
'http://localhost/Audio/TRACK-UUID/universal?UserId=test-username,DeviceId=TEST-UUID,MaxStreamingBitrate=140000000'
|
||||
# ---
|
||||
# name: test_resolve.1
|
||||
'http://localhost/Videos/MOVIE-UUID/stream?static=true,DeviceId=TEST-UUID,api_key=TEST-API-KEY'
|
||||
# ---
|
||||
# name: test_root
|
||||
dict({
|
||||
'can_expand': True,
|
||||
'can_play': False,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'COLLECTION-FOLDER-UUID',
|
||||
'media_class': <MediaClass.DIRECTORY: 'directory'>,
|
||||
'media_content_id': 'media-source://jellyfin/COLLECTION-FOLDER-UUID',
|
||||
'media_content_type': '',
|
||||
'not_shown': 0,
|
||||
'thumbnail': None,
|
||||
'title': 'COLLECTION FOLDER',
|
||||
})
|
||||
# ---
|
||||
# name: test_tv_library
|
||||
dict({
|
||||
'can_expand': True,
|
||||
'can_play': False,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'SERIES-UUID',
|
||||
'media_class': <MediaClass.TV_SHOW: 'tv_show'>,
|
||||
'media_content_id': 'media-source://jellyfin/SERIES-UUID',
|
||||
'media_content_type': '',
|
||||
'not_shown': 0,
|
||||
'thumbnail': None,
|
||||
'title': 'SERIES',
|
||||
})
|
||||
# ---
|
||||
# name: test_tv_library.1
|
||||
dict({
|
||||
'can_expand': True,
|
||||
'can_play': False,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'SEASON-UUID',
|
||||
'media_class': <MediaClass.TV_SHOW: 'tv_show'>,
|
||||
'media_content_id': 'media-source://jellyfin/SEASON-UUID',
|
||||
'media_content_type': '',
|
||||
'not_shown': 0,
|
||||
'thumbnail': None,
|
||||
'title': 'SEASON',
|
||||
})
|
||||
# ---
|
||||
# name: test_tv_library.2
|
||||
dict({
|
||||
'can_expand': False,
|
||||
'can_play': True,
|
||||
'children': None,
|
||||
'children_media_class': None,
|
||||
'domain': 'jellyfin',
|
||||
'identifier': 'EPISODE-UUID',
|
||||
'media_class': <MediaClass.EPISODE: 'episode'>,
|
||||
'media_content_id': 'media-source://jellyfin/EPISODE-UUID',
|
||||
'media_content_type': 'video/mp4',
|
||||
'not_shown': 0,
|
||||
'thumbnail': 'http://localhost/Items/EPISODE-UUID/Images/Primary.jpg',
|
||||
'title': 'EPISODE',
|
||||
})
|
||||
# ---
|
@ -29,6 +29,26 @@ async def test_config_entry_not_ready(
|
||||
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
async def test_invalid_auth(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_client: MagicMock,
|
||||
) -> None:
|
||||
"""Test the Jellyfin integration handling invalid credentials."""
|
||||
mock_client.auth.connect_to_address.return_value = await async_load_json_fixture(
|
||||
hass,
|
||||
"auth-connect-address.json",
|
||||
)
|
||||
mock_client.auth.login.return_value = await async_load_json_fixture(
|
||||
hass,
|
||||
"auth-login-failure.json",
|
||||
)
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
assert not await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_load_unload_config_entry(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
|
303
tests/components/jellyfin/test_media_source.py
Normal file
303
tests/components/jellyfin/test_media_source.py
Normal file
@ -0,0 +1,303 @@
|
||||
"""Tests for the Jellyfin media_player platform."""
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.jellyfin.const import DOMAIN
|
||||
from homeassistant.components.media_player.errors import BrowseError
|
||||
from homeassistant.components.media_source import (
|
||||
DOMAIN as MEDIA_SOURCE_DOMAIN,
|
||||
URI_SCHEME,
|
||||
async_browse_media,
|
||||
async_resolve_media,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import load_json_fixture
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def setup_component(hass: HomeAssistant) -> None:
|
||||
"""Set up component."""
|
||||
assert await async_setup_component(hass, MEDIA_SOURCE_DOMAIN, {})
|
||||
|
||||
|
||||
async def test_resolve(
|
||||
hass: HomeAssistant,
|
||||
mock_client: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_api: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test resolving Jellyfin media items."""
|
||||
|
||||
# Test resolving a track
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("track.json")
|
||||
|
||||
play_media = await async_resolve_media(hass, f"{URI_SCHEME}{DOMAIN}/TRACK-UUID")
|
||||
|
||||
assert play_media.mime_type == "audio/flac"
|
||||
assert play_media.url == snapshot
|
||||
|
||||
# Test resolving a movie
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("movie.json")
|
||||
|
||||
play_media = await async_resolve_media(hass, f"{URI_SCHEME}{DOMAIN}/MOVIE-UUID")
|
||||
|
||||
assert play_media.mime_type == "video/mp4"
|
||||
assert play_media.url == snapshot
|
||||
|
||||
# Test resolving an unsupported item
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("unsupported-item.json")
|
||||
|
||||
with pytest.raises(BrowseError):
|
||||
await async_resolve_media(hass, f"{URI_SCHEME}{DOMAIN}/UNSUPPORTED-ITEM-UUID")
|
||||
|
||||
|
||||
async def test_root(
|
||||
hass: HomeAssistant,
|
||||
mock_client: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_api: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test browsing the Jellyfin root."""
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier is None
|
||||
assert browse.title == "Jellyfin"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
|
||||
async def test_tv_library(
|
||||
hass: HomeAssistant,
|
||||
mock_client: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_api: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test browsing a Jellyfin TV Library."""
|
||||
|
||||
# Test browsing an empty tv library
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("tv-collection.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = {"Items": []}
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/TV-COLLECTION-FOLDER-UUID"
|
||||
)
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "TV-COLLECTION-FOLDER-UUID"
|
||||
assert browse.title == "TVShows"
|
||||
assert browse.children == []
|
||||
|
||||
# Test browsing a tv library containing series
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("series-list.json")
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/TV-COLLECTION-FOLDER-UUID"
|
||||
)
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "TV-COLLECTION-FOLDER-UUID"
|
||||
assert browse.title == "TVShows"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
# Test browsing a series
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("series.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("seasons.json")
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/SERIES-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "SERIES-UUID"
|
||||
assert browse.title == "SERIES"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
# Test browsing a season
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("season.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("episodes.json")
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/SEASON-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "SEASON-UUID"
|
||||
assert browse.title == "SEASON"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
|
||||
async def test_movie_library(
|
||||
hass: HomeAssistant,
|
||||
mock_client: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_api: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test browsing a Jellyfin Movie Library."""
|
||||
|
||||
# Test empty movie library
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("movie-collection.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = {"Items": []}
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/MOVIE-COLLECTION-FOLDER-UUID"
|
||||
)
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "MOVIE-COLLECTION-FOLDER-UUID"
|
||||
assert browse.title == "Movies"
|
||||
assert browse.children == []
|
||||
|
||||
# Test browsing a movie library containing movies
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("movies.json")
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/MOVIE-COLLECTION-FOLDER-UUID"
|
||||
)
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "MOVIE-COLLECTION-FOLDER-UUID"
|
||||
assert browse.title == "Movies"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
|
||||
async def test_music_library(
|
||||
hass: HomeAssistant,
|
||||
mock_client: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_api: MagicMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test browsing a Jellyfin Music Library."""
|
||||
|
||||
# Test browsinng an empty music library
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("music-collection.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = {"Items": []}
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/MUSIC-COLLECTION-FOLDER-UUID"
|
||||
)
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "MUSIC-COLLECTION-FOLDER-UUID"
|
||||
assert browse.title == "Music"
|
||||
assert browse.children == []
|
||||
|
||||
# Test browsing a music library containing albums
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("albums.json")
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/MUSIC-COLLECTION-FOLDER-UUID"
|
||||
)
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "MUSIC-COLLECTION-FOLDER-UUID"
|
||||
assert browse.title == "Music"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
# Test browsing an artist
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("artist.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("albums.json")
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/ARTIST-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "ARTIST-UUID"
|
||||
assert browse.title == "ARTIST"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
# Test browsing an album
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("album.json")
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("tracks.json")
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/ALBUM-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "ALBUM-UUID"
|
||||
assert browse.title == "ALBUM"
|
||||
assert vars(browse.children[0]) == snapshot
|
||||
|
||||
# Test browsing an album with a track with no source
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("tracks-nosource.json")
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/ALBUM-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "ALBUM-UUID"
|
||||
assert browse.title == "ALBUM"
|
||||
|
||||
assert browse.children == []
|
||||
|
||||
# Test browsing an album with a track with no path
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture("tracks-nopath.json")
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/ALBUM-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "ALBUM-UUID"
|
||||
assert browse.title == "ALBUM"
|
||||
|
||||
assert browse.children == []
|
||||
|
||||
# Test browsing an album with a track with an unknown file extension
|
||||
mock_api.user_items.side_effect = None
|
||||
mock_api.user_items.return_value = load_json_fixture(
|
||||
"tracks-unknown-extension.json"
|
||||
)
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/ALBUM-UUID")
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.identifier == "ALBUM-UUID"
|
||||
assert browse.title == "ALBUM"
|
||||
|
||||
assert browse.children == []
|
||||
|
||||
|
||||
async def test_browse_unsupported(
|
||||
hass: HomeAssistant,
|
||||
mock_client: MagicMock,
|
||||
init_integration: MockConfigEntry,
|
||||
mock_jellyfin: MagicMock,
|
||||
mock_api: MagicMock,
|
||||
) -> None:
|
||||
"""Test browsing an unsupported item."""
|
||||
|
||||
mock_api.get_item.side_effect = None
|
||||
mock_api.get_item.return_value = load_json_fixture("unsupported-item.json")
|
||||
|
||||
with pytest.raises(BrowseError):
|
||||
await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/UNSUPPORTED-ITEM-UUID")
|
Loading…
x
Reference in New Issue
Block a user