mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 00:44:00 +01:00
first full commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import sys
|
||||
import musicbrainz2.webservice as ws
|
||||
import musicbrainz2.model as m
|
||||
|
||||
def findArtist(name):
|
||||
|
||||
if len(name) == 0 or name == 'Add an artist':
|
||||
return '''<p align="right"><font color="red">Please enter an artist</font></p>'''
|
||||
|
||||
q = ws.Query()
|
||||
|
||||
f = ws.ArtistFilter(name, limit=5)
|
||||
artistResults = ws.Query().getArtists(ws.ArtistFilter(name, limit=5))
|
||||
|
||||
if len(artistResults) > 1:
|
||||
|
||||
return '''We found a few different artists. Which one did you want?<br /><br />'''
|
||||
|
||||
for result in artistResults:
|
||||
artist = result.artist
|
||||
return '''<a href="/addArtist?artistid=%s"> %s </a><br />''' % (artist.id, artist.name)
|
||||
|
||||
elif len(artistRestuls) == 1:
|
||||
|
||||
return '''Ok, we're going to add %s''' % artist.name
|
||||
|
||||
else:
|
||||
|
||||
return '''We couldn't find any artists!'''
|
||||
Reference in New Issue
Block a user