added README

This commit is contained in:
John McQuah 2022-03-21 11:31:20 -04:00
parent c07335bf5e
commit d474237518
4 changed files with 87 additions and 5 deletions

4
REPO
View File

@ -332,11 +332,11 @@ f:5a1495ba54a541d79d29e7ce959d1d05:szip/.footprint
f:3b19c6ac102ca10a67448ca2191c7c55:gl2ps/.signature
f:bc45d9a30234cc872ff10b60dd93061a:gl2ps/Pkgfile
f:aa56dda5637db25cffd60e5bfb1a6f52:gl2ps/.footprint
f:2c47bfa9448015108ea1e4da3ace88db:deadbeef-alarm/.signature
f:c771644583d5eeae51bb7db6e19cf81f:deadbeef-alarm/.signature
f:cc0fb01dffe503647857a6d1d511cb2c:deadbeef-alarm/Pkgfile
f:692f2435b0ffafa4d3014a1d56d8fdc7:deadbeef-alarm/Makefile
f:a33f8fd6cd3eac9152dcde6f1cb6fb87:deadbeef-alarm/.footprint
f:256520d2f64077f6a5482996da44c69c:deadbeef-alarm/alarm.cc
f:6d075fe426dfedbfd0578bc1cb888a4c:deadbeef-alarm/alarm.cc
f:22142d28d20c3d7a0ac148c877271075:oksh/.signature
f:88d321b08d3354e14157b55bd7fe073a:oksh/Pkgfile
f:d75610ef197b7420248d913c319b1d5c:oksh/post-install

View File

@ -1,6 +1,6 @@
untrusted comment: verify with /etc/ports/jmq.pub
RWTTPlFarK9CxA9Txf8BmbHVI8ivDQNs3pL2ZxYQrYTNPfO2bIYCn2w5yrO7SQG8USXiXswh6Rfgz3S4pTbEYWq9kQmaw3/rxgU=
RWTTPlFarK9CxPNofZN5KKyYGEe4kkRMDLT1RozCpO2UbtuePpbnzrtvtIR87JNA40AgvVn+YLJhFYbjI5pFnHVJtUh3fnzPRwc=
SHA256 (Pkgfile) = c6a63405841ecea18b783c342b406af496f53eaa7e062def2ed98bdef40d35cf
SHA256 (.footprint) = e381b96011b0b5d436dc16328dc442cd0cc58d2ad5a1a065c99cb8106f21b473
SHA256 (alarm.cc) = f6fbb373da4bca5d21e3246a72077d26e1aac1c11b07d37aa33f0119edf772ae
SHA256 (alarm.cc) = be0e1fd9c96ce85dd13fd5bf882ad61d4d57601502e265b8d0e410ec1d6708fe
SHA256 (Makefile) = 4e349a81457b623f8a26eda596fdffda6167b1d764d75a0fb83b02cdb7d95032

82
deadbeef-alarm/README.md Normal file
View File

@ -0,0 +1,82 @@
# 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.
1. https://github.com/Serranya/deadbeef-mpris2-plugin
2. 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`
and `https://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)"` and
`GLIB_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.

View File

@ -180,7 +180,7 @@ static DB_misc_t plugin = {
"You should have received a copy of the GNU General Public License\n"
"along with this program; if not, write to the Free Software\n"
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n",
.website = "https://git.sdf.org/jmq/cruxports/deadbeef-alarm-plugin",
.website = "https://git.sdf.org/jmq/cruxports/deadbeef-alarm",
.start = onStart,
.stop = onStop,
.connect = NULL,