Skip to content

Commit

Permalink
[metadata.generic.artists] 1.0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
ronie committed Nov 29, 2023
1 parent 53101ab commit 4e671bc
Show file tree
Hide file tree
Showing 82 changed files with 2,027 additions and 2,697 deletions.
4 changes: 2 additions & 2 deletions addons/metadata.generic.artists/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="metadata.generic.artists" name="Generic Artist Scraper" version="1.0.14" provider-name="Team Kodi">
<addon id="metadata.generic.artists" name="Generic Artist Scraper" version="1.0.18" provider-name="Team Kodi">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="xbmc.metadata" version="2.1.0"/>
Expand All @@ -16,6 +16,6 @@
<assets>
<icon>resources/icon.png</icon>
</assets>
<news>- add wikipedia support</news>
<news>- add artist cutout image support</news>
</extension>
</addon>
14 changes: 14 additions & 0 deletions addons/metadata.generic.artists/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
v1.0.18
- add video links from theaudiodb

v1.0.17
- add artist cutout image support

v1.0.16
- fix extra art sorting
- language updates

v1.0.15
- sort extra art
- language updates

v1.0.14
- add translations

Expand Down
37 changes: 36 additions & 1 deletion addons/metadata.generic.artists/lib/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .nfo import nfo_geturl
from .theaudiodb import theaudiodb_artistdetails
from .theaudiodb import theaudiodb_artistalbums
from .theaudiodb import theaudiodb_mvids
from .wikipedia import wikipedia_artistdetails
from .utils import *

Expand Down Expand Up @@ -110,6 +111,7 @@ def __init__(self, action, key, artist, url, nfo, settings):
elif action == 'getdetails':
details = {}
discography = {}
mvids = {}
url = json.loads(url)
artist = url.get('artist')
mbartistid = url.get('mbartistid')
Expand All @@ -128,6 +130,10 @@ def __init__(self, action, key, artist, url, nfo, settings):
thread = Thread(target = self.get_discography, args = (mbartistid, 'theaudiodb', discography))
threads.append(thread)
thread.start()
# theaudiodb mvids
thread = Thread(target = self.get_videolinks, args = (mbartistid, 'theaudiodb', mvids))
threads.append(thread)
thread.start()
# wait for musicbrainz to finish
threads[0].join()
# check if we have a result:
Expand Down Expand Up @@ -182,6 +188,12 @@ def __init__(self, action, key, artist, url, nfo, settings):
else:
details[site] = {}
details[site]['albums'] = albumlist
for site, mvidlist in mvids.items():
if site in details:
details[site]['mvids'] = mvidlist
else:
details[site] = {}
details[site]['mvids'] = mvidlist
result = self.compile_results(details)
if result:
self.return_details(result)
Expand Down Expand Up @@ -327,6 +339,21 @@ def get_discography(self, param, site, discography):
discography[site] = albumresults
return discography

def get_videolinks(self, param, site, videolinks):
json = True
if site == 'theaudiodb':
#theaudiodb mvid links
mvidurl = AUDIODBURL % (AUDIODBKEY, AUDIODBMVIDS % param)
scraper = theaudiodb_mvids
mviddata = get_data(mvidurl, json)
if not mviddata:
return
mvidresults = scraper(mviddata)
if not mvidresults:
return
videolinks[site] = mvidresults
return videolinks

def compile_results(self, details):
result = {}
thumbs = []
Expand Down Expand Up @@ -380,7 +407,8 @@ def compile_results(self, details):
thumbnails = []
fanart.reverse()
fanarts = []
# the order for extra art does not matter
# extra art from most accurate sources first
extras.reverse()
extraart = []
for thumblist in thumbs:
for item in thumblist:
Expand Down Expand Up @@ -500,4 +528,11 @@ def return_details(self, item):
listitem.setProperty('artist.album%i.year' % (count + 1), album['year'])
if 'musicbrainzreleasegroupid' in album:
listitem.setProperty('artist.album%i.musicbrainzreleasegroupid' % (count + 1), album['musicbrainzreleasegroupid'])
if 'mvids' in item:
listitem.setProperty('artist.videolinks', str(len(item['mvids'])))
for count, mvid in enumerate(item['mvids']):
listitem.setProperty('artist.videolink%i.title' % (count + 1), mvid['title'])
listitem.setProperty('artist.videolink%i.mbtrackid' % (count + 1), mvid['mbtrackid'])
listitem.setProperty('artist.videolink%i.url' % (count + 1), mvid['url'])
listitem.setProperty('artist.videolink%i.thumb' % (count + 1), mvid['thumb'])
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=listitem)
30 changes: 30 additions & 0 deletions addons/metadata.generic.artists/lib/theaudiodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def theaudiodb_artistdetails(data):
extradata['preview'] = item['strArtistBanner'] + '/preview'
extradata['aspect'] = 'banner'
extras.append(extradata)
if item.get('strArtistCutout',''):
extradata = {}
extradata['image'] = item['strArtistCutout']
extradata['preview'] = item['strArtistCutout'] + '/preview'
extradata['aspect'] = 'cutout'
extras.append(extradata)
if extras:
artistdata['extras'] = extras
return artistdata
Expand All @@ -121,3 +127,27 @@ def theaudiodb_artistalbums(data):
albumdata['year'] = item.get('intYearReleased', '')
albums.append(albumdata)
return albums

def theaudiodb_mvids(data):
mvids = []
mvidlist = data.get('mvids', [])
if mvidlist:
for item in mvidlist:
mviddata = {}
mviddata['title'] = item['strTrack']
mviddata['mbtrackid'] = item.get('strMusicBrainzID')
tempurl = item.get('strMusicVid', '')
# Find and remove extraneous data in the URL leaving just the video ID
index = tempurl.find('=')
vid_id = tempurl[index+1:]
http_index = vid_id.find('//youtu.be/')
if http_index != -1:
vid_id = vid_id[http_index+11:]
check1 = vid_id.find('/www.youtube.com/embed/')
if check1 != -1:
vid_id = vid_id[check1 + 23:check1 + 34]
mviddata['url'] = \
'plugin://plugin.video.youtube/play/?video_id=%s' % vid_id
mviddata['thumb'] = item.get('strTrackThumb', '')
mvids.append(mviddata)
return mvids
1 change: 1 addition & 0 deletions addons/metadata.generic.artists/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
AUDIODBSEARCH = 'search.php?s=%s'
AUDIODBDETAILS = 'artist-mb.php?i=%s'
AUDIODBDISCOGRAPHY = 'discography-mb.php?s=%s'
AUDIODBMVIDS = 'mvid-mb.php?i=%s'

MUSICBRAINZURL = 'https://musicbrainz.org/ws/2/artist/%s'
MUSICBRAINZSEARCH = '?query="%s"&fmt=json'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,95 +2,84 @@
# Addon Name: Generic Artist Scraper
# Addon id: metadata.generic.artists
# Addon Provider: Team Kodi
# Translators:
# TeamKODI <[email protected]>, 2020
#
msgid ""
msgstr ""
"Project-Id-Version: KODI Main\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/xbmc/issues\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2020-09-08 20:22+0000\n"
"Last-Translator: TeamKODI <[email protected]>, 2020\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: Afrikaans (South Africa) (https://www.transifex.com/teamxbmc/teams/40581/af_ZA/)\n"
"Language: af_ZA\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: af_ZA\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgctxt "Addon Summary"
msgid "Generic music scraper for artists"
msgstr ""

msgctxt "Addon Description"
msgid "Searches for artist information and artwork across multiple websites."
msgstr ""

msgctxt "#30000"
msgid "Preferences"
msgstr "Voorkeure"

msgctxt "#30001"
msgid "Preferred language for artist biography"
msgstr ""
msgstr "Verkose taal vir kunstenaar biografie"

msgctxt "#30002"
msgid "Prefer biography from"
msgstr ""
msgstr "Verkies biografie vanaf"

msgctxt "#30003"
msgid "Prefer discography from"
msgstr ""
msgstr "Verkies diskografie vanaf"

msgctxt "#30004"
msgid "Prefer genres from"
msgstr ""
msgstr "Verkies genres vanaf"

msgctxt "#30005"
msgid "Prefer styles from"
msgstr ""
msgstr "Verkies style vanaf"

msgctxt "#30006"
msgid "Prefer moods from"
msgstr ""
msgstr "Verkies buie vanaf"

msgctxt "#30101"
msgid "Allow less accurate search results"
msgstr ""
msgstr "Laat minder akkurate soek resultate toe"

msgctxt "#30201"
msgid ""
"If available, the artist biography will be downloaded in the selected "
"language. It will fallback to English."
msgstr ""
msgid "If available, the artist biography will be downloaded in the selected language. It will fallback to English."
msgstr "Indien beskikbaar, sal die kunstenaar biografie afgelaai word in die geselekteerde taal. Dit sal terugval na Engels."

msgctxt "#30202"
msgid ""
"Try to get the artist biography using the selected scraper. Other scrapers "
"will be used if the preferred scraper returns no results."
msgstr ""
msgid "Try to get the artist biography using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr "Probeer om die kunstenaar biografie te kry deur die geselekteerde skraper te gebruik. Ander skrapers sal gebruik word as die verkose skraper geen resultate oplewer nie."

msgctxt "#30203"
msgid ""
"Try to get the artist discography using the selected scraper. Other scrapers"
" will be used if the preferred scraper returns no results."
msgstr ""
msgid "Try to get the artist discography using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr "Probeer om die kunstenaar diskografie te kry deur die geselekteerde skraper te gebruik. Ander skrapers sal gebruik word as die verkose skraper geen resultate oplewer nie."

msgctxt "#30204"
msgid ""
"Try to get genre info using the selected scraper. Other scrapers will be "
"used if the preferred scraper returns no results."
msgstr ""
msgid "Try to get genre info using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr "Probeer om genre inligting te kry deur die geselekteerde skraper te gebruik. Ander skrapers sal gebruik word as die verkose skraper geen resultate oplewer nie."

msgctxt "#30205"
msgid ""
"Try to get style info using the selected scraper. Other scrapers will be "
"used if the preferred scraper returns no results."
msgstr ""
msgid "Try to get style info using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr "Probeer om styl inligting te kry deur die geselekteerde skraper te gebruik. Ander skrapers sal gebruik word as die verkose skraper geen resultate oplewer nie."

msgctxt "#30206"
msgid ""
"Try to get mood info using the selected scraper. Other scrapers will be used"
" if the preferred scraper returns no results."
msgstr ""
msgid "Try to get mood info using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr "Probeer om bui inligting te kry deur die geselekteerde skraper te gebruik. Ander skrapers sal gebruik word as die verkose skraper geen resultate oplewer nie."

msgctxt "#30301"
msgid ""
"If Musicbrainz does not provide a link to allmusic and/or discogs, we can "
"search those sites based on artistname. Since artist names are not unique, "
"this could potentially result in a mixture of metadata from multiple artists"
" by the same name."
msgstr ""
msgid "If Musicbrainz does not provide a link to allmusic and/or discogs, we can search those sites based on artistname. Since artist names are not unique, this could potentially result in a mixture of metadata from multiple artists by the same name."
msgstr "As Musicbrainz nie 'n skakel verskaf na allmusic en/of discogs, kan ons daardie werwe deursoek gebasseer op artistname. Aangesien kunstenaar name nie uniek is nie, kan dit potensieel volg tot 'n mengsel van metadata vanaf veelvuldige kunstenaars met dieselfde naam."
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
# Addon Name: Generic Artist Scraper
# Addon id: metadata.generic.artists
# Addon Provider: Team Kodi
# Translators:
# samson <[email protected]>, 2020
#
msgid ""
msgstr ""
"Project-Id-Version: KODI Main\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/xbmc/issues\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2020-09-08 20:22+0000\n"
"Last-Translator: samson <[email protected]>, 2020\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: Amharic (Ethiopia) (https://www.transifex.com/teamxbmc/teams/40581/am_ET/)\n"
"Language: am_ET\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: am_ET\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgctxt "Addon Summary"
msgid "Generic music scraper for artists"
msgstr ""

msgctxt "Addon Description"
msgid "Searches for artist information and artwork across multiple websites."
msgstr ""

msgctxt "#30000"
msgid "Preferences"
msgstr "ምርጫዎች"
Expand Down Expand Up @@ -52,45 +57,29 @@ msgid "Allow less accurate search results"
msgstr ""

msgctxt "#30201"
msgid ""
"If available, the artist biography will be downloaded in the selected "
"language. It will fallback to English."
msgid "If available, the artist biography will be downloaded in the selected language. It will fallback to English."
msgstr ""

msgctxt "#30202"
msgid ""
"Try to get the artist biography using the selected scraper. Other scrapers "
"will be used if the preferred scraper returns no results."
msgid "Try to get the artist biography using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr ""

msgctxt "#30203"
msgid ""
"Try to get the artist discography using the selected scraper. Other scrapers"
" will be used if the preferred scraper returns no results."
msgid "Try to get the artist discography using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr ""

msgctxt "#30204"
msgid ""
"Try to get genre info using the selected scraper. Other scrapers will be "
"used if the preferred scraper returns no results."
msgid "Try to get genre info using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr ""

msgctxt "#30205"
msgid ""
"Try to get style info using the selected scraper. Other scrapers will be "
"used if the preferred scraper returns no results."
msgid "Try to get style info using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr ""

msgctxt "#30206"
msgid ""
"Try to get mood info using the selected scraper. Other scrapers will be used"
" if the preferred scraper returns no results."
msgid "Try to get mood info using the selected scraper. Other scrapers will be used if the preferred scraper returns no results."
msgstr ""

msgctxt "#30301"
msgid ""
"If Musicbrainz does not provide a link to allmusic and/or discogs, we can "
"search those sites based on artistname. Since artist names are not unique, "
"this could potentially result in a mixture of metadata from multiple artists"
" by the same name."
msgid "If Musicbrainz does not provide a link to allmusic and/or discogs, we can search those sites based on artistname. Since artist names are not unique, this could potentially result in a mixture of metadata from multiple artists by the same name."
msgstr ""
Loading

0 comments on commit 4e671bc

Please sign in to comment.