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

Playlist management + import / export #105

Closed
10 tasks done
antipiot opened this issue Mar 22, 2020 · 33 comments
Closed
10 tasks done

Playlist management + import / export #105

antipiot opened this issue Mar 22, 2020 · 33 comments

Comments

@antipiot
Copy link

antipiot commented Mar 22, 2020

Hello! First of all, thanks for your work! Looks very promising.

Actually using Airsonic.

I wanted to ask if it will be possible to have a playlist management (i saw smart / dynamic playlists on the road map) but i'd like to be able to manage standarf m3u / m3u8 playlists with the ability to import - export them as mine are very precious to me :-)


Added by @deluan to track progress:

Tasks:

  • Add playlist REST endpoint
  • Create/Delete playlists
  • Browse/Play/Add to Queue playlists
  • Remove tracks
  • Edit playlist details (Name, Comment, Public)
  • Reorder tracks
  • Import M3U/PLS files
  • Export to M3U files
  • One-way sync of imported playlists
  • View as albums, artists, songs. Similar to iTunes Will be implemented as part of a larger overhaul of the UI
@antipiot antipiot changed the title Playlist import / export Playlist management + import / export Mar 22, 2020
@deluan
Copy link
Member

deluan commented Mar 22, 2020

Thanks for trying out Navidrome.

Playlist management will definitely comes before smart playlists. Even though I have an issue open (#10) to track all initial work on the WebUI, I'll leave this open for eventual discussions specific about playlists.

@antipiot
Copy link
Author

Thanks to you!
Lookings forward for the playlists / smart playlists and vignette enhancement.
Will probably switch once this is done.
really appreciate the docker container aswell.

Anyway, many thanks again!

@legobuild
Copy link

Just found Navidrome and it looks like a great lightweight replacement for Airsonic. Looks like I can create playlists in play:sub, just need the management capabilities in the UI. Keep up the great work!

@arg274
Copy link
Contributor

arg274 commented May 6, 2020

Owing to the discussion on Discord, I also think that playlists should be kept as-is even if the M3U it was originally imported from is not found in its location. Deletion should only be handled by the user explicitly.

@tobiashuttinger
Copy link

tobiashuttinger commented May 10, 2020

Adding to the idea of @arg274, it would be an easy way to make the playlist feature open to other apps if Navidrome synced the changes made back to the playlist file (M3U or else). That way one could add a track to a playlist in Navidrome and have the changes automatically visible in a standalone software like MusicBee, iTunes or DJ Software.
Since not everyone will want and expect this behaviour, it could be configured via settings.

@deluan
Copy link
Member

deluan commented May 10, 2020

@git1873 two-way sync is really hard to get right. What to do in case of conflicts (changes on both playlists being synched)?

I think the best approach is one way sync: Navidrome will import m3u/pls files, and will flag it as "synchronized". The imported playlist will be read-only in Navidrome, but if the m3u file it was imported from changes, it will get updated. If you want to disable the sync, you'd disable the playlist's "synchronized" flag (in the UI)

@antipiot
Copy link
Author

On my side, i would never use the folder to import playlists into Navidrome as it is my main player but will defininitly use it to export the playlists i've made using GUI / Dsub to another players, like Moode-audio.

@tobiashuttinger
Copy link

tobiashuttinger commented May 11, 2020

@deluan You are right, you can't really build a rock-solid 2-way sync solution on a file based system without locking/transactions and conflict management in clients. I am not even sure how many users would use the feature, but i certainly would.
If only one user is accessing the same set of playlist files from different devices, getting it to sync is not really hard. Navidrome could fetch the current state of the playlist file before displaying it to the user (and before adding something to it). This way, no conflicts would occur, unless two clients write at (or depending on the other clients behaviour, load, resuting in later conflicts because client cached an older version of the file) the same time. Not a "set up and forget" solution for every user, it would just make some workflows possible.

Aside from that; the one-way sync option you proposed is still a good idea and a good thing to start with. Playlists could be configured as Navidrome either being Master oder Slave. If Slave, Navidrome can't write to a playlist, only sync its contents from a file. If Master, Navidrome can edit the Playlist and write it to a file (but not read it back).
The Master/Slave concept is not neccesarily the most clear mechanism to the user, so the Slave (Sync from file) could be presented as you laid out, and then for the Master-Mode there could be an Export function, that can be run manually by the user or automatically after every change to the playlist.

@deluan deluan pinned this issue May 17, 2020
@deluan
Copy link
Member

deluan commented May 18, 2020

Hey @certuna, from the comment you added in the PR #265 (comment), the only items not implemented yet are:

  • change the playlist order
  • see other fields than title/artist/time

All other items are already in 0.19.0 and/or in the develop build right now. Let me know if you are having trouble accessing them.

Question: What other fields do you want to see in the playlist tracks grid? Keep in mind that you can expand each row, which gives you more info about each song

@certuna
Copy link
Contributor

certuna commented May 31, 2020

Yes this all works well, now testing 0.21, I love how fast all this development is going.

I would imagine you'd want the same columns in Playlists as you have in the rest of the library, ie that you can choose to view a Playlist in Album view, Song view, Artist view. What do you think?

@deluan
Copy link
Member

deluan commented Jun 2, 2020

Ah, I got it. Yes I want to have different visualization modes for playlists, but right now there are a lot of other things that would come first, ex: smart playlists. When implementing the artist view, I may refactor all views to allow them to be reused with playlists. I'll add this to the issue's checklist, even though it will probably move to its own issue once the other items in the list are done

@Extarys
Copy link

Extarys commented Jul 7, 2020

Eventually: Share playlist with a user, or allow a user on the server to check other's playlists and "follow" them

@deluan
Copy link
Member

deluan commented Jul 7, 2020

@Extarys Playlists can already be set as public, then all users in a server have access to it. Is it enough?

@deluan
Copy link
Member

deluan commented Jul 18, 2020

Update: Latest from master implements the playlist import. Just drop your .m3u files in any directory under your music folder, and Navidrome will parse and import it automatically on the next scan. Playlists that were imported this way will be kept in sync: Any changes to the .m3u file will update the Playlist. If you want to disable this sync after the playlist has been imported, you can edit it in the UI and disable it ("Auto-Import" switch).

To be able to use it, you'll need to get the latest develop build, and set the DevNewScanner=true config option.

@antipiot
Copy link
Author

antipiot commented Jul 18, 2020

Hi Deluan!
This looks perfect.

For people who want to try in docker pull navidrome:develop and add ND_DEVNEWSCANNER=true environement variable.

Tried it myself and my playlist are not imported ATM because of an error:
2020/07/18 12:11:42 OK 20200411164603_add_created_and_updated_fields_to_playlists.go 2020/07/18 12:11:42 OK 20200516140647_add_playlist_tracks_table.go 2020/07/18 12:11:42 OK 20200710211442_add_playlist_path.go time="2020-07-18T12:11:44+02:00" level=error msg="Error retrieving playlist owner" error="data not found"
Do i need to edit my playlists in any way?

FYI:
My playist is named:
"instrumental Metal"

and entries looks like:
image

Any hint?

@deluan
Copy link
Member

deluan commented Jul 18, 2020

@antipiot Thanks for helping testing this. Your playlist seems fine. The issue is related to your users. You have at least one admin user, right?

Can you change the loglevel to trace and try again?

@antipiot
Copy link
Author

antipiot commented Jul 18, 2020

EDIT2: sorry: this looks to be working perfectly now - do not know what was causing trouble.
Looks perfect!

@antipiot
Copy link
Author

Any chance to have the changes wrote in the m3u file?

Let me clarify my needs:
I'm using a script to automatically grab my playlists in a folder and "convert" them to fit in my Moode-Audio player.

I would like to generate and edit my playlists in Navidrome and be able to grab them with ease.

@deluan
Copy link
Member

deluan commented Jul 18, 2020

Export playlists come next, I've been thinking of implementing something similar to what @git1873 described in his comment:

If Master, Navidrome can edit the Playlist and write it to a file (but not read it back).

You could set a path in the Playlist Edit UI, so everytime it was changed, it auto-exports to that path...

If you don't want to wait, you could use Subsonic API with curl and parse the results with jq to grab the playlists directly from Navidrome.

EDIT: Something like this (ex. to get a list of all playlists):

$ curl -s "http://localhost:4533/rest/getPlaylists?u=<user>&p=<password>&c=curl&v=1.8.0&f=json" | jq
{
  "subsonic-response": {
    "status": "ok",
    "version": "1.10.2",
    "type": "navidrome",
    "serverVersion": "dev",
    "playlists": {
      "playlist": [
        {
          "id": "c1a00e2e-4819-4762-8358-f017a69588ee",
          "name": "Best Of Saara Saara",
          "comment": "Auto-imported from 'Best Of Saara Saara.m3u'",
          "songCount": 7,
          "duration": 1384,
          "public": false,
          "owner": "admin",
          "created": "2020-07-18T00:23:46.569445Z",
          "changed": "2020-07-18T04:16:12Z"
        },
        {
          "id": "ef69f7c0-3a1e-40e2-b2f2-62e0f7f000bc",
          "name": "test",
          "songCount": 8,
          "duration": 1954,
          "public": false,
          "owner": "admin",
          "created": "2020-07-18T04:22:56.677525Z",
          "changed": "2020-07-18T04:22:56Z"
        }
      ]
    }
  }
}

@antipiot
Copy link
Author

@deluan i did tried something to download playlist with m3u format on my Airsonic but couldn't get it working efficiently due to some mechanisms implied with auth token or something. Read somewhere i wasn't alone trying and facing a wall on the case.

"You could set a path in the Playlist Edit UI, so everytime it was changed, it auto-exports to that path..."
How may i set a custom path?
image

Thanks for you great work on Navidrome!

@deluan
Copy link
Member

deluan commented Jul 18, 2020

@deluan i did tried something to download playlist with m3u format on my Airsonic but couldn't get it working efficiently due to some mechanisms implied with auth token or something. Read somewhere i wasn't alone trying and facing a wall on the case.

Yes, that is hard. What I'm proposing is something different: to get the playlist in JSON, using the API and converting it to m3u in your script. If you want to try and need help, join our Discord server and I can help you with that (it is easier to chat than exchange replies here... :) )

Re: Path, in the currently implementation, you can't change the path. It is there just to let you know the origin of the imported playlist. But when implementing auto-export, this path will be configurable.

@antipiot
Copy link
Author

Got it!
Thanks for the clear explanation - will wait for the implementation patiently.
no need to script further if something covering the need will be available.

@antipiot
Copy link
Author

@deluan ,sorry to bother you:
If i'm not mistaken your the new scanner has been merged.
This scan - import should appear in logs? asking because my playlists aren't imported.
did i miss something?

@deluan
Copy link
Member

deluan commented Jul 28, 2020

Yes, from version 0.26.1, it is the default scanner.

In default info loglevel, it should show a message like this when it finds a new or changed .m3u file:

Adding synced playlist      owner=admin path="/Users/deluan/Music/Music/Media/Music/Best Of Saara Saara.m3u" playlist="Best Of Saara Saara"

You can try making a simple change to the playlist (adding a comment or something like this), and once you save it, it should picked-up in the next scan cycle. If not, repeat the process with loglevel = trace and send me the logs to try to figure out why it is not working.

@antipiot
Copy link
Author

@deluan , Thanks for your answer:
I do not know why but i had to remove the playlists from media folder, reboot the server, put the playlists back in and they where imported correctly.

Thanks for your great work and help!

@deluan
Copy link
Member

deluan commented Jul 29, 2020

@antipiot That's very weird. Just updating the playlists without any reboot should be enough. Well, if you can reproduce this behavior consistently, please open a new GH issue with steps on how to reproduce it, so we can discuss try to figure this out

@andrewzah
Copy link

@deluan can the importing of m3u's be made optional? For cd ripping with EAC, it's standard to include a .m3u of the album.

@deluan
Copy link
Member

deluan commented Aug 3, 2020

Hummm.... I'm not actually a fan of (and don't use any) .m3u playlists, but I can see disabling the auto-import being desired. Sure, I'll add an option in the next release

@deluan
Copy link
Member

deluan commented Aug 3, 2020

@andrewzah Done in 28d1428. Just set AutoImportPlaylists=false (default is true)

@deluan
Copy link
Member

deluan commented Aug 22, 2020

Added support for Export to M3U in 9df405a.

Playlists support is now completed. Thanks for all the feedback.

The "View as" functionality proposed by @certuna will be part of a larger overhaul of the UI.

If you require any other functionality regarding playlists, please open a new issue.

@Merkwurdichliebe
Copy link

Until such a command is available in the UI, Is there any SQL command I can use to mass export all playlists from the navidrome database as m3u8 files, as a backup in case something goes wrong?

@deluan
Copy link
Member

deluan commented Feb 10, 2023

@Merkwurdichliebe, please open a new issue with your request, or if it is just a question feel free to ask in Discord. This issue one was completed 2 years ago.

@github-actions
Copy link

github-actions bot commented Mar 7, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants