Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local playlist support for Album and Artist URIs #708

Open
artbird309 opened this issue Feb 27, 2021 · 15 comments
Open

Local playlist support for Album and Artist URIs #708

artbird309 opened this issue Feb 27, 2021 · 15 comments

Comments

@artbird309
Copy link

artbird309 commented Feb 27, 2021

Describe the bug
After I upgraded from 3.52.4 to 3.53.0 and still in 3.56.0 I am unable to play my local media album/artist from .m3u8 playlist.

My playlist shows correctly as an album but when I try to play the playlist it only plays the first song for each album.

To Reproduce
Steps to reproduce the behavior:
Manually create a playlist with an album from local media using the URI "local:album:md5:29effead7af7158e15cb09f937dcd11b"
then in Iris go to the playlist and click play it will only add the first song, not the whole album.

Expected behavior
When you load a playlist with a local media album URI it adds the whole album to the queue.

Environment details:

  • OS: Ubuntu Docker host 19.03.12, container built from circleci/python:3.7
  • Browser Chrome
  • Iris version 3.53.0 to 3.56.0

Additional context
It still works fine using the MPD command to add the playlist correctly.

@artbird309 artbird309 added the bug label Feb 27, 2021
@partofthething
Copy link
Contributor

I'm having a potentially-related issue where I can't play local files seemingly at random. Like some of them work but some don't. When they don't, the Firefox web console says:

Object { message: "Mopidy: Failed to add some tracks", description: null, state: {…} }
app.min.js:111:100872
    nt http://audio.lan:6680/iris/app.min.js?v=1616054526:111
    G http://audio.lan:6680/iris/app.min.js?v=1616054526:111
    dispatch http://audio.lan:6680/iris/app.min.js?v=1616054526:1
    It http://audio.lan:6680/iris/app.min.js?v=1616054526:111

Same tracks add fine in ncmcpp. The weird thing is that other tracks in the library work fine. I totally reinstalled everything including wiping out my various caches and data files and the issue persists across browsers (Chrome, Firefox, desktop/mobile), etc. Verbose logging in mopidy didn't show much of interest.

@jaedb
Copy link
Owner

jaedb commented Mar 19, 2021

Can you both please provide the URIs of the tracks you're trying to add? I can only guess, but I am expecting the issue to be with URI encoding but need some examples to be certain.

@partofthething
Copy link
Contributor

These don't work:

  • local:track:YELLE/Complètement%20fou/01%20Complètement%20fou.mp3
  • local:track:Non-Album/The%20B‐52s/Rock%20Lobster.mp3
  • local:track:The%20Beatles/1962–1966/01%20Love%20Me%20Do.mp3

These work:

  • local:track:Dire%20Straits/Brothers%20in%20Arms/02%20Money%20for%20Nothing.mp3
  • local:track:Non-Album/Don%20McLean/American%20Pie.mp3
  • local:track:Red%20Hot%20Chili%20Peppers/Californication/06%20Californication.mp3

@artbird309
Copy link
Author

The example UIR I was using was "local:album:md5:29effead7af7158e15cb09f937dcd11b" and it works fine if I manually add that URI to the play now queue but if I play a playlist with that URI in it only the first track of album gets added.

@jaedb
Copy link
Owner

jaedb commented Mar 19, 2021

@artbird309 your URI is an album URI, so it will be expanded to tracks by Mopidy when adding to the queue or to a playlist. When playing the playlist you will be using the expanded track URIs. Can you please provide me the URIs of that album's tracks?

Ultimately I think this is a duplicate of #711

@artbird309
Copy link
Author

The expanded UIRs after I manually add the album:

  • local:track:Go%20Fish/Party%20Like%20a%20Preschooler%20%5B2008%5D/01%20-%20Go%20Fish%20-%20Party%20Like%20a%20Preschooler%20%5B2008%5D%20-%20Do%20Your%20Ears%20Hang%20Low.m4a
  • local:track:Go%20Fish/Party%20Like%20a%20Preschooler%20%5B2008%5D/02%20-%20Go%20Fish%20-%20Party%20Like%20a%20Preschooler%20%5B2008%5D%20-%20The%20Wheels%20on%20the%20Bus.m4a
  • local:track:Go%20Fish/Party%20Like%20a%20Preschooler%20%5B2008%5D/03%20-%20Go%20Fish%20-%20Party%20Like%20a%20Preschooler%20%5B2008%5D%20-%20The%20Cow%20and%20the%20Peanut.m4a
  • local:track:Go%20Fish/Party%20Like%20a%20Preschooler%20%5B2008%5D/04%20-%20Go%20Fish%20-%20Party%20Like%20a%20Preschooler%20%5B2008%5D%20-%20Pop%20Goes%20the%20Weasel.m4a

