muzika icon indicating copy to clipboard operation
muzika copied to clipboard

[question] possible fork as a jellyfin client

Open onny opened this issue 2 years ago • 3 comments

Hey :)

I'm thought about the idea having a player similar to yours as a client for Jellyfin media server. They have a good API documentation.

Hacking their API into the muzika calls instead of YouTube Music might work and would be an interesting experiment.

What do you think of it? If the experiment is successfull one could merge the Jellyfin backend code back into Muzika.

Best regards Jonas

onny avatar Jul 16 '23 16:07 onny

hmm this is interesting.

Forking the app to implement a jellyfin backend will work, but at the end of the fork when it's time to mainline it, we might both have a hard time. This is because Muzika uses a custom library I wrote called libmuse that gets data from YouTube music. It has very specific oddities, so I'm not sure how it would be implemented in jellyfin.

But then again, it can work. if you fork the app and successfully implement the jellyfin code, we could create an abstract class (eg MuzikaBackend) that many apps can use. this way we can all get the same data.

While I think about it, I think we may first need to design that MuzikaBackend class and implement libmuse from it. That way we can have other backends including even local music playback (and maybe in the future spotify, apple music etc... etc... as it would be a generic player with many backends)

We will definitely need to work together and design the MuzikaBackend nicely though, as I imagine many things can go wrong all at once.

Here's an example of what a MuzikaBackend would look like:

interface MuzikaSearchOptions {
  cursor?: string;
  filter: "all" | "song" | "album" | "artist" | "playlist";
  scope: "library" | "catalog"; // uploads...
}

interface MuzikaSearchResult {
  next_cursor: string;
  items: MuzikaSearchItem[];
}

abstract class MuzikaBackend {
  abstract name: string;
  abstract version: string;

  abstract get_homepage(): MuzikaHomePage;

  abstract search(query: string, options: MuzikaSearchOptions): MuzikaSearchResult;
  abstract get_search_completion(query: string): MuzikaSearchCompletion;

  abstract get_artist(id: string): MuzikaArtist | null;
  abstract get_album(id: string): MuzikaAlbum | null;

  // etc...
} 

It would need to be nicely designed to support many potential backends transparently

sorry for the long read

vixalien avatar Jul 17 '23 07:07 vixalien

or maybe we can find a way to use something like libpeas

vixalien avatar Jul 17 '23 08:07 vixalien

I didn't look into this much, but I believe the library called Grilo can be used for this. One would need to explore this but I'm really interested in this.

vixalien avatar Dec 27 '23 03:12 vixalien