mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-05-02 08:21:12 -05:00
AzuraCast: add viewers to nowplaying
This commit is contained in:
parent
3b46eda5fd
commit
19d7f7e705
@ -71,6 +71,8 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
return
|
return
|
||||||
data = self._parseData(data)
|
data = self._parseData(data)
|
||||||
output = []
|
output = []
|
||||||
|
c = None
|
||||||
|
views = None
|
||||||
if station:
|
if station:
|
||||||
# one station only
|
# one station only
|
||||||
d = data.get(station.lower())
|
d = data.get(station.lower())
|
||||||
@ -86,15 +88,25 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
listen = " | Audio Player: {}/public/{}/playlist/pls".format(
|
listen = " | Audio Player: {}/public/{}/playlist/pls".format(
|
||||||
self.BASE_API.replace("/api/", ""), d["id"]
|
self.BASE_API.replace("/api/", ""), d["id"]
|
||||||
)
|
)
|
||||||
string = "{} {}{}{}{}{}".format(prefix, np, album, listeners, url, listen)
|
|
||||||
if self.VID_URL:
|
if self.VID_URL:
|
||||||
url = self.VID_URL + "stats.json.php"
|
data_url = self.VID_URL + "stats.json.php"
|
||||||
data = self._fetchURL(url)
|
data = self._fetchURL(data_url)
|
||||||
d = data.get("applications")[0]
|
d = data.get("applications")[0]
|
||||||
if d:
|
if d:
|
||||||
c = d.get("channelName")
|
c = d.get("channelName")
|
||||||
if c:
|
users = d.get("users")
|
||||||
string += " | Video Player: {}?c={}".format(self.VID_URL, c)
|
if users:
|
||||||
|
views = users.get("online")
|
||||||
|
if c and views:
|
||||||
|
viewers = " | Viewers: {}".format(views)
|
||||||
|
watch = " | Video Player: {}?c={}".format(self.VID_URL, c)
|
||||||
|
string = "{} {}{}{}{}{}{}{}".format(
|
||||||
|
prefix, np, album, listeners, viewers, url, listen, watch
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
string = "{} {}{}{}{}{}".format(
|
||||||
|
prefix, np, album, listeners, url, listen
|
||||||
|
)
|
||||||
output.append(string)
|
output.append(string)
|
||||||
else:
|
else:
|
||||||
# all stations?
|
# all stations?
|
||||||
@ -112,17 +124,25 @@ class AzuraCast(callbacks.Plugin):
|
|||||||
listen = " | Audio Player: {}/public/{}/playlist/pls".format(
|
listen = " | Audio Player: {}/public/{}/playlist/pls".format(
|
||||||
self.BASE_API.replace("/api/", ""), d["id"]
|
self.BASE_API.replace("/api/", ""), d["id"]
|
||||||
)
|
)
|
||||||
string = "{} {}{}{}{}{}".format(
|
|
||||||
prefix, np, album, listeners, url, listen
|
|
||||||
)
|
|
||||||
if self.VID_URL:
|
if self.VID_URL:
|
||||||
url = self.VID_URL + "stats.json.php"
|
data_url = self.VID_URL + "stats.json.php"
|
||||||
data = self._fetchURL(url)
|
data = self._fetchURL(data_url)
|
||||||
d = data.get("applications")[i]
|
d = data.get("applications")[i]
|
||||||
if d:
|
if d:
|
||||||
c = d.get("channelName")
|
c = d.get("channelName")
|
||||||
if c:
|
users = d.get("users")
|
||||||
string += " | Video Player: {}?c={}".format(self.VID_URL, c)
|
if users:
|
||||||
|
views = users.get("online")
|
||||||
|
if c and views:
|
||||||
|
viewers = " | Viewers: {}".format(views)
|
||||||
|
watch = " | Video Player: {}?c={}".format(self.VID_URL, c)
|
||||||
|
string = "{} {}{}{}{}{}{}{}".format(
|
||||||
|
prefix, np, album, listeners, viewers, url, listen, watch
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
string = "{} {}{}{}{}{}".format(
|
||||||
|
prefix, np, album, listeners, url, listen
|
||||||
|
)
|
||||||
i += 1
|
i += 1
|
||||||
output.append(string)
|
output.append(string)
|
||||||
for string in output:
|
for string in output:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user