Skip to content

🚀 | Enable Phoniebox to play a random subfolder #1170

Open
@matthias-pelger

Description

@matthias-pelger

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions