diff --git a/lastfmsubmitd/PKGBUILD b/lastfmsubmitd/PKGBUILD new file mode 100644 index 000000000..72d9d4c3b --- /dev/null +++ b/lastfmsubmitd/PKGBUILD @@ -0,0 +1,49 @@ +# +# Chakra Packages for Chakra, part of chakra-project.org +# +# maintainer (i686): Phil Miller +# maintainer (x86_64): Manuel Tortosa + +# include global config +source ../_buildscripts/${current_repo}-${_arch}-cfg.conf + +pkgname=lastfmsubmitd +pkgver=1.0.6 +pkgrel=2 +pkgdesc="A Last.fm 'plugin' client for MPD, implemented in Python." +arch=(i686 x86_64) +url="http://www.red-bean.com/~decklin/software/lastfmsubmitd/" +license=('MIT') +depends=('python-mpdclient2') +makedepends=('python') +optdepends=('mpd: For local audio playback') +backup=( etc/lastfmsubmitd.conf ) +install=lastfmsubmitd.install +source=(http://www.red-bean.com/~decklin/software/$pkgname/$pkgname-$pkgver.tar.gz + lastmp + lastfmsubmitd + lastmp.conf + lastfmsubmitd.conf) +md5sums=('eadf6f8a7c3a5f8b6311a6fae5c117f6' + 'b8b51b54deea837250fba411f0983bda' + '49559328f9e53eb840dcf0364afec818' + 'f331cb1fca46eb0b91be269babe49224' + 'b3682da7c8a733b14c93dd6f5eb8d1c2') + +build() { + cd $srcdir/$pkgname-$pkgver + mkdir -p $pkgdir/usr + /usr/bin/python setup.py install --prefix=$pkgdir/usr + install -D -m 755 ../lastfmsubmitd.conf $pkgdir/etc/lastfmsubmitd.conf + install -D -m 600 ../lastmp.conf $pkgdir/etc/lastmp.conf + install -D -m 755 ../lastfmsubmitd $pkgdir/etc/rc.d/lastfmsubmitd + install -D -m 755 ../lastmp $pkgdir/etc/rc.d/lastmp + install -D -m 755 contrib/lastmp $pkgdir/usr/bin/lastmp + install -d -g audio -m 775 $pkgdir/var/log/lastfm + install -d -g audio -m 775 $pkgdir/var/run/lastfm + install -d -g audio -m 775 $pkgdir/var/spool/lastfm + install -d -g audio -m 775 $pkgdir/var/cache/lastfm + install -D -m644 README $pkgdir/usr/share/licenses/$pkgname/LICENSE +} + +# vim:set ts=2 sw=2 et: diff --git a/lastfmsubmitd/lastfmsubmitd b/lastfmsubmitd/lastfmsubmitd new file mode 100755 index 000000000..84989479e --- /dev/null +++ b/lastfmsubmitd/lastfmsubmitd @@ -0,0 +1,59 @@ +#!/bin/bash + +daemon_name=lastfmsubmitd + +. /etc/rc.conf +. /etc/rc.d/functions + +get_pid() { + pidof -x -o %PPID -o $$ -o $PPID $daemon_name +} + +case "$1" in + start) + stat_busy "Starting LastFMSubmitd" + PID=$(get_pid) + if [ -z "$PID" ]; then + [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid + /usr/bin/$daemon_name + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + echo $(get_pid) >/var/run/lastfm/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + fi + ;; + + stop) + stat_busy "Stopping LastFMSubmitd" + PID=$(get_pid) + [ ! -z "$PID" ] && kill $PID &>/dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +exit 0 diff --git a/lastfmsubmitd/lastfmsubmitd.conf b/lastfmsubmitd/lastfmsubmitd.conf new file mode 100644 index 000000000..68b34a9bb --- /dev/null +++ b/lastfmsubmitd/lastfmsubmitd.conf @@ -0,0 +1,15 @@ +# lastfmsubmitd.conf +# +# To have lastfmsubmitd properly submit your songs, you must tell +# lastfmsubmitd your Last.fm username and password. + +# Uncomment these lines and fill in the appropriate information. + +#[account] +#user: user +#password: password + +# If you are using Libre.fm, uncomment these lines: + +#[server] +#url = http://turtle.libre.fm/ \ No newline at end of file diff --git a/lastfmsubmitd/lastfmsubmitd.install b/lastfmsubmitd/lastfmsubmitd.install new file mode 100644 index 000000000..ef7b420dc --- /dev/null +++ b/lastfmsubmitd/lastfmsubmitd.install @@ -0,0 +1,6 @@ +post_install() { + echo "!!> You must edit /etc/lastfmsubmitd.conf for these daemons to work You must also add lastfmsubmitd AND lastmp to your DAEMONS=() array for last.fm reporting to start on boot. /var/run/lastfm/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + fi + ;; + + stop) + stat_busy "Stopping LastMP" + PID=$(get_pid) + [ ! -z "$PID" ] && kill $PID &>/dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +exit 0 diff --git a/lastfmsubmitd/lastmp.conf b/lastfmsubmitd/lastmp.conf new file mode 100644 index 000000000..1ceb9119a --- /dev/null +++ b/lastfmsubmitd/lastmp.conf @@ -0,0 +1,6 @@ +# Uncomment and fill the password in if needed. + +[mpd] +host: localhost +port: 6600 +#password: *****