Page 2 of 3

Re: [PROPOSAL]: Alarm Clock

PostPosted: 23 Feb 2015, 10:44
by JB314
I don't think there is advantage over systemd, it's just a different way to do that.
Probably systemd brings some new features but I used to use crond, so... :D

Re: [PROPOSAL]: Alarm Clock

PostPosted: 07 Jan 2016, 20:13
by SlF
JB314 wrote:Here is another version of the Alarm Clock feature, tested on tablet and normally well "bootstraped".

RuneAudio-Wakeup.png


You can download the necessary files here :
RuneAudio-Wakeup.tar.gz


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



Nicely done! I applied your addon, but it isn't working :-( The webpage and menu item are working, but my alarms are not working. I applied an alarm for 20:10 at 20:09 and there was no alarm. cronie is up and running and the timezone is correct. I checked with "date" via ssh and it shows the correct time.

Any ideas?

Re: [PROPOSAL]: Alarm Clock

PostPosted: 08 Jan 2016, 10:07
by JB314
Hi SlF,
You can check the content of the files /var/www/command/wakeup and /var/www/command/wakeup.cron if there is something inside.
The 1st one stores the data for the WebUI and the 2nd one stores the data for cron job.
If they are empty, that means the data are not correctly submitted or saved. You can check the owner and group and verify the write access on both files. (commands for that are chown and chmod)
You can also check contab items to see if there is something pending : crontab -l
If everything is okay here, it can be the rights on the play and stop files. Just check the owner and group and verify the exec access is on.
Let me know.
JB

Edit : If you are running the dev branch on your system, you can also check the pull request i've made on top of it, which adds alarmclock, podcasts player and a "sleep mode" : https://github.com/RuneAudio/RuneUI/pull/67.
It could be applied also on the master branch but the source code may be a little bit different.

Re: [PROPOSAL]: Alarm Clock

PostPosted: 11 Jan 2016, 13:51
by SlF
Thanks for your help, I made play and stop files +x and now everthing is working :-)

Re: [PROPOSAL]: Alarm Clock

PostPosted: 28 Jan 2016, 15:41
by Pilou007
SlF wrote:
JB314 wrote:Here is another version of the Alarm Clock feature, tested on tablet and normally well "bootstraped".

RuneAudio-Wakeup.png


You can download the necessary files here :
RuneAudio-Wakeup.tar.gz


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



Nicely done! I applied your addon, but it isn't working :-( The webpage and menu item are working, but my alarms are not working. I applied an alarm for 20:10 at 20:09 and there was no alarm. cronie is up and running and the timezone is correct. I checked with "date" via ssh and it shows the correct time.

Any ideas?


You are lucky ... in the web UI nothing appears in the menu ...
What Can I do?

Re: [PROPOSAL]: Alarm Clock

PostPosted: 31 Jan 2016, 12:25
by SlF
You are lucky ... in the web UI nothing appears in the menu ...
What Can I do?


________________________

Did you reboot or at least restarted php? Did you copy ALL the file? Did you edit the array list? The array list is important to give you "Alarm Clock" in the upper right menu.

Re: [PROPOSAL]: Alarm Clock

PostPosted: 02 Feb 2016, 16:42
by SlF
Hi JB,

could you please share your sleep timer code? Tried to make my own but wasn't successful.
My idea was using your alarm clock and only use the duration part to run the stop bash script.

I changed the template but don't quite understand your alarm_ctl code...

Code: Select all
<div class="container">
   <h1>Sleep Timer</h1>
   <form class="form-horizontal" action="" method="post" role="form">
      <fieldset>
         <legend>Sleep Timer Status</legend>
         <div class="form-group" >
            <label for="enable" class="col-sm-2 control-label">Enable</label>
            <div class="col-sm-10">
               <label class="switch-light well" onclick="">
                  <input name="sleeptimer[enable]" type="checkbox" value="1"<?php if($this->enabled == 1): ?> checked="checked" <?php endif ?>>
                  <span><span>OFF</span><span>ON</span></span><a class="btn btn-primary"></a>
               </label>
               <span class="help-block">Enable or disable sleep timer.</span>
            </div>
         </div>
      </fieldset>
      <fieldset>
         <legend>Set time</legend>
         <div class="form-group">
            <div class="col-md-2 col-md-offset-0 col-sm-7 col-sm-offset-1 col-xs-12">Time</div>
            <div class="clearfix visible-xs-block">&nbsp;</div>
         </div>

         <div class="form-group form-actions">
            <div class="col-sm-offset-2 col-sm-10">
                <button class="btn btn-primary btn-lg" value="save" name="save" type="submit">Apply</button>
                <span class="help-block">Save.<br>
                Don't forget to apply your changes.
                </span>
            </div>
         </div>
      </fieldset>
   </form>
</div>


I hope you don't mind me using and changing your code :-)

SlF

Re: [PROPOSAL]: Alarm Clock

PostPosted: 07 Feb 2016, 19:44
by Pilou007
SlF wrote:You are lucky ... in the web UI nothing appears in the menu ...
What Can I do?


________________________

Did you reboot or at least restarted php? Did you copy ALL the file? Did you edit the array list? The array list is important to give you "Alarm Clock" in the upper right menu.


Hi Sif
I reboot the po and restart php, I copy all the files listed I modify the file $controllers array as mention.
What do you mean by array list?
Best regards

Re: [PROPOSAL]: Alarm Clock

PostPosted: 10 Feb 2016, 12:44
by SlF
Pilou007 wrote:
Hi Sif
I reboot the po and restart php, I copy all the files listed I modify the file $controllers array as mention.
What do you mean by array list?
Best regards


Hi, here are a few steps, please make sure you did them EXACTLY!

-Copy ALL the files to the RIGHT paths

-make stop.sh and play.sh executable by chmod +x play and chmod +x stop (make sure you are inside the folder, otherwise you'll have to put the path in front of the filename.

-edit the controller array and don't forget the ","! You have to make a "," after the last item and add your 'wakeup' since the last item had no "," and now 'wakeup' will be your last one.


Greetz

Re: [PROPOSAL]: Alarm Clock

PostPosted: 16 Feb 2016, 16:39
by Pilou007
Hi Sif
I tried another time with a new SD card :
[root@runeaudio ~]# cd /boot
[root@runeaudio boot]# tar -xvf RuneAudio-Wakeup.tar
var/www/assets/js/runeui.js
var/www/assets/js/runeui.min.js
var/www/assets/js/vendor/jquery.clockpicker.min.js
var/www/assets/js/vendor/jquery.bootstrap-touchspin.min.js
var/www/assets/css/jquery.clockpicker.min.css
var/www/assets/css/jquery.bootstrap-touchspin.min.css
var/www/command/play
tar: var/www/command/play: Cannot change ownership to uid 33, gid 33: Operation not permitted
var/www/command/stop
tar: var/www/command/stop: Cannot change ownership to uid 33, gid 33: Operation not permitted
var/www/app/wakeup_ctl.php
var/www/app/templates/wakeup.php
var/www/app/templates/header.php
var/www/app/templates/footer.php
tar: Exiting with failure status due to previous errors

you can see two errors in the files copied. why ???
i have double checked the $controllers array i have add a , just after tun as you can see :
'settings',
'sources',
'tun',
'wakeup'
);

cronie is installed and enable...


I really need help as I am not very comfortable with all this stuff (nor in english ;-) )
thanks for your help

Pilou007