I do not have any issue playing the playlist with the album UIRs when it is played from my Home Assistant MPD integration only when I am manually playing that playlist from iris. It seems like playing the playlist from iris it does not expand the the whole album correctly anymore.

I upgraded to 3.57.0 and still have this issue.

jaedb added a commit that referenced this issue Mar 23, 2021
@jaedb
Copy link
Owner

jaedb commented Mar 23, 2021

The handling of accented characters is now fixed (see 3.57.1), but I can see some of your example URIs don't actually have accented characters. Are you able to upgrade Iris (making sure to clear all caches and restart Mopidy) to ascertain whether this patch fixed the issue for you?

@artbird309
Copy link
Author

I upgraded my container to 3.57.1 and there was no change it is still only adding the first track of every album.

@jaedb
Copy link
Owner

jaedb commented Mar 24, 2021

@artbird309 can you please open the album, select all tracks and copy their URIs and paste them in here? Then right click on the selected tracks and hit Add to queue. Observe which ones are added and which ones are not so we can figure out what URIs are working and those that are not.

@partofthething
Copy link
Contributor

As for my non-accented cases, I think the hyphens in the "don't work" category include unicode hyphens rather than normal hyphens. Copying and pasting them from my list above:

In [1]: a = "‐"

In [2]: a
Out[2]: '‐'

In [3]: ord(a)
Out[3]: 8208

In [4]: b = '–'

In [5]: ord(b)
Out[5]: 8211

whereas a normal hyphen (-) is ascii code 45.

@jaedb
Copy link
Owner

jaedb commented Mar 24, 2021

That would definitely do it. The immediate fix is for you to remove em and en dashes from your filenames in favor of hyphens.

The reason this problem exists is because Mopidy backends require (to varying degrees) URL-safe URIs. Iris uses URLs to build links to content, so URIs need to be URL-safe in their entirety, however the encoding preferences vary between browsers and Mopidy extensions. Iris is stuck in the middle.

The way to fix this is to either (in order of preference):

  1. use encryption (base64 for example) to create URL-safe URIs without using encodeURIComponent
  2. use state instead of URL to reference content URIs
  3. add (yet) another rule to support encoding of em and en dashes

@jaedb jaedb closed this as completed in 20ea63b Mar 26, 2021
@artbird309
Copy link
Author

I upgraded to 3.57.3 and nothing changed. I reverted back to 3.52.4 to see if I could see any changes and it looks like we might be look at this incorrectly. When I am looking at the playlist in the current versions it shows just the first track per album, in 3.52.4 it just shows the album URI "local:album:md5:29effead7af7158e15cb09f937dcd11b" this makes me thing it is how Iris is rendering the playlist and then sending that to the queue. It is not pulling in the whole album so that is the only thing that is getting sent to the queue. See screenshots below.

image
3.52.4 screenshot

image
3.57.3 screenshot

@jaedb jaedb reopened this Mar 26, 2021
@jaedb
Copy link
Owner

jaedb commented Mar 26, 2021

You're quite right. I think I assumed @partofthething's issue was related, but in fact his was quite different. While that issue is now resolved, yours remains.

Can you please run me through the process of actually adding an Album URI to a playlist in Iris? I believe Add to playlist capabilities only exist for Tracks.

@artbird309
Copy link
Author

I manually created the playlist as I was not able to find an easy way to add whole albums/artists as I have over 200 tracks in two different playlists.

This is one of the playlists I have been using:
local:album:md5:b6e6e9fa1730241a0f33dca698bcc7c0 local:album:md5:1d009539778d871ddcd5919b0cebfc61 local:album:md5:8d63ddc11ee62af4a6f2f18bc9544010 local:album:md5:d6b4580bb31ec71fd540dbd5ac712e78 local:album:md5:62fbe49a72a9b182c760b03174184cf0 local:artist:md5:b28be3abe478d93820b05f8f5fc162e2 local:album:md5:66d63a35ec6dde83de6f65b20523ed4d local:album:md5:477e6f062e3789beb36c029bfcb3fd98 local:album:md5:5e35d3a1d558cc439a4fb659d767c889 local:album:md5:29effead7af7158e15cb09f937dcd11b

@jaedb
Copy link
Owner

jaedb commented Mar 27, 2021

Ok cool, that makes more sense now. I shall change this to a Feature Request to better reflect the development work required. Existing functionality is not broken, rather new functionality is desired.

@jaedb jaedb added feature request and removed bug labels Mar 27, 2021
@jaedb jaedb changed the title Unable to play local media Album/Artist from playlist Local playlist support for Album and Artist URIs Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants