diff --git a/headphones/notifiers.py b/headphones/notifiers.py index dec4df59..63f61c9a 100644 --- a/headphones/notifiers.py +++ b/headphones/notifiers.py @@ -759,9 +759,12 @@ class BOXCAR: self.url = 'https://new.boxcar.io/api/notifications' - def notify(self, title, message): + def notify(self, title, message, rgid=None): try: + if rgid: + message += '

MusicBrainz' % rgid + data = urllib.urlencode({ 'user_credentials': headphones.BOXCAR_TOKEN, 'notification[title]': title.encode('utf-8'), diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index b163a01e..0223a0a4 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -410,7 +410,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list, librarysync.libraryScan(dir=albumpath, append=True, ArtistID=release['ArtistID'], ArtistName=release['ArtistName']) logger.info(u'Post-processing for %s - %s complete' % (release['ArtistName'], release['AlbumTitle'])) - + if headphones.GROWL_ENABLED: pushmessage = release['ArtistName'] + ' - ' + release['AlbumTitle'] logger.info(u"Growl request") @@ -483,7 +483,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list, pushmessage = release['ArtistName'] + ' - ' + release['AlbumTitle'] logger.info(u"Sending Boxcar2 notification") boxcar = notifiers.BOXCAR() - boxcar.notify('Headphones processed: ' + pushmessage, "Download and Postprocessing completed") + boxcar.notify('Headphones processed: ' + pushmessage, "Download and Postprocessing completed", release['AlbumID']) def embedAlbumArt(artwork, downloaded_track_list): logger.info('Embedding album art') diff --git a/headphones/searcher.py b/headphones/searcher.py index f1edfb66..c95bffd1 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -702,13 +702,14 @@ def send_to_downloader(data, bestqual, album): # notify artist = album[1] - album = album[2] - title = artist + ' - ' + album + albumname = album[2] + rgid = album[6] + title = artist + ' - ' + albumname provider = bestqual[3] if provider.startswith(("http://", "https://")): provider = provider.split("//")[1] - name = folder_name if folder_name else None + if headphones.GROWL_ENABLED and headphones.GROWL_ONSNATCH: logger.info(u"Sending Growl notification") growl = notifiers.GROWL() @@ -740,11 +741,12 @@ def send_to_downloader(data, bestqual, album): if headphones.OSX_NOTIFY_ENABLED and headphones.OSX_NOTIFY_ONSNATCH: logger.info(u"Sending OS X notification") osx_notify = notifiers.OSX_NOTIFY() - osx_notify.notify(artist, album, 'Snatched: ' + provider + '. ' + name) + osx_notify.notify(artist, albumname, 'Snatched: ' + provider + '. ' + name) if headphones.BOXCAR_ENABLED and headphones.BOXCAR_ONSNATCH: logger.info(u"Sending Boxcar2 notification") + b2msg = 'From ' + provider + '

' + name boxcar = notifiers.BOXCAR() - boxcar.notify('Headphones snatched: ' + title, 'From ' + provider + '. ' + name) + boxcar.notify('Headphones snatched: ' + title, b2msg, rgid) def verifyresult(title, artistterm, term, lossless):