iBroadcast plugin for Beets
Project description
Beets iBroadcast Plugin
This plugin lets you upload music from your beets library to the iBroadcast streaming service.
Setup
-
Install the plugin into your local environment with:
pip install beets-ibroadcast
-
Enable the plugin by adding
ibroadcast
to yourplugins:
section in your beets config file. -
Configure your iBroadcast credentials:
ibroadcast: username: <your email address> password: <your password>
Be sure to put quotes around your password if it includes any special characters.
Usage
beet ibroadcast <query>
- All tracks matching the query are uploaded as needed.
- Usertags are synced with the tags on iBroadcast.
- Playlists are synced as playlists on iBroadcast, as long as the tracks of the playlist are all covered by the given query.
FAQ
How do I know this plugin won't destroy my iBroadcast collection?
You don't. But it tries to be careful and guards against many edge cases.
If you want to see what the plugin will do without actually doing it, you can
pass the -p
(for "pretend") flag:
beet ibroadcast -p
I recommend starting with a small query, to get a feel for how it works. E.g.:
beet ibroadcast -p artist:Offspring album:Americana
If you like what you see, do it again without -p
and see how it goes.
Once you have some confidence in the tool, you can go nuts with larger queries.
How does beets-ibroadcast avoid redundant uploads?
When a track is uploaded, the plugin attaches ib_uploadtime
and ib_trackid
flexible attributes to the track. The next time that track is considered for
upload, these attributes are examined: if the track's mtime
is older than its
ib_uploadtime
, the track is assumed to be up to date, and the upload is
skipped.
For tracks where mtime
is newer, the track is uploaded again, and the
previous track ID is trashed. As such, obsolete previous versions of tracks
will appear in your iBroadcast trash until it is emptied.
Regardless: before uploading, the track's MD5 checksum is computed, and if the server already has a track with that checksum, the upload is skipped. As such, if you upload tracks with a different uploader than beets-ibroadcast, they will still be skipped (although as of this writing, beets-ibroadcast will read such files to compute their checksums every time they match a query, which will impact performance).
You can use the -f
flag to skip these checks and force reupload of tracks.
How are tags synced?
This plugin syncs tags on the iBroadcast side with the usertags
flexible
attribute, in a way compatible with the usertag plugin.
If you modify a track's tags locally (e.g. via beet addtag
), those changes
will be synced to iBroadcast. If you modify a track's tags remotely (e.g. via
the iBroadcast website), those changes will be synced to the beets database.
In order to know whether a track's tags were changed locally, remotely, or
both since the last sync, the current state of the tags is stored in an
ib_tagids
flexible attribute upon each successful sync. This strategy makes
it clear whether, for example, a tag that exists remotely but not locally was
deleted locally versus added remotely; as such, there cannot be tag conflicts.
See the usertag plugin documentation for details on working with tags in your beets database.
How are playlists synced?
The plugin syncs playlists on the iBroadcast side with M3U playlist files stored locally in your playlists directory, as configured by the playlist plugin.
If you modify a playlist locally (e.g. by editing an M3U file), those changes will be synced to iBroadcast. If you modify a playlist remotely (e.g. via the iBroadcast website), those changes will be noticed, but not acted upon; instead, a message will be printed that the plugin is not smart enough to update your corresponding M3U file yet. PRs welcome to implement this feature! If a playlist has been modified both locally and remotely, the plugin will report the situation, but take no action.
In order to know whether a playlist's tracks were changed locally, remotely,
or both since the last sync, the playlist's current state is stored in a hidden
file .ibroadcast-playlists.json
in the base directory of your beets library.
See the playlist plugin documentation for details on working with playlists in your beets library.
How can I upload all my playlists at once?
One gotcha with playlist syncing is that playlists can only be synced from local to remote when the query you pass to the plugin matches all tracks of a playlist. So one simple way to sync all your playlists is to upload your entire beets library, by passing an empty query:
beet ibroadcast
What if you don't want to upload your entire beets library to iBroadcast, though, but you still want to upload all tracks that are part of a playlist? Here is one way to accomplish that:
cat /path/to/playlists/*.m3u | sort -u > /tmp/tracks-to-upload.m3u
beet ibroadcast playlist:/tmp/tracks-to-upload.m3u
rm /tmp/tracks-to-upload.m3u
This will merge all the playlists in /path/to/playlists/*.m3u
into a single
temporary playlist file, which you then feed as your beets query; the
ibroadcast plugin will then ensure all tracks matching the query are uploaded,
and all playlists including those tracks are synced. This trick assumes that
you have configured the playlist directory in your beets config as follows:
playlist:
playlist_dir: /path/to/playlists
Otherwise, the ibroadcast plugin can't find and sync your M3U files.
How can I get more details about why things go wrong?
You can tell beets to be more verbose in its output using the -v
flag. E.g.:
beet -v ibroadcast usertags:favorites
This will cause the ibroadcast plugin to emit more detailed debugging messages.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file beets-ibroadcast-0.5.2.tar.gz
.
File metadata
- Download URL: beets-ibroadcast-0.5.2.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adc3b668305256298b6960d2db6756ad8fc0134f4a4a0ffedfee03a61d5518d4 |
|
MD5 | 4f3863ad8fddb4c17f3cdac2e89b0edb |
|
BLAKE2b-256 | 951b93aeb608e5a250376f9a9646c471f55af25c1fba63cca5f4a95d5bd13066 |
File details
Details for the file beets_ibroadcast-0.5.2-py3-none-any.whl
.
File metadata
- Download URL: beets_ibroadcast-0.5.2-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d2a447d6c685a71069e15415b4ca1ab4edc8e434ed335b470182e1f25fb0a69 |
|
MD5 | 7ee8e5659cadfba555e59898691d3f5b |
|
BLAKE2b-256 | 48294df328a49644c6a70a07ace2d9e46b1956ebaaaacea00ab543e042784268 |