1 # -*- coding: utf-8 -*-
3 def theaudiodb_artistdetails(data
):
4 if data
.get('artists',[]):
5 item
= data
['artists'][0]
8 artistdata
['artist'] = item
['strArtist']
10 if item
.get('intFormedYear','') and item
['intFormedYear'] != '0':
11 artistdata
['formed'] = item
['intFormedYear']
12 if item
.get('intBornYear','') and item
['intBornYear'] != '0':
13 artistdata
['born'] = item
['intBornYear']
14 if item
.get('intDiedYear','') and item
['intDiedYear'] != '0':
15 artistdata
['died'] = item
['intDiedYear']
16 if item
.get('strDisbanded','') and item
['strDisbanded'] != '0':
17 artistdata
['disbanded'] = item
['strDisbanded']
18 if item
.get('strStyle',''):
19 artistdata
['styles'] = item
['strStyle']
20 if item
.get('strGenre',''):
21 artistdata
['genre'] = item
['strGenre']
22 if item
.get('strMood',''):
23 artistdata
['moods'] = item
['strMood']
24 if item
.get('strGender',''):
25 artistdata
['gender'] = item
['strGender']
26 if item
.get('strBiographyEN',''):
27 artistdata
['biographyEN'] = item
['strBiographyEN']
28 if item
.get('strBiographyDE',''):
29 artistdata
['biographyDE'] = item
['strBiographyDE']
30 if item
.get('strBiographyFR',''):
31 artistdata
['biographyFR'] = item
['strBiographyFR']
32 if item
.get('strBiographyCN',''):
33 artistdata
['biographyCN'] = item
['strBiographyCN']
34 if item
.get('strBiographyIT',''):
35 artistdata
['biographyIT'] = item
['strBiographyIT']
36 if item
.get('strBiographyJP',''):
37 artistdata
['biographyJP'] = item
['strBiographyJP']
38 if item
.get('strBiographyRU',''):
39 artistdata
['biographyRU'] = item
['strBiographyRU']
40 if item
.get('strBiographyES',''):
41 artistdata
['biographyES'] = item
['strBiographyES']
42 if item
.get('strBiographyPT',''):
43 artistdata
['biographyPT'] = item
['strBiographyPT']
44 if item
.get('strBiographySE',''):
45 artistdata
['biographySE'] = item
['strBiographySE']
46 if item
.get('strBiographyNL',''):
47 artistdata
['biographyNL'] = item
['strBiographyNL']
48 if item
.get('strBiographyHU',''):
49 artistdata
['biographyHU'] = item
['strBiographyHU']
50 if item
.get('strBiographyNO',''):
51 artistdata
['biographyNO'] = item
['strBiographyNO']
52 if item
.get('strBiographyIL',''):
53 artistdata
['biographyIL'] = item
['strBiographyIL']
54 if item
.get('strBiographyPL',''):
55 artistdata
['biographyPL'] = item
['strBiographyPL']
56 if item
.get('strMusicBrainzID',''):
57 artistdata
['mbartistid'] = item
['strMusicBrainzID']
58 if item
.get('strArtistFanart',''):
61 fanartdata
['image'] = item
['strArtistFanart']
62 fanartdata
['preview'] = item
['strArtistFanart'] + '/preview'
63 fanartdata
['aspect'] = 'fanart'
64 fanart
.append(fanartdata
)
65 if item
['strArtistFanart2']:
67 fanartdata
['image'] = item
['strArtistFanart2']
68 fanartdata
['preview'] = item
['strArtistFanart2'] + '/preview'
69 fanartdata
['aspect'] = 'fanart'
70 fanart
.append(fanartdata
)
71 if item
['strArtistFanart3']:
73 fanartdata
['image'] = item
['strArtistFanart3']
74 fanartdata
['preview'] = item
['strArtistFanart3'] + '/preview'
75 fanartdata
['aspect'] = 'fanart'
76 fanart
.append(fanartdata
)
77 artistdata
['fanart'] = fanart
78 if item
.get('strArtistThumb',''):
81 thumbdata
['image'] = item
['strArtistThumb']
82 thumbdata
['preview'] = item
['strArtistThumb'] + '/preview'
83 thumbdata
['aspect'] = 'thumb'
84 thumbs
.append(thumbdata
)
85 artistdata
['thumb'] = thumbs
86 if item
.get('strArtistLogo',''):
88 extradata
['image'] = item
['strArtistLogo']
89 extradata
['preview'] = item
['strArtistLogo'] + '/preview'
90 extradata
['aspect'] = 'clearlogo'
91 extras
.append(extradata
)
92 if item
.get('strArtistClearart',''):
94 extradata
['image'] = item
['strArtistClearart']
95 extradata
['preview'] = item
['strArtistClearart'] + '/preview'
96 extradata
['aspect'] = 'clearart'
97 extras
.append(extradata
)
98 if item
.get('strArtistWideThumb',''):
100 extradata
['image'] = item
['strArtistWideThumb']
101 extradata
['preview'] = item
['strArtistWideThumb'] + '/preview'
102 extradata
['aspect'] = 'landscape'
103 extras
.append(extradata
)
104 if item
.get('strArtistBanner',''):
106 extradata
['image'] = item
['strArtistBanner']
107 extradata
['preview'] = item
['strArtistBanner'] + '/preview'
108 extradata
['aspect'] = 'banner'
109 extras
.append(extradata
)
110 if item
.get('strArtistCutout',''):
112 extradata
['image'] = item
['strArtistCutout']
113 extradata
['preview'] = item
['strArtistCutout'] + '/preview'
114 extradata
['aspect'] = 'cutout'
115 extras
.append(extradata
)
117 artistdata
['extras'] = extras
120 def theaudiodb_artistalbums(data
):
122 albumlist
= data
.get('album',[])
124 for item
in data
.get('album',[]):
126 albumdata
['title'] = item
['strAlbum']
127 albumdata
['year'] = item
.get('intYearReleased', '')
128 albums
.append(albumdata
)
131 def theaudiodb_mvids(data
):
133 mvidlist
= data
.get('mvids', [])
135 for item
in mvidlist
:
137 mviddata
['title'] = item
['strTrack']
138 mviddata
['mbtrackid'] = item
.get('strMusicBrainzID')
139 tempurl
= item
.get('strMusicVid', '')
140 # Find and remove extraneous data in the URL leaving just the video ID
141 index
= tempurl
.find('=')
142 vid_id
= tempurl
[index
+1:]
143 http_index
= vid_id
.find('//youtu.be/')
145 vid_id
= vid_id
[http_index
+11:]
146 check1
= vid_id
.find('/www.youtube.com/embed/')
148 vid_id
= vid_id
[check1
+ 23:check1
+ 34]
150 'plugin://plugin.video.youtube/play/?video_id=%s' % vid_id
151 mviddata
['thumb'] = item
.get('strTrackThumb', '')
152 mvids
.append(mviddata
)