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

Playlists, Livestreams, Podcasts #2200

Merged
merged 13 commits into from
Jan 30, 2024

Conversation

flipreverse
Copy link

This is a first draft. It add support to set m3u playlists as action on cards or directly play them.
At the moment, one is not able to edit cards assigned to a m3u playlist. This is due a None answer by get_song_by_url() in the player.
Why is this function called on behalf of the HTTP request #/cards/0006807296/edit?

@s-martin s-martin added enhancement future3 Relates to future3 development labels Jan 2, 2024
@s-martin
Copy link
Collaborator

s-martin commented Jan 2, 2024

Thanks for the pull request 🎉👍

At the moment I'm unsure what the PR is adding, because according to our feature status page playlists should work already. But I haven't tried playlists myself.

@flipreverse
Copy link
Author

Thanks for the pull request 🎉👍

At the moment I'm unsure what the PR is adding, because according to our feature status page playlists should work already. But I haven't tried playlists myself.

Yes and no. At the moment, jukebox-daemon reads playlists, and presents the content as single items to the user. See playlistgenerator.py:206. With my patch, playlists are displayed as m3u files in the selection dialogue. Moreover, when selected by a dialogue or via a card MPD loads the playlist. See line 422 in src/jukebox/components/playermpd/__init__.py).

@s-martin
Copy link
Collaborator

s-martin commented Jan 7, 2024

@pabera, you now probably the status of the current playlist features.

@pabera
Copy link
Collaborator

pabera commented Jan 16, 2024

For now, playlists haven't been handled properly. If we want to add this feature, I suggest get them running everywhere, Web App (e.g. displaying the current playlist, aka Queue), Cards, Player etc.

@pabera pabera added this to the v3.5 milestone Jan 16, 2024
@pabera pabera self-requested a review January 16, 2024 08:19
@pabera
Copy link
Collaborator

pabera commented Jan 22, 2024

@flipreverse
It took me a bit of time to dive into playlists and livestreams. I remembered that some of it was implemented, but since I don't use the feature myself, and it was not documented, I didn't remember if there were any gaps.

Good news: Playlists are implemented, even without your change. They also can be assigned to cards. The only problem is, documentation is missing.

I will use your PR to make the necessary changes to the docs and revert your change as it actually conflicts with the original implementation. Here is an explanation from the code that already describes how to use playlists.

Long story short. The Phoniebox expands the content of your playlist, so you can actually call individual items from it within the Web App for example. To be able to assign a play list to a card, I suggest the following:

  1. Create a new folder.
  2. Place your single *.m3u file into this folder
  3. Register the folder to your card.

This will play your playlist. But instead of registering a playlist to a card, you register a folder and Phoniebox will do the rest.

"""
Playlists are build from directory content in the following way:
a directory is parsed and files are added to the playlist in the following way
1. files are added in alphabetic order
2. files ending with ``*livestream.txt`` are unpacked and the containing URL(s) are added verbatim to the playlist
3. files ending with ``*podcast.txt`` are unpacked and the containing Podcast URL(s) are expanded and added to the playlist
4. files ending with ``*.m3u`` are treated as folder playlist. Regular folder processing is suspended and the playlist
is build solely from the ``*.m3u`` content. Only the alphabetically first ``*.m3u`` is processed. URLs are added verbatim
to the playlist except for ``*.xml`` and ``*.podcast`` URLS, which are expanded first
An directory may contain a mixed set of files and multiple ``*.txt`` files, e.g.
01-livestream.txt
02-livestream.txt
music.mp3
podcast.txt
All files are treated as music files and are added to the playlist, except those:
* starting with ``.``,
* not having a file ending, i.e. do not contain a ``.``,
* ending with ``.txt``,
* ending with ``.m3u``,
* ending with one of the excluded file endings in :attr:`PlaylistCollector._exclude_endings`
In recursive mode, the playlist is generated by concatenating all sub-folder playlists. Sub-folders are parsed
in alphabetic order. Symbolic links are being followed. The above rules are enforced on a per-folder bases.
This means, one ``*.m3u`` file per sub-folder is processed (if present).
In ``*.txt`` and ``*.m3u`` files, all lines starting with ``#`` are ignored.

@s-martin
Copy link
Collaborator

s-martin commented Jan 22, 2024

I guess it could make sense to pull some docs from docstring to the Markdown docs or at least reference it. E.g. like this

* [Docstring API Docs (from py files)](./docstring/README.md)
* [Plugin Reference](./docstring/README.md#jukeboxplugs)

Battery Monitor docs are also such a candidate.

@coveralls
Copy link

coveralls commented Jan 24, 2024

Pull Request Test Coverage Report for Build 7692545448

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 38.384%

Totals Coverage Status
Change from base Build 7646903644: 0.0%
Covered Lines: 418
Relevant Lines: 1089

💛 - Coveralls

@pabera pabera self-assigned this Jan 24, 2024
@pabera pabera changed the title Allow m3u playlist as card action Playlists, Livestreams, Podcasts Jan 24, 2024
pabera and others added 3 commits January 25, 2024 08:26
Co-authored-by: s-martin <s-martin@users.noreply.github.com>
Copy link
Collaborator

@s-martin s-martin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not try it yet, but it looks fine to me.


1. In the `audiofolders` directory (or any sub-directory), create a new folder.
1. In this new folder, copy your .m3u playlist. Make sure the links to the respective songs are correct.
1. Open the Web App. Under `Library`, select the `Folder` view and browse to the new folder you created.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Open the Web App. Under `Library`, select the `Folder` view and browse to the new folder you created.
1. Open the `Library` tab in the Web App, select the `Folder` view and browse to the new folder you created.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep it that way. It's represents a step by step guide where Open Web App comes first.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, just though of harmonizing the wording with Line 58

@pabera pabera merged commit c306719 into MiczFlor:future3/develop Jan 30, 2024
7 checks passed
@flipreverse
Copy link
Author

I'm very sorry returning that late to this PR. Thanks for considering my feedback.

One thing I don't get: Why do I have to put every playlist in a separate folder? On my opinion, it is the default behavior of nearly every audio player out there. Simply select the playlist as a file, and I'm done.
Moreover, moving my old CDs to the Phoniebox would have been easy as ripping the CD, and automatically creating a m3u playlist. This way I'll have to create a dedicated subfolder for every playlist created before moving the files to the Phoniebox.

@pabera
Copy link
Collaborator

pabera commented Feb 18, 2024

That's a good point. It was a choice. This way, you can still choose an individual song of your given playlist.

How do you organize your ripped CD's? In my opinion, you'd still manage them in individual folders.

I agree, this could still be added as an option. I'll keep it in mind.

To avoid too much manual work with copying the playlists, you could use a bash script to do this for you. If you have all your playlists in a folder, this script should be sufficient

for file in *.m3u; do folder=$(basename "$file" .m3u); mkdir -p "$folder" && mv "$file" "$folder"; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement future3 Relates to future3 development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants