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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 | Enable Phoniebox to play a random subfolder #1170

Open
matthias-pelger opened this issue Dec 1, 2020 · 8 comments 路 May be fixed by #1175
Open

馃殌 | Enable Phoniebox to play a random subfolder #1170

matthias-pelger opened this issue Dec 1, 2020 · 8 comments 路 May be fixed by #1175

Comments

@matthias-pelger
Copy link

Feature Description

Scenario:
There are a lot of episodes of a certain audiobook (e.g. Benjamin Bl眉mchen) and the user does not care which specific episode is going to be played, but all chapters of that episode need to be played in ordered mode (obviously :) ).

The files are ordered in that way:
AUDIOFOLDERSPATH/Benjamin Bl眉mchen/Episode 1/.mp3
AUDIOFOLDERSPATH/Benjamin Bl眉mchen/Episode 2/.mp3

The RFID-Tag is assigned to the top folder (in this case Benjamin Bl眉mchen) via frontend. This would normaly lead to play all subfolders in ordered mode, which is great for most cases :)

As an inspiration/solution I provide my personalized way to do this.

My solution is to put a file named "random" with no content on the top level, making this the new file layout:
AUDIOFOLDERSPATH/Benjamin Bl眉mchen/random
AUDIOFOLDERSPATH/Benjamin Bl眉mchen/Episode 1/.mp3
AUDIOFOLDERSPATH/Benjamin Bl眉mchen/Episode 2/.mp3

And apply this patch to the "scripts/rfid_trigger_play.sh" in line 321:

# Look for file "random" to determine a random subfolder to be played
    if [ -f "${AUDIOFOLDERSPATH}/${FOLDER}/random" ]
    then
        RND_FOLDER=`find "${AUDIOFOLDERSPATH}/${FOLDER}/" -type d | shuf -n 1`
        FOLDER=${RND_FOLDER#"$AUDIOFOLDERSPATH/"}
    fi

@matthias-pelger
Copy link
Author

Investigating further, I figured that the second swipe is not working anymore with my quick&dirty enhancement.

Is there a specific reason why the secondswipe check is based upon the " Latest_Playlist_Played" as found in "rfid_triggerplay.sh"?

    # Check if the second swipe happened
    # - The same playlist is cued up ("$LASTPLAYLIST" == "$PLAYLISTNAME")
    if [ "$LASTPLAYLIST" == "$PLAYLISTNAME" ]

First guess would be to simple avoid this and aim directly for the CARDID (adding another file to store this in the same manner as playlist)

@MiczFlor
Copy link
Owner

MiczFlor commented Dec 3, 2020

Hi @matthias-pelger
thanks for the input. It's a great feature - and might need a little planning. Currently the check you found is needed to actually verify the second swipe - meaning the swipe comes up with the same playlist to be played.
I am at work, can not look into this further now.
All the best, micz

@matthias-pelger
Copy link
Author

Hi @MiczFlor,
thanks for the hint. As the project is good structured I tried to solve this on my own. This is what I came up with:
develop...matthias-pelger:random-subfolder-play

This just adds stuff to enable the WebUI to show an additional button for shuffle subfolders and a debug option.
In the player part, this now uses the existing logic for folder.conf with new parameter "FOLDERSHUFFLE".

Biggest change is in file "rfid_trigger_play.sh" where I changed the logic of secondswipe check from LASTPLAYLIST to LASTID. LASTID is basically the folder from CARDID, seperating the really played folder from the one assigned to the card.
Beside this, tht LASTPLAYLIST is still there and being set. I think this will not break anything and still enable a thourough secondswipe check.

I thought on creating a pull request right away, but first I wanted some input and maybe ideas on improving things or make it more acceptable for the project.

I run this version now all evening and have no bugs found so far. Happy to hear your thoughts on this!

@matthias-pelger matthias-pelger linked a pull request Dec 5, 2020 that will close this issue
@s-martin s-martin linked a pull request Dec 7, 2020 that will close this issue
@s-martin s-martin added this to the 2.3 milestone Dec 7, 2020
@alwashe
Copy link

alwashe commented Dec 30, 2020

This feature would be great. Is there a way to achieve this as an amateur?

@matthias-pelger
Copy link
Author

hi @alwashe,

to be honest, I'm a newbee to git. I only know of two options:

  1. make the changes you see here (develop...matthias-pelger:random-subfolder-play) yourself
  2. checkout the branch from my repo. But I'm a bit behind compared to the master of @MiczFlor, as it was never intended as a fork for someone else

Maybe @MiczFlor or @s-martin or someone else knows of a trick here?

@biohazardxxx
Copy link

This would be great to get merged. Looking forward to get this. Currently I need to reassign RFID tags each second day to a new episode

@s-martin s-martin modified the milestones: 2.3, 2.4 May 15, 2021
@s-martin s-martin removed this from the 2.4 milestone Aug 28, 2022
@alwashe
Copy link

alwashe commented Mar 3, 2023

I think this feature is absolutly essentlial. I can't make 500 rfid cards for every episode!? or do i miss something?

@hollywoot
Copy link

hollywoot commented Apr 14, 2023

hi @alwashe,

to be honest, I'm a newbee to git. I only know of two options:

  1. make the changes you see here (develop...matthias-pelger:random-subfolder-play) yourself
  2. checkout the branch from my repo. But I'm a bit behind compared to the master of @MiczFlor, as it was never intended as a fork for someone else

Maybe @MiczFlor or @s-martin or someone else knows of a trick here?

I've tried to edit it manually by myself but it didnt work.
So it would be great to get a step-by-step guide. :-)

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

Successfully merging a pull request may close this issue.

6 participants