JuliusCode / MP4MUSEUM

MP4MUSEUM.org Media Player
GNU General Public License v3.0
32 stars 8 forks source link

Ability to boot into rw then go read-only? #21

Closed AKAMEDIASYSTEM closed 1 year ago

AKAMEDIASYSTEM commented 1 year ago

Hi, I'm really enjoying your software - much more reliable and easy to work with than expensive Brightsign products!

The software works exactly as described, so I'd understand if I'm my own trying to implement the following behavior:

I altered the python script to get datetime.datetime.now() and then not start playing until my conditions are met (ie, minute = 0 or hour > 10). However, since the OS is read-only, it always boots to the time in 2021 when the disk image was created.

I'm looking at two solutions - either change everything so that the OS boots into rw mode, sets the time, and then remounts into read-only mode. I don't have much experience with mounting drives programmatically, so this seems slightly risky to me (and I've not made much progress after a few hours of hacking); the second option is to append an ESP32, powered by a USB port and connected to the ground and Pause GPIO pins - in this setup the ESP would do the connecting to wifi and NTP sync.

I'd love to figure out how to do Solution 1 since adding another microcontroller adds complexity and seems inelegant - however, I wonder if Solution 1 has downsides I haven't considered?

Any thoughts or advice would be most welcome; thank you again for making this software available!

AKA

JuliusCode commented 1 year ago

Hi there,

from what you have written i would advise against making the current image writable on boot, as there have been a bunch of modifications to the system to make it read-only. none of this is my work, i was using the read-only script from adafruit, however, they have suspendet its use due to the new read-only mode that rapsbian OS has now built in.

maybe you would start with a fresh raspbian lite image and work your way from there: cron and ntp would be available and run per default.

sudo apt-get install vlc python3-pip pip3 install python-vlc RPi.GPIO

is all you need to make the script run on a default image.

in mp4museum, the script starts via /etc/rc.local, and console is off. another route is to enable auto-login and use the login script of bash to start the script, then you can exit to console.

best, Julius.

AKAMEDIASYSTEM commented 1 year ago

Thank you for the quick reply! I think since this is more of an asking-for-ideas issue it might be clearer to close it (if you like). I can, I think, still update the issue with any progress of mine even if it's closed...

JuliusCode commented 1 year ago

i think it gets re-opened when you comment again, i'll just leave it open for now... and please do write about your progress, if you got it working. also i would offer to put your code up if you are willing to share, just credit yourself in the header as you wish?

AKAMEDIASYSTEM commented 1 year ago

I wired up a microswitch and affixed it to the case to allow a gallerist to re-synchronize the piece on demand, rather than give up the benefits of read-only operation. I was momentarily confused by the pin 13 reference but sorted it out when I realized you refer to hardware pin 13 (aka "broadcom" and "GPIO" pin 27)

Operation in this manner is stable enough that re-sync is only needed once a week, max - thanks again for the excellent work!

AKA

JuliusCode commented 1 year ago

hey, glad you found a way to make it work. it got me thinking there could be a GPIO output with a high signal every time playback starts, or similar, to get sync between directly connected boards.

the GPIO is assigned in "board mode" according to the guidelines of the raspberry pi foundation, as otherwise you would need different connections on certain pi models. board mode works across all raspberries.