Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Update plugin.py #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions SpiffyRadio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def announce_to_channels(self):
for channel in channels:
self.irc.sendMsg(ircmsgs.privmsg(channel, message))
else:
track_info = (self.last_track["artist"], self.last_track["title"])
track_info = (self.last_track["title"])
self.log.info("SpiffyRadio: track has not changed - still playing \"%s - %s\". Not announcing." % track_info)

except Exception as e:
Expand All @@ -104,7 +104,7 @@ def get_current_track_info(self):

if response is not None and "icestats" in response:
try:
current_track = response["icestats"]["source"][0]
current_track = response["icestats"]["source"]

"""
This horrible API returns an object if there is only one track
Expand All @@ -114,10 +114,10 @@ def get_current_track_info(self):
# current_track = response["icestats"]["source"]

if self.last_track is not None:
artistChanged = current_track["artist"] != self.last_track["artist"]
artistChanged = current_track["server_name"] != self.last_track["server_name"]
trackChanged = current_track["title"] != self.last_track["title"]

self.track_has_changed = artistChanged and trackChanged
self.track_has_changed = trackChanged
self.last_track = current_track

return current_track
Expand All @@ -138,7 +138,7 @@ def get_current_track_info(self):
def get_now_playing_template(self, current_track):
template = self.registryValue("nowPlayingTemplate")

template = template.replace("$artist", current_track["artist"])
template = template.replace("$artist", current_track["server_name"])
template = template.replace("$title", current_track["title"])
template = template.replace("$listeners", str(current_track["listeners"]))
template = template.replace("$listenurl", current_track["listenurl"])
Expand Down