• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions Migrating from Plex: How to rewrite this Plex Playlist API Script for Jellyfin

     
    • 0 Vote(s) - 0 Average

    Migrating from Plex: How to rewrite this Plex Playlist API Script for Jellyfin

    Generating a Shuffled-In-Order Playlist From List of Series
    Exaskryz
    Offline

    Junior Member

    Posts: 2
    Threads: 1
    Joined: 2024 Jan
    Reputation: 0
    #1
    2024-01-09, 07:28 PM
    A few months back on reddit when I was learning about Plex, I had some great help with a script.


    https://www.reddit.com/r/PleX/comments/1...r/k5av8kl/

    That script that is really get came from a user named SwiftPanda16, finding the script here: https://gist.github.com/JonnyWong16/725e...ae776b544b

    I have dozens of TV series I have already watched. Putting all the TV series in a playlist and using a shuffle function is okay, but I don't much like having say the order of items be

    ShowA Season 12 Episode 1 > ShowA Season 6 Episode 6 > ShowB Season 4 Ep 11 > ShowA Season 2 Ep 14

    I'd like the idea of being able to turn on the playlist and it plays episodes in order, but interlaced between series. So I'd have this ordering instead:

    ShowA S1E1 > ShowA S1E2 > ShowB S1E1 > ShowA S1E3

    Where if a good multi-episode plotline is developing, I'm not jumping around and interrupted and can follow that in the series, even if a different series plays between those episodes.

    Kind of recreating broadcast television, with my own channel.

    I'm very new to Jellyfin and will be willing to explore the API in the coming days or weeks depending on my free time to recreate that script for Plex (or even research just making the playlist in Plex and somehow importing it to Jellyfin), but I figured I'd not recreate the wheel if someone knew if this type of functionality already existed. Even better if JF has that in its native playlist functionality, something I haven't touched on yet.
    mcarlton00
    Offline

    Kodi Addon Maintainer

    Posts: 145
    Threads: 1
    Joined: 2023 Sep
    Reputation: 9
    Country:United States
    #2
    2024-01-09, 07:50 PM
    You could do this through the api and playlists, however I suspect you might be better served by using ErsatzTV for this instead: https://ersatztv.org/docs/intro
    Exaskryz
    Offline

    Junior Member

    Posts: 2
    Threads: 1
    Joined: 2024 Jan
    Reputation: 0
    #3
    2024-01-09, 08:35 PM
    That does seem kind of cool. I'd be interested in keeping to just one service entirely, plex or jellyfin or ersatztv, but if ersatz handles tv, movies, music all the same as jellyfin, I can go there.

    It's not that I'd have it on all the time, that's for sure. Generally the family watches one show over the course of weeks or the occasional movie, but I figured if I just wanted to throw something on the in background, I'd second-purpose the plex or jellyfin for it. For all that it matters, I could do the very same thing in VLC, something I did do a decade and a half ago as I fumbled around with such an idea.

    Is there any well documented api for jellyfin in python wrappers?

    I am way off base trying to using stuff like jellyfin_api_client because it tells me

    Code:
    File "/home/linuxpc/Documents/SwiftPandaJELLYFINPlaylist.py", line 37, in main
        tvshows = client.library.section(Library)
    AttributeError: 'AuthenticatedClient' object has no attribute 'library'

    I kind of understand the original code, because at least that plex api wrapper was pretty nicely documented and I could generally figure out what I needed to import, but I really have the wrong idea on how to use jellyfin api. I may just try to reteach myself terminal/command line api stuff and figure it out in a bash script as I previously did, but as Panda's code was much more efficient and shorter than mine, I really wanted to try to emulate that.
    tmsrxzar
    Offline

    Senior Member

    Posts: 755
    Threads: 6
    Joined: 2023 Nov
    Reputation: 20
    #4
    2024-01-09, 08:41 PM
    (2024-01-09, 08:35 PM)Exaskryz Wrote: That does seem kind of cool. I'd be interested in keeping to just one service entirely, plex or jellyfin or ersatztv, but if ersatz handles tv, movies, music all the same as jellyfin, I can go there.

    i think you completely missed what it is, ersatz doesn't do what plex or jellyfin does, it creates a virtual tv channel using your media
    that tv channel is then imported into either plex or jellyfin as a psuedo live tv source

    https://ersatztv.org/docs/user-guide/configure-clients
    https://ersatztv.org/docs/user-guide/con...s#jellyfin

    it does not replace either plex or jellyfin
    mcarlton00
    Offline

    Kodi Addon Maintainer

    Posts: 145
    Threads: 1
    Joined: 2023 Sep
    Reputation: 9
    Country:United States
    #5
    2024-01-09, 10:06 PM
    I will be completely honest with you: the jellyfin-apiclient-python kinda sucks. I maintain 3 python clients and have several scripts I use to interact with my server, and I avoid it where ever possible. It was originally pulled out of the source code of jellyfin-kodi, and there was a whole lot of "not good" about that code. You've already discovered that getting started with it is kinda clunky. Eventually I would like to make a proper one based on the openapi spec published by the server, but refactoring all of my stuff to use it just hasn't been worth the time yet.

    If you want to use the apiclient as is, your best options are likely going to be to look through the jellyfin-kodi and jellyfin-mpv-shim repos to figure out how it's being used there. And be warned it's not going to be a concise as the plex python library.

    If you want to venture into the unknown a bit, you can generate your own api client using the jellyfin openapi spec found here: https://api.jellyfin.org/openapi/jellyfi...table.json

    I personally find it easier to just write my own api calls using the requests library.

    * This is a snippet I put together ages ago: https://gist.github.com/mcarlton00/f7bd7...9cebf9a247
    * Here are all the api calls made in the mopidy client: https://github.com/jellyfin/mopidy-jelly.../remote.py
    * Possibly the most relevant for you, this pulls all songs marked "favorite" from the server and pushes them into a playlist: https://gist.github.com/mcarlton00/c08a6...da826e1ac1
    « Next Oldest | Next Newest »

    Users browsing this thread: 2 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode