From 8ab886dfe208427db808c0134ede091b2709b3c0 Mon Sep 17 00:00:00 2001 From: markjfine Date: Mon, 26 Apr 2021 14:50:01 -0400 Subject: [PATCH] Add Include Station Art Adds the ability to choose to display or not display any cover art generated by the station when downloading cover art from MusicBrainz. --- README.md | 3 ++- nrsc5-dui.py | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 173d6f9..a2134ff 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ Enter a PPM correction value if your RTL-SDR dongle has an offset. Enter the IP address that rtl_tcp is listening to and check the Enabled box if you are using a remote RTL-SDR. Enter the number of the desired device if you have more than one RTL-SDR dongle. Check `Log to file` to enable writing debug information from nrsc5 to nrsc5.log. -Check `DL Album Art` to enable automated downloading of album art from MusicBrainz. +Check `Download Album Art` to enable automated downloading of album art from MusicBrainz. +Check `Include Station Art` to display album art that is generated by the station in addition to downloading from MusicBrainz. ## Playing Enter the frequency in MHz of the station you want to play and either click the triangular Play button on the toolbar, or just hit return. When the receiver attains synchronization, the pilot in the lower left corner of the status bar will turn green. It will return to gray if synchronization is lost. If the device itself becomes 'lost', the pilot will turn red to indicate an error has occurred (this is the theory, though I've yet to see this status message happen in practice). The synchronization process may take about 10 seconds, and the station will begin to play. This depends upon signal strength and whether it's relatively free from adjacent interference. After a short while, the station name will appear to the right of the frequency, and the available streams will show on a row of buttons just beneath the frequency entry. Clicking one of these buttons will change to that particular stream. Note: No settings other than stream may be changed while the device is playing. diff --git a/nrsc5-dui.py b/nrsc5-dui.py index b5f273b..abc5c83 100644 --- a/nrsc5-dui.py +++ b/nrsc5-dui.py @@ -301,6 +301,11 @@ class NRSC5_DUI(object): if (widget.get_label() != ""): widget.get_window().set_cursor(self.hand_cursor) + def on_cbCovers_clicked(self, btn): + dlCoversSet = self.cbCovers.get_active() + self.lblCoverIncl.set_sensitive(dlCoversSet) + self.cbCoverIncl.set_sensitive(dlCoversSet) + def img_to_pixbuf(self,img): """convert PIL.Image to GdkPixbuf.Pixbuf""" data = GLib.Bytes.new(img.tobytes()) @@ -1464,7 +1469,9 @@ class NRSC5_DUI(object): #if (p == self.streams[int(self.streamNum)][0]): if (coverStream > -1): if coverStream == self.streamNum: - self.streamInfo["Cover"] = fileName + #set cover only if downloading covers and including station covers + if (self.cbCoverIncl.get_active() or (not self.cbCovers.get_active())): + self.streamInfo["Cover"] = fileName self.debugLog("Got Album Cover: " + fileName) #print("got Cover:"+fileName+" for stream "+str(coverStream)) #elif (p == self.streams[int(self.spinStream.get_value()-1)][1]): @@ -1585,6 +1592,8 @@ class NRSC5_DUI(object): self.cbDevIP = builder.get_object("cbDevIP") self.cbLog = builder.get_object("cbLog") self.cbCovers = builder.get_object("cbCovers") + self.lblCoverIncl = builder.get_object("lblCoverIncl") + self.cbCoverIncl = builder.get_object("cbCoverIncl") self.btnPlay = builder.get_object("btnPlay") self.btnStop = builder.get_object("btnStop") self.btnBookmark = builder.get_object("btnBookmark") @@ -1788,6 +1797,8 @@ class NRSC5_DUI(object): self.cbLog.set_active(config["LogToFile"]) if ("DLoadArt" in config): self.cbCovers.set_active(config["DLoadArt"]) + if ("StationArt" in config): + self.cbCoverIncl.set_active(config["StationArt"]) if ("UseIP" in config): self.cbDevIP.set_active(config["UseIP"]) if ("DevIP" in config): @@ -1873,6 +1884,7 @@ class NRSC5_DUI(object): "DevIP" : self.txtDevIP.get_text(), "LogToFile" : self.cbLog.get_active(), "DLoadArt" : self.cbCovers.get_active(), + "StationArt" : self.cbCoverIncl.get_active(), "UseIP" : self.cbDevIP.get_active(), "Bookmarks" : self.bookmarks, "MapData" : self.mapData,