.. | ||
.footprint | ||
.signature | ||
alarm.cc | ||
Makefile | ||
Pkgfile | ||
README.md |
alarm clock plugin for DeaDBeeF
About
This plugin allows the DeaDBeeF music player to serve as an alarm clock.
Even with its comprehensive set of command-line options, DeaDBeeF is
ultimately a graphical program, in most cases completely unreachable
from the restricted environment in which crontab shell scripts are executed.
The MPRIS plugin[1] does allow some control of the media player from a crontab
script, but because the dbus session bus address is not exported to cron
tasks, this environment variable must be hard-coded in the shell script
you intend to use for activating DeaDBeeF. (Perhaps a hook for pam_xdg.so
could automatically update your shell script after a successful login and
dbus session launch.) Even after surmounting this obstacle, you'll discover
that the MPRIS plugin implements only one method for selecting a particular
file for playback (OpenUri), and to assemble an entire playlist with this
method you would have to parse the metadata of each song to determine how
long the parent process should sleep between successive calls of OpenUri.
TLDR: working around the limitations of crontab and MPRIS is more
trouble than building a specialized plugin for alarm clock functionality.
To close the gap between DeaDBeeF and its console-interface counterparts (moc, mpd, cmus -- all of which can be controlled by scripts in a crontab), this plugin translates the underlying logic of the audacious alarm plugin[2] into the DeaDBeeF idiom. The configuration dialog lets you choose which days of the week the alarm goes off, what time of day, and which playlist you want loaded. Leaving the playlist field empty (or selecting an invalid file) will just start playback at the beginning of the current list when the alarm goes off.
- https://github.com/Serranya/deadbeef-mpris2-plugin
- https://github.com/audacious-media-player/audacious-plugins/tree/master/src/alarm
What is missing
The following features were present in the audacious alarm plugin, but have not been implemented here.
- Volume fading from quiet to loud after a fixed time interval. If you need that kind of control, the mixer commands for most audio stacks (ALSA, OSS, Pipewire, Pulseaudio, sndio) work fine when executed within crontab scripts, and you can just leave the DeaDBeeF volume slider at its highest level.
- Stopping the playback after a specified time interval. (TODO: let the plugin itself turn off repeat mode if that behaviour is desired, simply by adding a "disable repeat mode" checkbox to the alarm configuration dialog. It then becomes the user's responsibility to make sure a playlist of the appropriate length is selected, so playback doesn't continue past the transition from sleep to wakefulness.)
- Setting a different alarm time for each day of the week. Sleep professionals recommend that you stick to a consistent bedtime and wakeup time for optimal health. (But if you have a healthy sleep regimen in the first place, you probably wake up at the right time without an alarm. Omitting this feature thus makes the plugin less useful to people who genuinely need a mechanical disruption of their established sleep-wake cycle.)
How to install
For CRUX users
- cd to a directory in your local ports overlay
- download the source code from this host:
httpup sync https://git.sdf.org/jmq/cruxports/raw/branch/master/#deadbeef-alarm deadbeef-alarm
- prt-get depinst install deadbeef-alarm
For users of other Linux distributions
- check that all dependencies and header files are installed (DeaDBeeF and glib)
- save the source code and the Makefile
(
https://git.sdf.org/jmq/cruxports/deadbeef-alarm/alarm.cc
andhttps://git.sdf.org/jmq/cruxports/deadbeef-alarm/Makefile
) into a working directory. - cd to the working directory and run make. Invoke make with
GLIB_CXX_FLAGS="$(pkg-config --cflags glib-2.0)"
andGLIB_LD_FLAGS="$(pkg-config --libs glib-2.0)"
if your distribution has installed the shared glib libraries in non-standard locations. - run
make install
, optionally prepending a custom setting for PREFIX (such as $HOME/.local) or DESTDIR.
How to contribute
Patches are welcome. See the header of the accompanying Pkgfile for contact information.