Jump to content

Export everything on emby server as m3u


Recommended Posts

Posted

Use the Emby API to retrieve playlists and export them as M3U files for use with apps like Tivimate

  1. Obtain an Emby API key: You'll need to generate an API key in your Emby server's settings. Go to the "Dashboard" > "Security" > "API Keys" and create a new API key.

  2. Retrieve the playlist IDs: Use the Emby API to get a list of your playlists. Here's an example using cURL:

     
    bash
    curl -X GET \
      -H "X-MediaBrowser-Token: YOUR_API_KEY" \
      http://YOUR_EMBY_SERVER_URL/emby/Playlists

    This will return a JSON response containing a list of your playlists, including their IDs.

  3. Export the playlists as M3U files: For each playlist you want to export, use the Emby API to retrieve the playlist items and write them to an M3U file. Here's an example using Python and the requests library:

     
    python
     
    Copy
    import requests
    
    # Set your Emby server URL and API key
    EMBY_SERVER_URL = "http://YOUR_EMBY_SERVER_URL"
    API_KEY = "YOUR_API_KEY"
    
    # Get the playlist ID
    playlist_id = "YOUR_PLAYLIST_ID"
    
    # Retrieve the playlist items
    response = requests.get(
        f"{EMBY_SERVER_URL}/emby/Playlists/{playlist_id}/Items",
        headers={"X-MediaBrowser-Token": API_KEY}
    )
    playlist_items = response.json()["Items"]
    
    # Write the M3U file
    with open(f"{playlist_id}.m3u", "w") as f:
        f.write("#EXTM3U\n")
        for item in playlist_items:
            f.write(f"#EXTINF:-1,{item['Name']}\n")
            f.write(f"{EMBY_SERVER_URL}/emby/Items/{item['Id']}/Download\n")

This code retrieves the playlist items from the Emby API and writes them to an M3U file in the format expected by media players.

Note that this is a basic example, and you may need to adjust the code to handle different playlist structures or add error handling. Additionally, you'll need to replace `YOUR_EMBY_SERVER_URL` and `YOUR_API_KEY` with your actual Emby server URL and API key.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...