tryffel / jellycli

Jellyfin terminal client
GNU General Public License v3.0
206 stars 8 forks source link

Extract Jellyfin API client library as a separate Go module? #49

Open dweymouth opened 1 year ago

dweymouth commented 1 year ago

Hey! Maybe issues isn't the best way to reach out about this but I wanted to see if you'd be willing to extract the Jellyfin API code out of this project into its own Go module/repo? I have a GUI music player project also using Go (https://github.com/dweymouth/supersonic) that currently supports only Subsonic but I would like to add Jellyfin support as well. I did some searching around and this project is the closes thing I've found so far to a Go API client library for Jellyfin.

Side note - I took a quick peek at the code and I think you're forgetting to call Close on the response bodies in at least some of the cases, meaning the connection won't be able to be reused with keep-alive and could lead to a slow resource leak (just recently fixed the same issue in my project).

I'm also willing to start the library myself, copying out the relevant code and adapting it as necessary (and of course I'll give you credit for being the primary author!). If you then wanted to share the Jellyfin backend you might need a small shim on top of it (since we each have our own slightly different API-generic models so I'd make the extracted Jellyfin library more closely match Jellyfin's underlying object model.

tryffel commented 1 year ago

Hey! Thanks for bringing this up. I haven't really had much time for this project recently and I also don't want to start maintaining a library now. With that being said, you're free to create and maintain the library based on Jellycli's implementation! If there's anything I can help with regarding the implementation, feel free to ask anytime.

As for the Close that you mentioned, I've noticed there's clearly some bugs present in the buffered streaming implementation, which might be exactly because of the missing close call.

Also it seems like the Jellyfin's API has changed a bit since the last 2-3 releases and most of the bugs relate to those changes. Those mostly relate to the remote control feature and queue management, I think. So, there's a little technical debt present at the moment.

dweymouth commented 1 year ago

I started this repo: https://github.com/dweymouth/go-jellyfin It's currently incomplete but I'm in the processing of extracting out the Jellyfin API and simplifying the object model to make it generic (removing dependency on the models package).