trackupdate polls Apple Music for information about the currently playing track and hands this information to target plugins to perform various tasks.
grahams, updated
🕥
2023-01-15 16:22:57
trackupdate v1.2
(c) 2009-2020 - Sean M. Graham
This code exists under an MIT license, see LICENSE for details
--
trackupdate polls Apple Music every 10 seconds for information about the
currently playing track and hands this information to target plugins to
perform various tasks. The currently included plugins are:
- StdioTarget - Prints the current artist and track to stdout (aka "the
terminal")
- AudioHijackTarget - Places the current track info into Audio Hijack's
"NowPlaying.txt" file
- LadioCastTarget - Updates the metadata in Ladiocast using Applescript
- ListFileTarget - Creates some text files which can easily be pasted into
Mediawiki and HTML, and also creates a simple track list text file
- SlackTarget - Posts track info into a Slack channel
- TwitterTarget - Posts each track's artist and name to a twitter account
specified in the .rc file. Requires that python-twitter is installed
(http://code.google.com/p/python-twitter/)
trackupdate and some of its plugins require configuration data, which is
stored in a file named ~/.trackupdaterc. See example-trackupdaterc for
details on the various configuration options.
While this script is running, you may notice a persistent bouncing dock icon
for python. This annoyed me, so I removed it by editing:
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/Info.plist
and adding the following key to the tag:
NSUIElement
1
Issues
opened on 2021-01-26 03:40:43 by grahams
Right now we use a field in the rcfile to determine the default cover image path. This is ok, but it should default to a pattern or even the current date or something.
opened on 2021-01-26 03:39:47 by grahams
If the file on disk does not exist, we shit the bed with a stack trace. Also, a failure here should not crash the application.
Line of interest: https://github.com/grahams/trackupdate/blob/8dd9bc3249e517b30e581fa801ee6e68e323522d/plugins/BackblazeTarget.py#L78
Stacktrace:
```bigpapi:[~/src/trackupdate]$ ./trackupdate.py -e 338 [master]
Traceback (most recent call last):
File "./trackupdate.py", line 333, in updateTrack
plugin.logTrack(track, startTime)
File "/Users/grahams/src/trackupdate/plugins/BackblazeTarget.py", line 78, in logTrack
self.bucket.upload_local_file(
File "/usr/local/anaconda3/envs/trackupdate/lib/python3.8/site-packages/logfury/v0_1/trace_call.py", line 84, in wrapper
return function(wrapee_args, **wrapee_kwargs)
File "/usr/local/anaconda3/envs/trackupdate/lib/python3.8/site-packages/b2sdk/bucket.py", line 402, in upload_local_file
upload_source = UploadSourceLocalFile(local_path=local_file, content_sha1=sha1_sum)
File "/usr/local/anaconda3/envs/trackupdate/lib/python3.8/site-packages/b2sdk/transfer/outbound/upload_source.py", line 84, in init
raise InvalidUploadSource(local_path)
b2sdk.exception.InvalidUploadSource: Invalid upload source: /Users/grahams/Resilio Sync/Public/programme/covers/20210125.jpg
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./trackupdate.py", line 381, in
trackUpdate = TrackUpdate(sys.argv[1:])
File "./trackupdate.py", line 190, in init
self.liveLoop()
File "./trackupdate.py", line 231, in liveLoop
self.processCurrentTrack(track)
File "./trackupdate.py", line 318, in processCurrentTrack
self.updateTrack(track, self.startTime)
File "./trackupdate.py", line 335, in updateTrack
logging.error(plugin + ": Error trying to update track")
TypeError: unsupported operand type(s) for +: 'BackblazeTarget' and 'str'
```