Add lidarr as downloader#21
Conversation
4333afb to
c98d43c
Compare
|
I'll try running it in my test environment when I have the time. the code looks really good at the moment. It would be nice to get a function to check the download progress of the album, and if it hasn't progressed at all, let's say in 15 minutes, then the album download will stop (and removed from Lidarr). That would allow for the track to be downloaded from another downloader. |
|
sounds good! i've got the actual logic written up. how would you envision something like that running? i've added it as a goroutine for now, but if there's a different architecture you'd prefer, just name it! |
Yeah, goroutine is what I was thinking too I looked through and ran the code and I'm a bit confused about findArtist() and addArtistIfNeeded(), previously when I investigated Lidarr, I did a manual flow of API requests to download the album and I only used This is the request I used for adding and sending the search to indexers: POST http://URL:PORT/api/v1/album {
"foreignAlbumId": "70bdc19f-66fb-4adf-9124-925ace531101",
"monitored": true,
"qualityProfileId": 1,
"rootFolderPath": "/music",
"monitored": true,
"artist": {
"foreignArtistId": "89ea85c2-c90a-46ea-93db-9bed95d5c8f8",
"qualityProfileId": 1, // Artist's Quality Profile ID
"metadataProfileId": 2, // Artist's Metadata Profile ID
"monitored": true,
"rootFolderPath": "/music"
},
"addOptions": {
"searchForNewAlbum": true
}
}AlbumID and artistID came from album lookup and the ProfileID's could probably be config parameters if the SDK supports it. And i fixed a small issue with track.MainArtist in the dev branch, when searching for albums it's best to use that field, track.Artist could contain all the artists on the track (i.e Justice feat. Tame Impala) |
4582a13 to
3f855d8
Compare
|
Yeah! so the whole flow was a little confusing for me as well and the sdk doesn't seem to map 1:1 onto the api endpoints which is... frustrating. my understanding is we've got the foreign (read musicbrainz) ids for everything and the internal (lidarr) ids. Lidarr ids for artist/album don't get set if the artist isn't in lidarr already, so i'll dig into the sdk a little further to see if i can bypass a lot of the lookups and just use the mbids to create the album in lidarr |
|
just for complete context, between these changes, and those in #22, i've now got a new playlist in jellyfin with 33/50 tracks! as far as the flow using sdk is concerned, i think we're roughly stuck at:
|
|
Wouldn't it be more straightforward to do it without the SDK? It would reduce the amount of flows needed and would give us greater control of the request payloads. Especially when we don't need most of the API functionality (most likely 4-5 endpoints for a full workflow). The flow would look pretty much like this:
Feel free to debate me on this, maybe i just don't get the point of the SDK when Lidarr's API documentation is pretty good. |
aa1e25b to
c1be6c0
Compare
|
This is the first time I've used an SDK, so I'm happy to do it either way! I just pushed up a couple squashed commits that should do all of this a little more cleanly (storing the MBIDs) in the track struct for ease. I also updated the goroutine to both clear stale downloads and mark present newly available tracks Looking forward to your thoughts! |
|
Made a few changes in the dev branch, main changes include:
I'm also pretty much finished with implementing slskd, you can check how I implemented download monitoring there Also, the linter fails, but that is expected atm. |
52fbbb7 to
3193bde
Compare
448f165 to
026d9db
Compare
ab65908 to
0cbec27
Compare
|
i did something that might be a little too crazy with the download monitoring. go doesn't allow for reusability quite as much as my SRE brain would like, but i think this could be a path forward to keep from just copying the same code into of course happy to find a different solution if this feels too out there! |
|
Makes perfect sense, I can hopefully test it this week. I also left a couple of reviews in May, regarding the Lidarr part. I don't believe they have been addressed (or Github is just wonky) A related question as well: |
I'll jump in and say that I've been using a fork that uses a different metadata server (that actually works). |
|
I think it would be better to move the monitor refactoring into a separate pull request, after Lidarr is fully implemented. This would simplify testing and allow for a cleaner refactor, especially since monitor.go will likely require a shared struct. Right now, I can't test Lidarr properly because my test environment doesn't like hearring-aid (the MusicBrainz server requirements are a bit too much for it). Since I'm not sure what fields Lidarr needs yet, I can't provide meaningful feedback at the moment. But according to Lidarr's Issues page, they are pretty close in making it work again. |
|
Sorry for the long wait, I have completed the monitoring refactor. GetDownloadStatus - handles the querying of track statuses from a downloader and compiling a map of structs to be used in monitor.go. GetConf - Returns the monitoring configuration (or an error if monitoring isn't used (like with Youtube)). Cleanup - For removal of search requests (or temp files) from the system after the track has been downloaded/failed to be downloaded. Things likely would need to be changed to fit lidarr (like the shared struct), as the refactor is entirely based off slskd. If any details are needed then just ask, |
c433f00 to
74304ac
Compare
|
I appreciate the update! I think I've gotten everything hooked up correctly, but there's been an unfortunate wrinkle in that the Lidarr metadata server is having issues. As it stands, the only response I can seemingly get back from the Lidarr API is a 503. It looks like they're nearly done with their upgrade/transition, but until it's working even remotely reliably, there's not a whole lot more testing I'll be able to do. 🙁 |
|
Thanks! I have a question about the |
|
I believe the Lidarr metadata server issues have been resolved now. I love this project, but would prefer to use lidarr for the downloads. |
2463e52 to
6300895
Compare
If it's added to Lidarr then Soularr can do the rest, no? |
|
I'd love to see this happen. I've been using this for a week now and im really enjoying it but not a fan of it downloading from YouTube when I have lidar right there that could be used for the downloading. |
6300895 to
4d484e7
Compare
Add helper funcs; implement hour cooldown for search Check for rejected releases Add cleanup func and worker Add check to artist adding Mark track as present
9b3a360 to
263fc5e
Compare
Add download monitor Add album release to request More updates to lidarr Don't monitor the whole artist Fix rebase More rebase fixes Remove timeout from main.go Fix rebase more Fix rebase more
Fix post rebase Remove redeclarations Update sample env; reorganize Add PUID/GID support to Docker container Fixup rebase Update lidarr monitoring Fix config Fix ReadEnv rebase Fixup rebase Restore a couple files Unformat config Ignore vscode Restore downloader Add fields to type Make lidarr timeout an int Fix env reading Remove scheme Fix cleanup tasks Use track title Structure logging Fixup rebase Cut down on changes Fix linting issues
Build test branch Update condition Fix request calls Fix the linter Simplify api calls Debug Try to search on add Remove old structs; update querytrack Debug and comment out helper func More debugging Add new helper func Fix call; add debug Use release group as id Debug More debugging Add release group is helper Get release group
Remove debugs Set trackfile after download starts
3b2ef31 to
061ca95
Compare
|
happy to report that the main lidarr specific flow is working more or less as expected! last thing is to find a way to play nice with the monitor (tracking is at the song level vs the album level) to allow explo to finish adding songs to playlists |
Implements an MVP version of a Lidarr downloader using the lidarr-go sdk. Currently, can't seem to automatically download using slskd, but the general workflow is functional. Would probably close #16