am new to Python and have been struggling to create a workable script for a friends project - am hoping someone can point me in the right direction!
The script is to control playback of mp3 files from certain directories on certain days. So, for example, on May 1 2019 at 10:00 I want to play all the mp3 files in directory 000 and I want them to repeat until 10:00 the next day. Then, on May 2 at 10:00 I want to play all the mp3 files from directory 001, May 3/003, May 4/004 etc.
I thought it would be quite straightforward but seem to be getting myself into a bit of a pickle. I've managed to use the crontab to play the files in one directory (using omxplayer) at 10:00 each day and I've cobbled together a script that plays the files in a loop and have looked into timedate and system functions but I don’t know where I should start to put this together.
I want to do it in an elegant and DRY fashion but am limited on the backend stuff (I do frontend mostly).
My initial thinking is that I need to have a lookup table to map the days to the correct directories - would that be right? Then I could, I presume, have something along the lines of ‘if day is x then run files in directory y’ with a control for resetting it at 10:00 the next day. My original plan for that was to just reboot the RPi using the crontab at 09:58 to a, halt the loop and b, rest everything for the new day.
Figure there must be a 'correct' way to do this as I just seem to be murdering the code by hacking bits and pieces together.
Also - the RPi won’t be online and will have wi-fi turned off - am using a real-time clock for timing.
I’ve been trying to figure all this out but hadn’t anticipated having to learn Python to quite the level that it seems is needed. Am learning some awesome stuff though - which is good as I've just bought my kids a Pi starter kit on the back of this.
Any help/pointers/snippets appreciated.