- /* start a rescan straight away */
- if(initial_rescan)
- trackdb_rescan(ev);
- rescan_after(86400);
- /* periodically tidy up the database */
- dbgc_after(60);
- /* periodically check the volume */
- volumecheck_again(0, 0, 0);
- /* set initial state */
- add_random_track();
- play(ev);
+ /* Rescan immediately and then daily */
+ create_periodic(ev, periodic_rescan, 86400, 1/*immediate*/);
+ /* Tidy up the database once a minute */
+ create_periodic(ev, periodic_database_gc, 60, 0);
+ /* Check the volume immediately and then once a minute */
+ create_periodic(ev, periodic_volume_check, 60, 1);
+ /* Check for a playable track once a second */
+ create_periodic(ev, periodic_play_check, 1, 0);
+ /* Try adding a random track immediately and once every two seconds */
+ create_periodic(ev, periodic_add_random, 2, 1);