本文整理汇总了Python中mopidy.models.Artist方法的典型用法代码示例。如果您正苦于以下问题:Python models.Artist方法的具体用法?Python models.Artist怎么用?Python models.Artist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mopidy.models
的用法示例。
在下文中一共展示了models.Artist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_includes_fake_artist_and_album_tracks
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_find_includes_fake_artist_and_album_tracks(self):
self.backend.library.dummy_find_exact_result = SearchResult(
albums=[Album(uri="dummy:album:a", name="A", date="2001")],
artists=[Artist(uri="dummy:artist:b", name="B")],
tracks=[Track(uri="dummy:track:c", name="C")],
)
self.send_request('find "any" "foo"')
self.assertInResponse("file: dummy:artist:b")
self.assertInResponse("Title: Artist: B")
self.assertInResponse("file: dummy:album:a")
self.assertInResponse("Title: Album: A")
self.assertInResponse("Date: 2001")
self.assertInResponse("file: dummy:track:c")
self.assertInResponse("Title: C")
self.assertInResponse("OK")
示例2: test_find_artist_does_not_include_fake_artist_tracks
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_find_artist_does_not_include_fake_artist_tracks(self):
self.backend.library.dummy_find_exact_result = SearchResult(
albums=[Album(uri="dummy:album:a", name="A", date="2001")],
artists=[Artist(uri="dummy:artist:b", name="B")],
tracks=[Track(uri="dummy:track:c", name="C")],
)
self.send_request('find "artist" "foo"')
self.assertNotInResponse("file: dummy:artist:b")
self.assertNotInResponse("Title: Artist: B")
self.assertInResponse("file: dummy:album:a")
self.assertInResponse("Title: Album: A")
self.assertInResponse("Date: 2001")
self.assertInResponse("file: dummy:track:c")
self.assertInResponse("Title: C")
self.assertInResponse("OK")
示例3: test_find_albumartist_does_not_include_fake_artist_tracks
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_find_albumartist_does_not_include_fake_artist_tracks(self):
self.backend.library.dummy_find_exact_result = SearchResult(
albums=[Album(uri="dummy:album:a", name="A", date="2001")],
artists=[Artist(uri="dummy:artist:b", name="B")],
tracks=[Track(uri="dummy:track:c", name="C")],
)
self.send_request('find "albumartist" "foo"')
self.assertNotInResponse("file: dummy:artist:b")
self.assertNotInResponse("Title: Artist: B")
self.assertInResponse("file: dummy:album:a")
self.assertInResponse("Title: Album: A")
self.assertInResponse("Date: 2001")
self.assertInResponse("file: dummy:track:c")
self.assertInResponse("Title: C")
self.assertInResponse("OK")
示例4: test_find_artist_and_album_does_not_include_fake_tracks
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_find_artist_and_album_does_not_include_fake_tracks(self):
self.backend.library.dummy_find_exact_result = SearchResult(
albums=[Album(uri="dummy:album:a", name="A", date="2001")],
artists=[Artist(uri="dummy:artist:b", name="B")],
tracks=[Track(uri="dummy:track:c", name="C")],
)
self.send_request('find "artist" "foo" "album" "bar"')
self.assertNotInResponse("file: dummy:artist:b")
self.assertNotInResponse("Title: Artist: B")
self.assertNotInResponse("file: dummy:album:a")
self.assertNotInResponse("Title: Album: A")
self.assertNotInResponse("Date: 2001")
self.assertInResponse("file: dummy:track:c")
self.assertInResponse("Title: C")
self.assertInResponse("OK")
示例5: test_search
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_search(self):
self.backend.library.dummy_search_result = SearchResult(
albums=[Album(uri="dummy:album:a", name="A")],
artists=[Artist(uri="dummy:artist:b", name="B")],
tracks=[Track(uri="dummy:track:c", name="C")],
)
self.send_request('search "any" "foo"')
self.assertInResponse("file: dummy:album:a")
self.assertInResponse("Title: Album: A")
self.assertInResponse("file: dummy:artist:b")
self.assertInResponse("Title: Artist: B")
self.assertInResponse("file: dummy:track:c")
self.assertInResponse("Title: C")
self.assertInResponse("OK")
示例6: test_track_to_mpd_format_for_nonempty_track
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_track_to_mpd_format_for_nonempty_track(self):
result = translator.track_to_mpd_format(
TlTrack(122, self.track), position=9
)
assert ("file", "à uri") in result
assert ("Time", 137) in result
assert ("Artist", "an artist") in result
assert ("Title", "a nàme") in result
assert ("Album", "an album") in result
assert ("AlbumArtist", "an other artist") in result
assert ("Composer", "a composer") in result
assert ("Performer", "a performer") in result
assert ("Genre", "a genre") in result
assert ("Track", "7/13") in result
assert ("Date", "1977-01-01") in result
assert ("Disc", 1) in result
assert ("Pos", 9) in result
assert ("Id", 122) in result
assert ("X-AlbumUri", "urischeme:àlbum:12345") in result
assert ("Comment", "a comment") not in result
assert len(result) == 15
示例7: test_list
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_list(self):
self.backend.library.dummy_get_distinct_result = {
"artist": {"A Artist"}
}
self.send_request('list "artist" "artist" "foo"')
self.assertInResponse("Artist: A Artist")
self.assertInResponse("OK")
示例8: test_list_artist_should_not_return_artists_without_names
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_list_artist_should_not_return_artists_without_names(self):
self.backend.library.dummy_find_exact_result = SearchResult(
tracks=[Track(artists=[Artist(name="")])]
)
self.send_request('list "artist"')
self.assertNotInResponse("Artist: ")
self.assertInResponse("OK")
# Albumartist
示例9: test_list_albumartist_should_not_return_artists_without_names
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_list_albumartist_should_not_return_artists_without_names(self):
self.backend.library.dummy_find_exact_result = SearchResult(
tracks=[Track(album=Album(artists=[Artist(name="")]))]
)
self.send_request('list "albumartist"')
self.assertNotInResponse("Artist: ")
self.assertNotInResponse("Albumartist: ")
self.assertNotInResponse("Composer: ")
self.assertNotInResponse("Performer: ")
self.assertInResponse("OK")
# Composer
示例10: test_list_composer_should_not_return_artists_without_names
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_list_composer_should_not_return_artists_without_names(self):
self.backend.library.dummy_find_exact_result = SearchResult(
tracks=[Track(composers=[Artist(name="")])]
)
self.send_request('list "composer"')
self.assertNotInResponse("Artist: ")
self.assertNotInResponse("Albumartist: ")
self.assertNotInResponse("Composer: ")
self.assertNotInResponse("Performer: ")
self.assertInResponse("OK")
# Performer
示例11: test_list_performer_should_not_return_artists_without_names
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_list_performer_should_not_return_artists_without_names(self):
self.backend.library.dummy_find_exact_result = SearchResult(
tracks=[Track(performers=[Artist(name="")])]
)
self.send_request('list "performer"')
self.assertNotInResponse("Artist: ")
self.assertNotInResponse("Albumartist: ")
self.assertNotInResponse("Composer: ")
self.assertNotInResponse("Performer: ")
self.assertInResponse("OK")
# Album
示例12: test_concat_multi_values
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_concat_multi_values(self):
artists = [Artist(name="ABBA"), Artist(name="Beatles")]
translated = translator.concat_multi_values(artists, "name")
assert translated == "ABBA;Beatles"
示例13: test_concat_multi_values_artist_with_no_name
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_concat_multi_values_artist_with_no_name(self):
artists = [Artist(name=None)]
translated = translator.concat_multi_values(artists, "name")
assert translated == ""
示例14: test_concat_multi_values_artist_with_no_musicbrainz_id
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def test_concat_multi_values_artist_with_no_musicbrainz_id(self):
artists = [Artist(name="Jah Wobble")]
translated = translator.concat_multi_values(artists, "musicbrainz_id")
assert translated == ""
示例15: wrap_track
# 需要导入模块: from mopidy import models [as 别名]
# 或者: from mopidy.models import Artist [as 别名]
def wrap_track(plextrack, plex_uri_method):
'''Wrap a plex search result in mopidy.model.track'''
return Track(uri=plex_uri_method(plextrack.ratingKey, 'plex:track'),
name=plextrack.title,
artists=[Artist(uri=plex_uri_method(plextrack.grandparentKey, 'plex:artist'),
name=plextrack.grandparentTitle)],
album=Album(uri=plex_uri_method(plextrack.parentKey, 'plex:album'),
name=plextrack.parentTitle),
track_no=None, #plextrack.index,
length=plextrack.duration,
# TODO: bitrate=plextrack.media.bitrate,
comment=plextrack.summary
)