2017-01-09 14:21:54 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2021-08-04 21:02:01 +00:00
|
|
|
from urllib.parse import quote_plus
|
|
|
|
|
2021-09-16 22:23:59 +00:00
|
|
|
import pytest
|
|
|
|
from plexapi.exceptions import BadRequest
|
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
from . import conftest as utils
|
2021-05-09 22:05:06 +00:00
|
|
|
from . import test_media, test_mixins
|
2017-04-15 00:47:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_audio_Artist_attr(artist):
|
|
|
|
artist.reload()
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(artist.addedAt)
|
2021-03-11 17:20:28 +00:00
|
|
|
assert artist.albumSort == -1
|
2021-02-15 01:10:11 +00:00
|
|
|
if artist.art:
|
|
|
|
assert utils.is_art(artist.art)
|
2020-09-16 22:58:36 +00:00
|
|
|
if artist.countries:
|
2020-12-03 23:18:35 +00:00
|
|
|
assert "United States of America" in [i.tag for i in artist.countries]
|
2021-09-13 00:56:21 +00:00
|
|
|
# assert "Electronic" in [i.tag for i in artist.genres]
|
2022-07-21 02:35:46 +00:00
|
|
|
assert artist.guid == "plex://artist/5d07bdaf403c64029060f8c4"
|
|
|
|
assert "mbid://069a1c1f-14eb-4d36-b0a0-77dffbd67713" in [i.id for i in artist.guids]
|
2020-12-24 00:39:54 +00:00
|
|
|
assert artist.index == 1
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(artist._initpath)
|
|
|
|
assert utils.is_metadata(artist.key)
|
|
|
|
assert utils.is_int(artist.librarySectionID)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert artist.listType == "audio"
|
2021-05-16 05:38:54 +00:00
|
|
|
assert utils.is_datetime(artist.lastRatedAt)
|
|
|
|
assert utils.is_datetime(artist.lastViewedAt)
|
2017-04-15 00:47:59 +00:00
|
|
|
assert len(artist.locations) == 1
|
|
|
|
assert len(artist.locations[0]) >= 10
|
|
|
|
assert artist.ratingKey >= 1
|
2017-04-23 05:18:53 +00:00
|
|
|
assert artist._server._baseurl == utils.SERVER_BASEURL
|
2019-09-21 20:54:50 +00:00
|
|
|
assert isinstance(artist.similar, list)
|
2020-09-16 22:58:36 +00:00
|
|
|
if artist.summary:
|
|
|
|
assert "Alias" in artist.summary
|
2022-02-27 05:05:43 +00:00
|
|
|
assert artist.theme is None
|
2021-02-15 01:10:11 +00:00
|
|
|
if artist.thumb:
|
|
|
|
assert utils.is_thumb(artist.thumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert artist.title == "Broke For Free"
|
|
|
|
assert artist.titleSort == "Broke For Free"
|
|
|
|
assert artist.type == "artist"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(artist.updatedAt)
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_int(artist.viewCount, gte=0)
|
2017-04-15 00:47:59 +00:00
|
|
|
|
|
|
|
|
2021-09-16 22:23:59 +00:00
|
|
|
def test_audio_Artist_get(artist):
|
|
|
|
track = artist.get(album="Layers", title="As Colourful as Ever")
|
|
|
|
assert track.title == "As Colourful as Ever"
|
2017-04-15 00:47:59 +00:00
|
|
|
|
2017-01-09 14:21:54 +00:00
|
|
|
|
2019-11-14 17:21:49 +00:00
|
|
|
def test_audio_Artist_history(artist):
|
|
|
|
history = artist.history()
|
2020-04-15 18:41:15 +00:00
|
|
|
assert isinstance(history, list)
|
2019-11-14 17:21:49 +00:00
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Artist_track(artist):
|
2020-04-29 21:23:22 +00:00
|
|
|
track = artist.track("As Colourful as Ever")
|
|
|
|
assert track.title == "As Colourful as Ever"
|
2020-12-24 07:03:08 +00:00
|
|
|
track = artist.track(album="Layers", track=1)
|
|
|
|
assert track.parentTitle == "Layers"
|
|
|
|
assert track.index == 1
|
2021-09-16 22:23:59 +00:00
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
artist.track()
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Artist_tracks(artist):
|
|
|
|
tracks = artist.tracks()
|
2020-04-29 21:23:22 +00:00
|
|
|
assert len(tracks) == 1
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Artist_album(artist):
|
2020-04-29 21:23:22 +00:00
|
|
|
album = artist.album("Layers")
|
|
|
|
assert album.title == "Layers"
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Artist_albums(artist):
|
|
|
|
albums = artist.albums()
|
2020-04-29 21:23:22 +00:00
|
|
|
assert len(albums) == 1 and albums[0].title == "Layers"
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2021-09-16 22:23:59 +00:00
|
|
|
def test_audio_Artist_hubs(artist):
|
|
|
|
hubs = artist.hubs()
|
|
|
|
assert isinstance(hubs, list)
|
|
|
|
|
|
|
|
|
2021-04-05 20:44:49 +00:00
|
|
|
def test_audio_Artist_mixins_edit_advanced_settings(artist):
|
|
|
|
test_mixins.edit_advanced_settings(artist)
|
|
|
|
|
|
|
|
|
2021-11-21 01:14:34 +00:00
|
|
|
@pytest.mark.xfail(reason="Changing images fails randomly")
|
2021-02-14 23:59:57 +00:00
|
|
|
def test_audio_Artist_mixins_images(artist):
|
2021-09-13 00:56:21 +00:00
|
|
|
test_mixins.lock_art(artist)
|
|
|
|
test_mixins.lock_poster(artist)
|
2021-02-14 23:59:57 +00:00
|
|
|
test_mixins.edit_art(artist)
|
|
|
|
test_mixins.edit_poster(artist)
|
2021-02-15 05:19:42 +00:00
|
|
|
test_mixins.attr_artUrl(artist)
|
|
|
|
test_mixins.attr_posterUrl(artist)
|
2021-02-14 23:59:57 +00:00
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_audio_Artist_mixins_themes(artist):
|
|
|
|
test_mixins.edit_theme(artist)
|
|
|
|
|
|
|
|
|
2021-05-30 22:49:28 +00:00
|
|
|
def test_audio_Artist_mixins_rating(artist):
|
|
|
|
test_mixins.edit_rating(artist)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_audio_Artist_mixins_fields(artist):
|
|
|
|
test_mixins.edit_sort_title(artist)
|
|
|
|
test_mixins.edit_summary(artist)
|
|
|
|
test_mixins.edit_title(artist)
|
|
|
|
|
|
|
|
|
2021-01-24 23:03:23 +00:00
|
|
|
def test_audio_Artist_mixins_tags(artist):
|
|
|
|
test_mixins.edit_collection(artist)
|
|
|
|
test_mixins.edit_country(artist)
|
|
|
|
test_mixins.edit_genre(artist)
|
2022-02-27 01:32:18 +00:00
|
|
|
test_mixins.edit_label(artist)
|
2021-01-24 23:03:23 +00:00
|
|
|
test_mixins.edit_mood(artist)
|
|
|
|
test_mixins.edit_similar_artist(artist)
|
|
|
|
test_mixins.edit_style(artist)
|
2021-01-24 22:40:02 +00:00
|
|
|
|
|
|
|
|
2021-05-09 22:05:06 +00:00
|
|
|
def test_audio_Artist_media_tags(artist):
|
|
|
|
artist.reload()
|
|
|
|
test_media.tag_collection(artist)
|
|
|
|
test_media.tag_country(artist)
|
|
|
|
test_media.tag_genre(artist)
|
|
|
|
test_media.tag_mood(artist)
|
|
|
|
test_media.tag_similar(artist)
|
|
|
|
test_media.tag_style(artist)
|
|
|
|
|
|
|
|
|
2021-11-20 22:16:58 +00:00
|
|
|
def test_audio_Artist_PlexWebURL(plex, artist):
|
2021-08-04 21:02:01 +00:00
|
|
|
url = artist.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(artist.key) in url
|
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Album_attrs(album):
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(album.addedAt)
|
2021-02-15 01:10:11 +00:00
|
|
|
if album.art:
|
|
|
|
assert utils.is_art(album.art)
|
2021-09-16 22:23:59 +00:00
|
|
|
assert isinstance(album.formats, list)
|
2020-04-29 13:05:59 +00:00
|
|
|
assert isinstance(album.genres, list)
|
2022-07-21 02:35:46 +00:00
|
|
|
assert album.guid == "plex://album/5d07c7e5403c640290bb5bfc"
|
|
|
|
assert "mbid://80b4a679-a2a4-4d18-835d-3e081185d7ba" in [i.id for i in album.guids]
|
2020-12-24 00:39:54 +00:00
|
|
|
assert album.index == 1
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(album._initpath)
|
|
|
|
assert utils.is_metadata(album.key)
|
2021-05-16 05:38:54 +00:00
|
|
|
assert utils.is_datetime(album.lastRatedAt)
|
|
|
|
assert utils.is_datetime(album.lastViewedAt)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(album.librarySectionID)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert album.listType == "audio"
|
2020-10-08 20:15:43 +00:00
|
|
|
assert utils.is_datetime(album.originallyAvailableAt)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(album.parentKey)
|
|
|
|
assert utils.is_int(album.parentRatingKey)
|
2022-02-27 05:05:43 +00:00
|
|
|
assert album.parentTheme is None or utils.is_metadata(album.parentTheme)
|
2017-04-23 05:54:53 +00:00
|
|
|
if album.parentThumb:
|
2021-02-15 01:10:11 +00:00
|
|
|
assert utils.is_thumb(album.parentThumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert album.parentTitle == "Broke For Free"
|
2017-04-15 00:47:59 +00:00
|
|
|
assert album.ratingKey >= 1
|
2017-04-23 05:18:53 +00:00
|
|
|
assert album._server._baseurl == utils.SERVER_BASEURL
|
2020-09-16 22:58:36 +00:00
|
|
|
assert album.studio == "[no label]"
|
2021-09-16 22:23:59 +00:00
|
|
|
assert isinstance(album.subformats, list)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert album.summary == ""
|
|
|
|
if album.thumb:
|
2021-02-15 01:10:11 +00:00
|
|
|
assert utils.is_thumb(album.thumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert album.title == "Layers"
|
|
|
|
assert album.titleSort == "Layers"
|
|
|
|
assert album.type == "album"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(album.updatedAt)
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_int(album.viewCount, gte=0)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert album.year in (2012,)
|
2017-04-15 00:47:59 +00:00
|
|
|
|
2019-10-16 03:49:27 +00:00
|
|
|
|
2019-11-14 17:21:49 +00:00
|
|
|
def test_audio_Album_history(album):
|
|
|
|
history = album.history()
|
2020-04-14 20:13:30 +00:00
|
|
|
assert isinstance(history, list)
|
2019-11-14 17:21:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_audio_Track_history(track):
|
|
|
|
history = track.history()
|
2020-04-14 20:13:30 +00:00
|
|
|
assert isinstance(history, list)
|
2019-11-14 17:21:49 +00:00
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Album_tracks(album):
|
|
|
|
tracks = album.tracks()
|
2020-04-29 21:23:22 +00:00
|
|
|
assert len(tracks) == 1
|
2017-04-15 00:47:59 +00:00
|
|
|
|
|
|
|
|
2022-05-17 02:52:16 +00:00
|
|
|
def test_audio_Album_track(album):
|
|
|
|
track = album.track("As Colourful as Ever")
|
|
|
|
assert track.title == "As Colourful as Ever"
|
|
|
|
track = album.track(track=1)
|
|
|
|
assert track.index == 1
|
|
|
|
track = album.track(1)
|
|
|
|
assert track.index == 1
|
2021-09-16 22:23:59 +00:00
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
album.track()
|
2017-04-15 00:47:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_audio_Album_get(album):
|
2022-05-17 02:52:16 +00:00
|
|
|
track = album.get("As Colourful as Ever")
|
|
|
|
assert track.title == "As Colourful as Ever"
|
2017-04-15 00:47:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_audio_Album_artist(album):
|
|
|
|
artist = album.artist()
|
2020-04-29 21:23:22 +00:00
|
|
|
artist.title == "Broke For Free"
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2021-11-21 01:14:34 +00:00
|
|
|
@pytest.mark.xfail(reason="Changing images fails randomly")
|
2021-02-14 23:59:57 +00:00
|
|
|
def test_audio_Album_mixins_images(album):
|
2021-09-13 00:56:21 +00:00
|
|
|
test_mixins.lock_art(album)
|
|
|
|
test_mixins.lock_poster(album)
|
2021-02-14 23:59:57 +00:00
|
|
|
test_mixins.edit_art(album)
|
|
|
|
test_mixins.edit_poster(album)
|
2021-02-15 05:19:42 +00:00
|
|
|
test_mixins.attr_artUrl(album)
|
|
|
|
test_mixins.attr_posterUrl(album)
|
2021-02-14 23:59:57 +00:00
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_audio_Album_mixins_themes(album):
|
|
|
|
test_mixins.attr_themeUrl(album)
|
|
|
|
|
|
|
|
|
2021-05-30 22:49:28 +00:00
|
|
|
def test_audio_Album_mixins_rating(album):
|
|
|
|
test_mixins.edit_rating(album)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_audio_Album_mixins_fields(album):
|
|
|
|
test_mixins.edit_originally_available(album)
|
|
|
|
test_mixins.edit_sort_title(album)
|
|
|
|
test_mixins.edit_studio(album)
|
|
|
|
test_mixins.edit_summary(album)
|
|
|
|
test_mixins.edit_title(album)
|
|
|
|
|
|
|
|
|
2021-01-24 23:03:23 +00:00
|
|
|
def test_audio_Album_mixins_tags(album):
|
|
|
|
test_mixins.edit_collection(album)
|
|
|
|
test_mixins.edit_genre(album)
|
|
|
|
test_mixins.edit_label(album)
|
|
|
|
test_mixins.edit_mood(album)
|
|
|
|
test_mixins.edit_style(album)
|
2021-01-24 22:40:02 +00:00
|
|
|
|
|
|
|
|
2021-05-09 22:05:06 +00:00
|
|
|
def test_audio_Album_media_tags(album):
|
|
|
|
album.reload()
|
|
|
|
test_media.tag_collection(album)
|
|
|
|
test_media.tag_genre(album)
|
|
|
|
test_media.tag_label(album)
|
|
|
|
test_media.tag_mood(album)
|
|
|
|
test_media.tag_style(album)
|
|
|
|
|
|
|
|
|
2021-11-20 22:16:58 +00:00
|
|
|
def test_audio_Album_PlexWebURL(plex, album):
|
2021-08-04 21:02:01 +00:00
|
|
|
url = album.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(album.key) in url
|
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Track_attrs(album):
|
2020-04-29 21:23:22 +00:00
|
|
|
track = album.get("As Colourful As Ever").reload()
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(track.addedAt)
|
2021-02-15 01:10:11 +00:00
|
|
|
if track.art:
|
|
|
|
assert utils.is_art(track.art)
|
2017-02-04 19:18:10 +00:00
|
|
|
assert track.chapterSource is None
|
2020-04-29 13:05:59 +00:00
|
|
|
assert utils.is_int(track.duration)
|
2021-02-15 03:03:19 +00:00
|
|
|
if track.grandparentArt:
|
2021-02-15 03:11:53 +00:00
|
|
|
assert utils.is_art(track.grandparentArt)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(track.grandparentKey)
|
|
|
|
assert utils.is_int(track.grandparentRatingKey)
|
2022-02-27 05:05:43 +00:00
|
|
|
assert track.grandparentTheme is None or utils.is_metadata(track.grandparentTheme)
|
2017-04-23 05:54:53 +00:00
|
|
|
if track.grandparentThumb:
|
2021-02-15 01:10:11 +00:00
|
|
|
assert utils.is_thumb(track.grandparentThumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert track.grandparentTitle == "Broke For Free"
|
2022-07-21 02:35:46 +00:00
|
|
|
assert track.guid == "plex://track/5d07e453403c6402907b80aa"
|
|
|
|
assert "mbid://6524bc2d-3f58-4afa-9e06-00a651f5d813" in [i.id for i in track.guids]
|
2021-09-16 22:23:59 +00:00
|
|
|
assert track.hasSonicAnalysis is False
|
2021-05-11 01:13:31 +00:00
|
|
|
assert track.index == 1
|
|
|
|
assert track.trackNumber == track.index
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(track._initpath)
|
|
|
|
assert utils.is_metadata(track.key)
|
2021-05-16 05:38:54 +00:00
|
|
|
assert utils.is_datetime(track.lastRatedAt)
|
2020-10-08 20:15:43 +00:00
|
|
|
assert utils.is_datetime(track.lastViewedAt)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(track.librarySectionID)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert track.listType == "audio"
|
2020-12-24 07:03:08 +00:00
|
|
|
assert len(track.locations) == 1
|
|
|
|
assert len(track.locations[0]) >= 10
|
2017-01-09 14:21:54 +00:00
|
|
|
# Assign 0 track.media
|
2017-04-15 00:47:59 +00:00
|
|
|
media = track.media[0]
|
2017-01-09 14:21:54 +00:00
|
|
|
assert track.moods == []
|
2020-04-29 21:23:22 +00:00
|
|
|
assert track.originalTitle in (None, "Broke For Free")
|
2017-04-15 00:47:59 +00:00
|
|
|
assert int(track.parentIndex) == 1
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(track.parentKey)
|
|
|
|
assert utils.is_int(track.parentRatingKey)
|
2020-08-07 21:57:04 +00:00
|
|
|
if track.parentThumb:
|
2021-02-15 01:10:11 +00:00
|
|
|
assert utils.is_thumb(track.parentThumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert track.parentTitle == "Layers"
|
2017-02-04 19:18:10 +00:00
|
|
|
assert track.playlistItemID is None
|
|
|
|
assert track.primaryExtraKey is None
|
2022-03-17 19:57:25 +00:00
|
|
|
assert track.ratingCount is None or utils.is_int(track.ratingCount)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(track.ratingKey)
|
|
|
|
assert track._server._baseurl == utils.SERVER_BASEURL
|
2022-02-27 06:31:21 +00:00
|
|
|
assert track.skipCount is None
|
2020-04-29 21:23:22 +00:00
|
|
|
assert track.summary == ""
|
2020-09-16 22:58:36 +00:00
|
|
|
if track.thumb:
|
2021-02-15 01:10:11 +00:00
|
|
|
assert utils.is_thumb(track.thumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert track.title == "As Colourful as Ever"
|
|
|
|
assert track.titleSort == "As Colourful as Ever"
|
|
|
|
assert track.type == "track"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(track.updatedAt)
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_int(track.viewCount, gte=0)
|
2017-01-09 14:21:54 +00:00
|
|
|
assert track.viewOffset == 0
|
2017-02-04 19:18:10 +00:00
|
|
|
assert track.viewedAt is None
|
|
|
|
assert track.year is None
|
2021-09-16 22:23:59 +00:00
|
|
|
assert track.url(None) is None
|
2017-04-15 00:47:59 +00:00
|
|
|
assert media.aspectRatio is None
|
|
|
|
assert media.audioChannels == 2
|
2020-04-29 21:23:22 +00:00
|
|
|
assert media.audioCodec == "mp3"
|
|
|
|
assert media.bitrate == 128
|
|
|
|
assert media.container == "mp3"
|
2020-04-29 13:05:59 +00:00
|
|
|
assert utils.is_int(media.duration)
|
2017-04-15 00:47:59 +00:00
|
|
|
assert media.height is None
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_int(media.id, gte=1)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(media._initpath)
|
2017-04-15 00:47:59 +00:00
|
|
|
assert media.optimizedForStreaming is None
|
|
|
|
# Assign 0 media.parts
|
|
|
|
part = media.parts[0]
|
2017-04-23 05:18:53 +00:00
|
|
|
assert media._server._baseurl == utils.SERVER_BASEURL
|
2017-04-15 00:47:59 +00:00
|
|
|
assert media.videoCodec is None
|
|
|
|
assert media.videoFrameRate is None
|
|
|
|
assert media.videoResolution is None
|
|
|
|
assert media.width is None
|
2020-04-29 21:23:22 +00:00
|
|
|
assert part.container == "mp3"
|
2020-04-29 13:05:59 +00:00
|
|
|
assert utils.is_int(part.duration)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert part.file.endswith(".mp3")
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(part.id)
|
|
|
|
assert utils.is_metadata(part._initpath)
|
|
|
|
assert utils.is_part(part.key)
|
2019-10-16 03:49:27 +00:00
|
|
|
# assert part.media == <Media:Holy.Moment>
|
2017-04-23 05:18:53 +00:00
|
|
|
assert part._server._baseurl == utils.SERVER_BASEURL
|
2020-04-29 21:23:22 +00:00
|
|
|
assert part.size == 3761053
|
2017-04-15 00:47:59 +00:00
|
|
|
# Assign 0 part.streams
|
|
|
|
stream = part.streams[0]
|
2020-04-29 21:23:22 +00:00
|
|
|
assert stream.audioChannelLayout == "stereo"
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.bitDepth is None
|
2020-04-29 21:23:22 +00:00
|
|
|
assert stream.bitrate == 128
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.bitrateMode is None
|
|
|
|
assert stream.channels == 2
|
2020-04-29 21:23:22 +00:00
|
|
|
assert stream.codec == "mp3"
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.duration is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(stream.id)
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.index == 0
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(stream._initpath)
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.language is None
|
|
|
|
assert stream.languageCode is None
|
2019-10-16 03:49:27 +00:00
|
|
|
# assert stream.part == <MediaPart:22>
|
2020-04-29 21:23:22 +00:00
|
|
|
assert stream.samplingRate == 48000
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.selected is True
|
2017-04-23 05:18:53 +00:00
|
|
|
assert stream._server._baseurl == utils.SERVER_BASEURL
|
2017-04-15 00:47:59 +00:00
|
|
|
assert stream.streamType == 2
|
|
|
|
assert stream.title is None
|
|
|
|
assert stream.type == 2
|
2021-01-24 20:21:56 +00:00
|
|
|
assert stream.albumGain is None
|
|
|
|
assert stream.albumPeak is None
|
|
|
|
assert stream.albumRange is None
|
|
|
|
assert stream.endRamp is None
|
|
|
|
assert stream.gain is None
|
|
|
|
assert stream.loudness is None
|
|
|
|
assert stream.lra is None
|
|
|
|
assert stream.peak is None
|
|
|
|
assert stream.startRamp is None
|
2017-04-15 00:47:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_audio_Track_album(album):
|
|
|
|
tracks = album.tracks()
|
|
|
|
assert tracks[0].album() == album
|
|
|
|
|
|
|
|
|
|
|
|
def test_audio_Track_artist(album, artist):
|
|
|
|
tracks = album.tracks()
|
|
|
|
assert tracks[0].artist() == artist
|
|
|
|
|
|
|
|
|
2021-02-15 05:19:42 +00:00
|
|
|
def test_audio_Track_mixins_images(track):
|
|
|
|
test_mixins.attr_artUrl(track)
|
|
|
|
test_mixins.attr_posterUrl(track)
|
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_audio_Track_mixins_themes(track):
|
|
|
|
test_mixins.attr_themeUrl(track)
|
|
|
|
|
|
|
|
|
2021-05-30 22:49:28 +00:00
|
|
|
def test_audio_Track_mixins_rating(track):
|
|
|
|
test_mixins.edit_rating(track)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_audio_Track_mixins_fields(track):
|
|
|
|
test_mixins.edit_title(track)
|
|
|
|
test_mixins.edit_track_artist(track)
|
|
|
|
test_mixins.edit_track_number(track)
|
|
|
|
test_mixins.edit_track_disc_number(track)
|
|
|
|
|
|
|
|
|
2021-01-24 23:03:23 +00:00
|
|
|
def test_audio_Track_mixins_tags(track):
|
2021-05-09 19:27:38 +00:00
|
|
|
test_mixins.edit_collection(track)
|
2022-02-27 01:32:18 +00:00
|
|
|
test_mixins.edit_label(track)
|
2021-01-24 23:03:23 +00:00
|
|
|
test_mixins.edit_mood(track)
|
2021-01-24 22:40:02 +00:00
|
|
|
|
|
|
|
|
2021-05-09 22:05:06 +00:00
|
|
|
def test_audio_Track_media_tags(track):
|
|
|
|
track.reload()
|
|
|
|
test_media.tag_collection(track)
|
|
|
|
test_media.tag_mood(track)
|
|
|
|
|
|
|
|
|
2021-11-20 22:16:58 +00:00
|
|
|
def test_audio_Track_PlexWebURL(plex, track):
|
2021-08-04 21:02:01 +00:00
|
|
|
url = track.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(track.parentKey) in url
|
|
|
|
|
|
|
|
|
2017-04-15 00:47:59 +00:00
|
|
|
def test_audio_Audio_section(artist, album, track):
|
|
|
|
assert artist.section()
|
|
|
|
assert album.section()
|
|
|
|
assert track.section()
|
|
|
|
assert track.section().key == album.section().key == artist.section().key
|
|
|
|
|
|
|
|
|
2021-11-20 22:16:58 +00:00
|
|
|
def test_audio_Artist_download(monkeydownload, tmpdir, artist):
|
|
|
|
total = len(artist.tracks())
|
|
|
|
filepaths = artist.download(savepath=str(tmpdir))
|
|
|
|
assert len(filepaths) == total
|
|
|
|
subfolders = artist.download(savepath=str(tmpdir), subfolders=True)
|
|
|
|
assert len(subfolders) == total
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2021-11-20 22:16:58 +00:00
|
|
|
def test_audio_Album_download(monkeydownload, tmpdir, album):
|
|
|
|
total = len(album.tracks())
|
|
|
|
filepaths = album.download(savepath=str(tmpdir))
|
|
|
|
assert len(filepaths) == total
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2021-11-20 22:16:58 +00:00
|
|
|
def test_audio_Track_download(monkeydownload, tmpdir, track):
|
|
|
|
filepaths = track.download(savepath=str(tmpdir))
|
|
|
|
assert len(filepaths) == 1
|