config value for logo

This commit is contained in:
Pratyush Desai 2021-10-31 09:04:20 +05:30
parent daf56214d0
commit c17a0d4b8e
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
2 changed files with 10 additions and 5 deletions

View File

@ -57,5 +57,8 @@ conf.registerGlobalValue(Spotify, 'clientID',
conf.registerGlobalValue(Spotify, 'clientSECRET',
registry.string('', """ Sets the ClientSECRET obtainable from https://developer.spotify.com/""", private=True))
conf.registerChannelValue(Spotify, 'Logo',
registry.string(' 🎶️ \x02\x0301,03SPOTIFY\x0f 🎶️',"""Formatting prependended to response"""))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -50,7 +50,8 @@ class Spotify(callbacks.Plugin):
threaded = True
def sp(self, irc, msg, args, song):
"""<artist> <song>
"""[<artist>] [<song>] [<trackName>]
The track details for which the URL/trackID is desired.
"""
clientID = self.registryValue('clientID')
@ -74,13 +75,14 @@ class Spotify(callbacks.Plugin):
results = spotified.search(song)
items = results['tracks']['items']
if len(items) > 0:
track = items[0]
track_uri = track['uri']
track = items.get(0)
track_uri = track.get('uri')
track_artist = track['artists'][0]['name']
track_album = track['album']['name']
track_name =track['name']
track_name =track.get('name')
track_url = track['external_urls']['spotify']
re = utils.str.format(' 🎶️ \x02\x0301,03SPOTIFY\x0f 🎶️ %s by %s from %s at %s and uri %s', track_name, track_artist, track_album, track_url, track_uri)
logo = self.registryValue('Logo')
re = utils.str.format('%s %s by %s from %s at %s and uri %s', logo, track_name, track_artist, track_album, track_url, track_uri)
irc.reply(re)
else:
irc.error('No Results')