-
Notifications
You must be signed in to change notification settings - Fork 401
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
Speedup phoniebox code #477
Comments
Hi @laclaro |
Hi, of course I was mostly commenting things and swiping again, so the things mentioned above did slow my rpi nano. I was testing with a short beep played by If I have some time, I may think on this matter. I think we have to change the settings-changing-mechanism of the web-interface. Does it just write the setting to one of the files? Best, Henning |
I extended the daemon and provided a script to handle the new settings files. I decided to go with two files:
It is work in progress still but provides playout-functionality and second_swipe. ~$ touch ~/RPi-Jukebox-RFID/shared/Card_Assignments.txt The code is here: https://github.com/laclaro/RPi-Jukebox-RFID There is work to do on changing the web-interface to use the change_setting.py script (that's at least what I was thinking of) and to extend the daemon to provide all the missing features of your bash-scripts. Help is welcome! Best, Henning |
Hi Henning @laclaro
|
Hi, thank's for taking this serious ;) First of all: I did not test with the spotify-version, since I don't like mopidy too much (I found it to slow for the pi, but only tried it with a large music database). Since I wanted to merge all card-settings to one single file my Card_Assignments.txt contains sections for each card that read like
This is essentially the If we wanted to migrate slowly, I could write my code such that the daemon only handles the things Once we decided how we move forward I will do a pull request with a working version in that direction. Best, Henning |
One quick comment: the daemon may handle everything that involves playing songs, so essentially replacing I already implemented the checks for the folder.conf options and second swipe. What I did not yet work on is a coherent script, that can be used by the web UI to manage the cards and options. If something is changed in the config or card assignments from within the web UI, the deamon could be triggered to reload the config files by some small file that is created by php or so. Best regards Henning |
Hi @laclaro |
I created a new repository (https://github.com/laclaro/python-phoniebox) for my work on the python-phoniebox module that is separated in the PhonieboxDaemon.py and the Phoniebox.py. This separation was intended to make it easy to create third-party python scripts (new web interface?) to import the Phoniebox module to perform config-changes or assign new card settings. In comparison with the plain MiczFlor-version it is much faster on my rpi3. Especially the bash-version starts lagging if you swipe too quickly. The daemon is configured by a single config file phoniebox.conf and is able to use the RFID-assignments set by the web interface (I call this "legacy" card assignments) and updates the card assignments regularly during runtime, so new assignments get passed to the new python daemon. My daemon writes the read "legacy" card assignments to a single file. I would like to have the web interface use this format on the long run. However, the PhonieboxDaemon keeps the settings and assignments in memory during runtime thus reducing SD-write operations that slow down the software. But since I am physicist and not a python developer, it is still lacking a couple of features like webstream support (has to be set up manually) and an additional script to natively change the config. You are welcome to help me out. Best, Henning |
Hi @laclaro |
…claro/master #477 contribution by laclaro: The python-phoniebox module is separated in the PhonieboxDaemon.py and the Phoniebox.py. This separation was intended to make it easy to create third-party python scripts (new web interface?) to import the Phoniebox module to perform config-changes or assign new card settings. In comparison with the plain MiczFlor-version it is much faster on my rpi3. Especially the bash-version starts lagging if you swipe too quickly. The daemon is configured by a single config file phoniebox.conf and is able to use the RFID-assignments set by the web interface (I call this "legacy" card assignments) and updates the card assignments regularly during runtime, so new assignments get passed to the new python daemon. My daemon writes the read "legacy" card assignments to a single file. I would like to have the web interface use this format on the long run. However, the PhonieboxDaemon keeps the settings and assignments in memory during runtime thus reducing SD-write operations that slow down the software. But since I am physicist and not a python developer, it is still lacking a couple of features like webstream support (has to be set up manually) and an additional script to natively change the config.
Love that idea! Will definitely do so in the mqtt module. |
Sorry for digging this old thread up. Best regards |
https://github.com/MiczFlor/RPi-Jukebox-RFID/tree/develop/scripts/python-phoniebox You have to run the PhonieboxDaemon.py (you may use systemd). |
Hey @laclaro |
startup-scripts.sh basically starts playoutcontrols which is not used anymore, correct. |
python-phoniebox was an early attempt to switch to python, but is not used anymore. There's a branch future3 to rewrite Phoniebox in python, but it's not usable in production yet. |
Hi @michnixweiss |
Thanks @laclaro, @s-martin, @MiczFlor for your answers. Do you have any suggestions to get the Pi Zero W start faster? The best I got is about 51sec to startup sound, which is the signal for my kids that its ready for use.
Most performance from compiled mpd, uninstalling/disabling unused stuff and switch to dropbear. I think about trying piCore or DietPi. What dependencies are needed (except python and php). |
Hi,
first of all: this is a great project! I don't like mopidy, because of it's bulkiness, therefore I stick to the slim MPD-version. However, on my raspberry pi nano the handling of rfid-triggering and playout is very slow (annoying lag, making it not suitable to children) and also on rpi3 I notice a lag.
Therefore I dug a bit in the codes of
rfid_trigger.sh
andplayout_controls.sh
.I think we should think about the approach used in the scripts. I identified some things that decrease the speed until playout considerably.
I tinkered a bit with the code to find this out. Is there the possibility to have a bash script run as daemon, such that all the script files are kept in memory already? Otherwise it would be clever to read all settings from python to avoid excessive I/O on swipe.
Best,
Henning
The text was updated successfully, but these errors were encountered: