Page 1 of 3

[PROPOSAL]: Alarm Clock

PostPosted: 05 Feb 2015, 14:35
by cyber7
I have a proposal for an alarm-clock. Basically working just like a normal clock:

ENTRY: Once off/Repeatedly.
ENTRY: Start Time. (Mon-Fri)
ENTRY: Playlist.
ENTRY: MAX Volume.
ENTRY: Weekend Start Time.

Function:
Fade "Playlist" from 0 to "MAX Volume" over 10 Minutes starting at "Start Time".

Screens:
SCREEN1: Currently set-screen.
SCREEN2: Settings.

Depending on the amunt of interest, I will have a look at creating this as an add-in.

cheers
cyber7 (aka Aubrey Kloppers; Cape Town; South Africa)

Re: [PROPOSAL]: Alarm Clock

PostPosted: 05 Feb 2015, 16:53
by ACX
My suggestion for the clock setup on the frontend side is to use this component:
http://weareoutman.github.io/clockpicker/
It's built on Bootstrap and jQuery, and can be perfectly integrated in the RuneUI.

Re: [PROPOSAL]: Alarm Clock

PostPosted: 09 Feb 2015, 15:01
by JB314
Hi,
I'm new to RuneAudio, great work by the way, and I've developed an Alarm Clock feature.
The ACX's suggestion is perfect and I'll integrate this time picker in my page !

Currently how it works :
- new "WakeUp" item in the menu
- a new page where you enable/disable globally the alarm feature, then, for each week day, enable/disable the alarm, set start time, set a duration and select a playlist from a drop down list (known bug : playlist name without space...).
- alarms infos stored into a separated file, json format.
- a cron is created from these data
- cron will contains 2 lines per alarm : start and stop
- start @ time: start a shell script which clear the current mpd playlist, load the new playlist and play it.
- stop @ time + duration : start a shell script which stop playing.

I would like to add a "fade-in" mode to this feature, but my volume knob a is motorized knob... need to code some gpio related stuff in order to drive this knob. But I'm looking to something more "transparent" with a alsa driver or something like that. Something which react correctly when we execute standard commands like mpc volume +5...

I'm very new to php and php-fpm and runeUI code, so I'm not sure my code is well designed (used to use C# instead ;) ), so how then can I send the new files to be reviewed ? (I have a github account)

(I've also dev a new "Podcast" entry in the library, where we can add and parse rss podcast (xml) and listen to it, don't know if it's a good feature but, if you want it too I can sent it too, just need to know how ? )

Re: [PROPOSAL]: Alarm Clock

PostPosted: 10 Feb 2015, 01:04
by ACX
JB314 wrote:I'm very new to php and php-fpm and runeUI code, so I'm not sure my code is well designed (used to use C# instead ;) ), so how then can I send the new files to be reviewed ? (I have a github account)

Hi JB31,
just link here your progress or make a pull request on the "dev" branch (start working from that).
My suggestion is to try to make that as much modular as possible, as a refactor of the entire UI is under development, so it will be easier to port it to the new code when ready.

Re: [PROPOSAL]: Alarm Clock

PostPosted: 10 Feb 2015, 08:16
by cyber7
JB314 wrote:Hi,
I'm new to RuneAudio, great work by the way, and I've developed an Alarm Clock feature.
The ACX's suggestion is perfect and I'll integrate this time picker in my page !

Currently how it works :
- new "WakeUp" item in the menu
- a new page where you enable/disable globally the alarm feature, then, for each week day, enable/disable the alarm, set start time, set a ...


Hi JB314
I have also started with the project and would like to see how far you are :) - Please could I get access to your code?

kind regards
cyber7 (aka Aubrey Kloppers; Cape Town; South Africa)

Re: [PROPOSAL]: Alarm Clock

PostPosted: 12 Feb 2015, 10:33
by JB314
Hi and thanks for your answers,
I'll probably push the files tonight or tomorrow.

@ACX, could you give me some info about how you imagine "plugins" should work ? (menu items into a separate file ? Separate file for all specific functionality ? avoid adding things into runeaudio.php ? ... )

BTW, I'm currently adding functionality directly on the RPi, but vi is not very "dev friendly", I'm installing a VM with Arch and the cookbook, it will be easier for future dev.

Re: [PROPOSAL]: Alarm Clock

PostPosted: 12 Feb 2015, 13:35
by cyber7
Just completed the following alarm plugin. I decided not to go with clockpicker as it does not work that well with SmartPhones.

Function:
* Enable/Disable with the SET ALARM or RESET ALARM options
* Uses Playlists from Webradio
* 2 date functions: MON-FRI or MON-SUN[/list]

I am busy getting all the code into a tar file and will be posting it later this afternoon/tomorrow...

alarm.jpg
alarm.jpg (70.14 KiB) Viewed 4766 times

Re: [PROPOSAL]: Alarm Clock

PostPosted: 12 Feb 2015, 18:24
by ACX
Good job!
cyber7 wrote: I decided not to go with clockpicker as it does not work that well with SmartPhones.

Test this then:
http://jdewit.github.io/bootstrap-timepicker/

Re: [PROPOSAL]: Alarm Clock

PostPosted: 22 Feb 2015, 17:24
by JB314
Here is another version of the Alarm Clock feature, tested on tablet and normally well "bootstraped".

RuneAudio-Wakeup.png
RuneAudio-Wakeup.png (80.9 KiB) Viewed 4690 times


You can download the necessary files here :
RuneAudio-Wakeup.tar.gz
(41.52 KiB) Downloaded 783 times


It contains these following new or modified files :

    /var/www/assets/js/runeui.js : add clockpicker and touchspin initialisation
    /var/www/assets/js/runeui.min.js : same but minified
    /var/www/assets/js/vendor/jquery.clockpicker.min.js : new clockpicker component
    /var/www/assets/js/vendor/jquery.bootstrap-touchspin.min.js : new touchspin component (+ and - for number input)
    /var/www/assets/css/jquery.clockpicker.min.css
    /var/www/assets/css/jquery.bootstrap-touchspin.min.css
    /var/www/command/play : script used for starting properly a playlist through cron
    /var/www/command/stop : stop playback through cron
    /var/www/app/wakeup_ctl.php : new controler for handling whole AlarmClock process
    /var/www/app/templates/wakeup.php : template
    /var/www/app/templates/header.php : add .css link
    /var/www/app/templates/footer.php : add .js components

[Edit 23.02.2015] : I just thought I forgot to add a file...
in addition you have to modify the file /var/www/index.php to add a new item in the $controllers array :

Code: Select all
 
$controllers = array(
    'credits',
    'coverart',
...
    'sources',
    'tun',
    'wakeup' // <- this line
);



In order to have it working, be careful you specified a correct timezone in RuneAudio Settings.

Then connect to SSH and start the cron service (it should be already installed):

Code: Select all
systemctl enable cronie
systemctl start cronie


If you don't reboot, you may have to restart the php-fpm service in order to see the new pages :
Code: Select all
systemctl restart php-fpm


Feel free to comment and adapt!
JB314

Re: [PROPOSAL]: Alarm Clock

PostPosted: 23 Feb 2015, 08:48
by dwijtsma
Maybe a little bit of topic, but what are the advantages of cron compared to systemd? I use systemd to make my runeaudio add-on script work after a reboot. I guess there's a reason both exist next to each other...