MiczFlor / RPi-Jukebox-RFID

A Raspberry Pi jukebox, playing local music, podcasts, web radio and streams triggered by RFID cards, web app or home automation. All plug and play via USB. GPIO scripts available.
http://phoniebox.de
MIT License
1.33k stars 395 forks source link

🐛 | web app: first char of folder missing #1129

Open schirrm opened 3 years ago

schirrm commented 3 years ago

Bug

in the web app the first chat of the audio file folders is missing. in my setup the audiofiles are stored in the user's home in a subfolder "audiofiles" (~/audiofiles), this was also configured during setup.

The web app removes the first char of every folder. thus connecting the folders to cards wouldn't work. whilst analyzing my problem, I found out that adding the same folder with an additional char at the beginning can work around (e.g. "test" would be shown as "est", adding "ttest" would be shown as "test" thus this could be connected with a card)

Code review let me find that the change the folder parsing could solve the problem for my installation (had to be change for every occurance)

new:$temp['path_rel'] = substr($subfolderfile, strlen($Audio_Folders_Path) , strlen($subfolderfile));
old://$temp['path_rel'] = substr($subfolderfile, strlen($Audio_Folders_Path) + 1, strlen($subfolderfile));

wouldn't think this happens to every body thus not trying to merge it to the branch. not quite sure whether this would be a char-set problem, didn't try a different installation and comparism but just fixed it in my ;)

(installed on current rasbian buster, used the latest image available last weekend plus dist-upgrade; using german i18n, with utf on rasberry pi zero w)

What I did

What happened

I expected this to happen

please check if relevant for other / for general fixing

Further information that might help

Software

Base image and version

Raspberry Pi OS (32-bit) Lite Version:August 2020 Release date:2020-08-20 Kernel version:5.4

Branch / Release

EDITION="classic" LANG="de-DE" VERSION="2.1.1 - 70f989b - master"

Installscript

busterinstall-default.sh

Hardware

RaspberryPi version

pi zero w

RFID Reader

mfrc522

Soundcard

cm108

Other notable hardware

s-martin commented 3 years ago

Thanks for pointing that out. I wonder why this wasn’t found earlier.