Adding lastfmsubmitd, Last.fm plugin client in Python

This commit is contained in:
abveritas 2010-09-23 19:33:48 +00:00
parent 51547efc23
commit 98f72b627d
6 changed files with 194 additions and 0 deletions

49
lastfmsubmitd/PKGBUILD Normal file
View File

@ -0,0 +1,49 @@
#
# Chakra Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
# 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:

59
lastfmsubmitd/lastfmsubmitd Executable file
View File

@ -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

View File

@ -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/

View File

@ -0,0 +1,6 @@
post_install() {
echo "!!> You must edit /etc/lastfmsubmitd.conf for these daemons to work <!!"
echo "!!> You must also add lastfmsubmitd AND lastmp to your DAEMONS=() <!!"
echo "!!> array for last.fm reporting to start on boot. <!!"
}

59
lastfmsubmitd/lastmp Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
daemon_name=lastmp
. /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 LastMP"
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 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

View File

@ -0,0 +1,6 @@
# Uncomment and fill the password in if needed.
[mpd]
host: localhost
port: 6600
#password: *****