mopidy-jellyfin
mopidy-jellyfin copied to clipboard
Playlists not shown in ncmpcpp
Hey I'm having the same issue as in #104 I'm having music in /srv/blob/music/deez/$artist/$album/$songs.flac and my playlists as m3u files are in /src/blob/music/deez/*.m3u In jellyfin web view the Playlists are visible and i can use them regulary. However in ncmpcpp only in library->jellyfin the folder structure is shown. In the (5) Playlist editor view no Playlists are shown.
https://jellyfin.example.com/Users/$ID/Items?SortBy=SortName&IncludeItemTypes=Playlist&Recursive=true returns a JSON Object with the Playlists (URL taken from Firefox when loading playlists View.)
Can anyone explain howto use the Playlist function? Is this a configuration error on my side?
ncmpcpp 0.9.2 mopidy 3.1.1-1 mopidy-jellyfin 1.0.2 jellyfin 10.7.5-1
Lucas
Are the playlists just in a library of your music library, or do you actually have a Playlists library on the home page? If it's just a piece of another library then it won't be parsed here, we're specially looking for a library that has the type of Playlists.
The Playlists in form of m3u8 files are within my Music Library not in a separate Lib. In my Jellyfin Menu there is a "Playlists" item where i can see the Playlists. When i move the m3u8 files into its own Library what type of Lib does it need to be? I can choose from "movies, music, tvshows, books, homevideos, musicvideos, mixed"
I don't have the faintest idea how m3u playlist files are handled here, but it's not a Jellyfin playlist. When you create a playlist in Jellyfin, it puts it inside a unique library dedicated solely to playlists and will appear on the home screen alongside other libraries. This is what this (and I assume most other) music clients are pulling from when referencing playlists.
Did some testing. I created a playlist in Clementine, saved it as a m3u file, updated the paths in the file to match what my server would be able to read, and placed it at Music/Playlists/clementine_playlist.m3u
. It showed up in a Playlists library on the home screen, and it shows/plays in mopidy just fine. I'm not sure exactly what issue you're experiencing, but it appears to be related to how your playlists are configured.
Contents of the clementine_playlist.m3u
:
#EXTM3U
#EXTINF:196,10 Years - Beautiful
/mnt/library/Music/10_Years/Division/10_Years-Beautiful.m4a
#EXTINF:247,Blacktop Mojo - Prodigal
/mnt/library/Music/Blacktop Mojo/Burn the Ships (2017)/Blacktop Mojo - 04 - Prodigal.mp3
In the browser:
In ncmpcpp:
Notice that onlyatest
shows up in the browser, but not in ncmpcpp. onlyatest.m3u
has the paths to the media files on my desktop, which are different than on my server.
/home/matt/NAS/JF-Testing/Music/Gorillaz/Demon Days/06 Feel Good Inc_.mp3
/home/matt/NAS/JF-Testing/Music/Halocene/Make It Loud/Halocene - 01 - Make It Loud.mp3
/home/matt/NAS/JF-Testing/Music/Volbeat/Beyond_Hell-Above_Heaven/Volbeat-7_Shots.m4a
So JF is reading it as a playlist, but then since it can't reach any files at that location it's just an empty playlist.
This does expose a bit of a bug in that empty playlists aren't displayed, but this was a design decision at the time that I don't have a better solution for right now. Playlists in Jellyfin aren't restricted to audio files. They can also contain videos. So when we're loading the playlists, we're specifically looking for playlists that have audio files as content. If they have only video content (or no content at all, such as this case), they aren't displayed in mopidy.
I was struggling to get my playlists to show up in ncmpcpp at first. I didn't have a playlist library, despite having playlists in the music section of my library.
What I found is that the playlist library doesn't appear if you only have playlists in one library. Once I went into my movie library, created a new playlist, and added a random movie, the playlist library showed up and ncpmcpp was able to see all my music playlists.
I'm coming back since i hoped some new versions of Jellyfin or mopidy will fix my issue, but unfortunately not.
Here is my mopidy config:
[file]
enabled = false
[mpd]
hostname = ::
zeroconf = Mopidy MPD auf mond.lan
[mobile]
enabled = true
hostname = ::
title = Mopdy Mobile auf mond.lan
[audio]
mixer = none
mixer_volume = 100
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo
[jellyfin]
enabled = true
username = XXXX
password = XXXX
hostname = jellyfin.XXX.YY
In ncmpcpp i can see the Music type Libraries and the Music in them. I can play the music without issues. In Jellyfin i can see a "Playlists" Library will all my m3u8 Playlists and one "TESTPLAYLIST" which i created within Jellyfin Web UI. I put a Song (and later a Video) into it to test it. It also does not show up in Mopidy. (The testplaylist is a XML file created by Jellyfin)
I have Playlists in multiple Libraries and now out of clues. Any hints are welcome. I tried to diagnose the Problem but i could ne get any helpful results via curl and python to talk to the API. If someone has a snipped for testing, i can do that.
Lucas
This is the series of api calls that we're currently using to query for playlists in the server. There's additional logic after this where we only display playlists that have audio content, but this should be a good starting point
import sys
import requests
from pprint import pprint
########################################
server_url = 'http://192.168.0.100:8096'
username = 'username'
password = 'password'
########################################
auth_data = {
'username': username,
'Pw': password
}
headers = {}
authorization = (
'MediaBrowser , '
'Client="other", '
'Device="script", '
'DeviceId="script", '
'Version="0.0.0"'
)
headers['x-emby-authorization'] = authorization
r = requests.post(server_url + '/Users/AuthenticateByName', headers=headers, json=auth_data)
token = r.json().get('AccessToken')
user_id = r.json().get('User').get('Id')
headers['x-mediabrowser-token'] = token
# Get list of library views
r = requests.get(f'{server_url}/Users/{user_id}/Views', headers=headers)
views = r.json()
for view in views.get('Items'):
if view.get('Name') == 'Playlists':
library_id = view.get('Id')
break
# Check if playlists library was found
if not library_id:
print('Playlists library not found')
sys.exit(-1)
# Get list of playlists in playlists library
r = requests.get(f'{server_url}/Users/{user_id}/Items?ParentId={library_id}', headers=headers)
playlists = r.json()
# Display playlist names
pprint([ x.get('Name') for x in playlists.get('Items')])
Thanks, that helped a lot! The issue was: I'm using a different user Account for Mopidy and for my own browser. So the testing with creating a new Playlist was not affecting the Account in Mopidy.
So to sum it up:
- Having m3u8 Playlists in Jellyfin in a Music Library does not work
- Creating a new Testplaylist somewhere in Jellyfin, putting a single Song into it, will make that the API will report all m3u8 Playlists and the new Testplaylist.
Now the Python code reports the json with all Playlists (even the first Testplaylist from my Browser-User). I will test further if Playing the playlists will work.