11. Services VeeJay talks to¶
One section for each outside service or group of services: what VeeJay uses it for, how it is reached, and the limits that apply. Each service is reached through its own adapter, so the rest of VeeJay never depends on how a service behaves.
11.1 YouTube and YouTube Music¶
YouTube is where likes start and where videos and their details come from. VeeJay reads playlists and video details (title, channel, views, length, publish date) through the YouTube Data API, with the key kept in the secrets file.
- A call that reads up to 50 video details costs 1 unit. The daily limit is 10,000 units, so search calls, which are limited and expensive, are never used when a cheaper call will do.
- Video details are cached for 7 days, and the cache is read instead of calling again.
- Writing to a playlist costs 50 units for each item. See 3.7.
YouTube Music has no supported interface. Only an unofficial library exists, and it can break without notice. VeeJay treats it as optional.
11.2 Apple Music, Spotify, TIDAL and other platforms¶
What each platform can do with a playlist is in 3.2. How each is reached:
| Platform | Sign-in | Notes |
|---|---|---|
| Apple Music | A developer token for the application and a music user token that the user grants | A playlist can be created and added to. A music video can be added as well as a song. Items are added to the end. |
| TIDAL | OAuth with the authorization-code flow and PKCE, with the playlist read and write permissions | A playlist item is a track or a video. Items can be added, changed and removed. |
| Spotify | OAuth with the playlist-modify permissions | Tracks and episodes only. Up to 100 items can be added in one request. |
Every other platform is one more adapter behind the same interface.
11.3 MusicBrainz, Wikipedia, Wikidata and AcoustID¶
These are the sources of identity and release facts. Which one wins when they disagree is decided by the order in 7.4.
- MusicBrainz supplies the identifiers of artists, release groups and recordings, the credits, and the recording length used to check audio. Requests are kept to about one a second.
- Wikipedia supplies the album, year, disc and track of a song and the article's opening paragraph. It has two routes, the Wikimedia Enterprise API and the public API. When the first stops answering, VeeJay switches to the other at once and tries the first again when its block ends.
- Wikidata links an artist to their other accounts: MusicBrainz, Discogs, AllMusic, IMDb, IMVDb, Spotify, Apple Music, Deezer, Last.fm, Genius, Billboard, YouTube, Facebook, Instagram, X, TikTok, SoundCloud and the official website. It is also a cross-check: the Wikipedia page that Wikidata lists for an artist's MusicBrainz ID must be the page VeeJay found.
- AcoustID fingerprints audio, to confirm that a file really is the recording it should be.
A name is searched in every spelling the database may hold, and a page reached through a redirect that lands on a different title is never taken.
11.4 Search engines¶
Google and Bing are where research begins (7.1). They are used through a signed-in browser, one engine in each of two tabs, at the pace of a person. A search finds candidates and never proves anything. VeeJay stops on any CAPTCHA and never solves one.
11.5 yt-dlp and ffmpeg¶
yt-dlp downloads the videos and ffmpeg converts the audio. Both are started as separate programs and bundled with VeeJay, so there is one product to install. They update automatically on a schedule. Every update is tested before it takes over, and the previous version is kept for a rollback.
11.6 slskd and SoulSeek¶
slskd controls the SoulSeek client through an API, and VeeJay uses it to search and download audio. You supply your own SoulSeek account. How a file and a peer are chosen is in 5.1.
11.7 Lidarr¶
Lidarr is the existing music catalog. VeeJay reads it for album track lists, asking once for each artist and reusing the answer. VeeJay adds the artist of every Primary video to Lidarr, but only after verifying the artist by the album. All artists and all albums are monitored. Lidarr is also the fallback source of audio and the source of an artist's genres. Without Lidarr, the audio step skips it and the song goes on the Needs audio list.
11.8 Lyrics and cover art¶
Lyrics come from LRCLIB, then LRCMux, then QQ, and only synchronized lyrics are kept (5.4). More providers can be added in the settings. Cover art comes from the Cover Art Archive, and one image is embedded in each file.
11.9 Plex and Discord¶
Plex shows the finished library. The music library reads the audio, and a video library reads the videos and their NFO files (8.4).
Discord is an optional add-on for the notifications that VeeJay can already show in its own screens. It is set up with a webhook kept in the secrets file.