mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-30 23:41:09 -05:00
AzuraCast: add .pls link
This commit is contained in:
parent
102f078db9
commit
771d7d8e07
@ -26,7 +26,7 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
self.__parent = super(AzuraCast, self)
|
self.__parent = super(AzuraCast, self)
|
||||||
self.__parent.__init__(irc)
|
self.__parent.__init__(irc)
|
||||||
|
|
||||||
self.BASE_API = self.registryValue('AzuraAPI') + '{endpoint}'
|
self.BASE_API = self.registryValue('AzuraAPI')
|
||||||
self.PUB_URL = self.registryValue('PublicURL') + '#{name}'
|
self.PUB_URL = self.registryValue('PublicURL') + '#{name}'
|
||||||
|
|
||||||
def _fetchURL(self, url, headers=None):
|
def _fetchURL(self, url, headers=None):
|
||||||
@ -56,8 +56,7 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
options = dict(options)
|
options = dict(options)
|
||||||
station = options.get('station')
|
station = options.get('station')
|
||||||
endpoint = 'nowplaying'
|
url = self.BASE_API + 'nowplaying'
|
||||||
url = self.BASE_API.format(endpoint=endpoint)
|
|
||||||
|
|
||||||
data = self._fetchURL(url)
|
data = self._fetchURL(url)
|
||||||
|
|
||||||
@ -77,7 +76,8 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
url = ' | {}'.format(d['public_url']) if d['public_url'] else ''
|
url = ' | {}'.format(d['public_url']) if d['public_url'] else ''
|
||||||
np = '{}'.format(d['nowplaying']['song']['text'])
|
np = '{}'.format(d['nowplaying']['song']['text'])
|
||||||
listeners = " | Listeners: {}".format(d['listeners']['current'])
|
listeners = " | Listeners: {}".format(d['listeners']['current'])
|
||||||
string = '{} {}{}{}{}'.format(prefix, np, album, listeners, url)
|
listen = " | Audio player link: {}/public/{}/playlist/pls".format(self.BASE_API.replace("/api/", ""), d['id'])
|
||||||
|
string = '{} {}{}{}{}{}'.format(prefix, np, album, listeners, url, listen)
|
||||||
output.append(string)
|
output.append(string)
|
||||||
else:
|
else:
|
||||||
# all stations?
|
# all stations?
|
||||||
@ -88,7 +88,8 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
url = ' | {}'.format(d['public_url']) if d['public_url'] else ''
|
url = ' | {}'.format(d['public_url']) if d['public_url'] else ''
|
||||||
np = '{}'.format(d['nowplaying']['song']['text'])
|
np = '{}'.format(d['nowplaying']['song']['text'])
|
||||||
listeners = " | Listeners: {}".format(d['listeners']['current'])
|
listeners = " | Listeners: {}".format(d['listeners']['current'])
|
||||||
string = '{} {}{}{}{}'.format(prefix, np, album, listeners, url)
|
listen = " | Audio player link: {}/public/{}/playlist/pls".format(self.BASE_API.replace("/api/", ""), d['id'])
|
||||||
|
string = '{} {}{}{}{}{}'.format(prefix, np, album, listeners, url, listen)
|
||||||
output.append(string)
|
output.append(string)
|
||||||
|
|
||||||
for string in output:
|
for string in output:
|
||||||
@ -103,8 +104,7 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
options = dict(options)
|
options = dict(options)
|
||||||
station = options.get('station')
|
station = options.get('station')
|
||||||
endpoint = 'nowplaying'
|
url = self.BASE_API + 'nowplaying'
|
||||||
url = self.BASE_API.format(endpoint=endpoint)
|
|
||||||
|
|
||||||
data = self._fetchURL(url)
|
data = self._fetchURL(url)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user