Commit 98f72b62 authored by abveritas's avatar abveritas

Adding lastfmsubmitd, Last.fm plugin client in Python

parent 51547efc
#
# 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:
#!/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
# 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
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. <!!"
}
#!/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
# Uncomment and fill the password in if needed.
[mpd]
host: localhost
port: 6600
#password: *****
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment