ports/152376: New port: audio/lastfmsubmitd

Dereckson dereckson at gmail.com
Thu Nov 18 20:30:12 UTC 2010


>Number:         152376
>Category:       ports
>Synopsis:       New port: audio/lastfmsubmitd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 18 20:30:11 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Dereckson
>Release:        8.1-RELEASE
>Organization:
>Environment:
FreeBSD scherzo.dereckson.be 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Sun Sep 19 03:06:33 UTC 2010     dereckson at scherzo.dereckson.be:/usr/obj/usr/src/sys/SCHERZO  i386
>Description:
This is a port for lastfmsubmitd, a daemon to send last.fm scrobbles.

This port adds a new user/group pair and so requires the following lines to be added to /usr/ports/?IDs files:

/usr/ports/GIDs
lastfm:*:212:

/usr/ports/UIDs
lastfm:*:212:212::0:0:liblastfmd daemon:/nonexistent:/nonexistent
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	lastfmsubmitd
#	lastfmsubmitd/Makefile
#	lastfmsubmitd/pkg-descr
#	lastfmsubmitd/distinfo
#	lastfmsubmitd/files
#	lastfmsubmitd/files/patch-doc-lastfmsubmitd.1
#	lastfmsubmitd/files/patch-doc-lastmp.1
#	lastfmsubmitd/files/patch-README
#	lastfmsubmitd/files/patch-contrib-INSTALL.lastmp
#	lastfmsubmitd/files/patch-lib-lastfm-config.py
#	lastfmsubmitd/files/patch-INSTALL
#	lastfmsubmitd/files/pkg-message.in
#	lastfmsubmitd/files/lastfmsubmitd.in
#	lastfmsubmitd/pkg-plist
#	lastfmsubmitd/pkg-deinstall
#	lastfmsubmitd/pkg-install
#
echo c - lastfmsubmitd
mkdir -p lastfmsubmitd > /dev/null 2>&1
echo x - lastfmsubmitd/Makefile
sed 's/^X//' >lastfmsubmitd/Makefile << '23dca69fd44221ca91de0b2ae8b69bf8'
X# New ports collection makefile for:    lastfmsubmitd
X# Date created:                         16 November 2010
X# Whom:                                 Dereckson <dereckson at gmail.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	lastfmsubmitd
XPORTVERSION=	1.0.6
XCATEGORIES=	audio
XMASTER_SITES=	http://www.red-bean.com/decklin/${PORTNAME}/
X
XMAINTAINER=	dereckson at gmail.com
XCOMMENT=	Daemon to submit scrobbles to last.fm
X
XUSERS=		lastfm
XGROUPS=		lastfm
X
XLICENSE=	MIT
X
XOPTIONS=	MPD	"Install lastmp, a MPD client" Off
X
XUSE_PYTHON=	YES
XUSE_PYDISTUTILS=YES
X
XSUB_FILES=	pkg-message
XUSE_RC_SUBR=	lastfmsubmitd
XSUB_LIST=	PYTHON_CMD=${PYTHON_CMD}
X
XMAN1=		lastfmsubmitd.1
XPORTDOCS=	README INSTALL NEWS
X
X.include <bsd.port.pre.mk>
X
X.if defined(WITH_MPD)
XMAN1+=		lastmp.1
XPORTDOCS+=	INSTALL.lastmp
X.endif
X
Xpost-patch:
X	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/README
X	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/INSTALL
X	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/doc/lastfmsubmitd.1
X	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/lib/lastfm/config.py
X.if defined(WITH_MPD)
X	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/doc/lastmp.1
X	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/contrib/INSTALL.lastmp
X.endif
X
Xpost-install:
X	${LN} -s ${PREFIX}/lib/lastfmsubmitd/lastfmsubmit ${PREFIX}/bin/lastfmsubmit
X.for directory in /var/log /var/run /var/spool
X	${MKDIR} -m 775 ${directory}/lastfm
X	${CHOWN} ${USERS}:${GROUPS} ${directory}/lastfm
X.endfor
X	${INSTALL_MAN} ${WRKSRC}/doc/lastfmsubmitd.1 ${MANPREFIX}/man/man1
X.if defined(WITH_MPD)
X	${INSTALL_MAN} ${WRKSRC}/doc/lastmp.1 ${MANPREFIX}/man/man1
X.endif
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/NEWS ${DOCSDIR}
X.if defined(WITH_MPD)
X	${INSTALL_DATA} ${WRKSRC}/contrib/INSTALL.lastmp ${DOCSDIR}
X.endif
X.endif
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
23dca69fd44221ca91de0b2ae8b69bf8
echo x - lastfmsubmitd/pkg-descr
sed 's/^X//' >lastfmsubmitd/pkg-descr << 'd1722a6973f1db13bf30c3fc9e85765f'
Xlastfmsubmitd is a daemon meant to be used by Last.fm player plugins. It
Xhandles all aspects of submitting data to the Last.fm servers, so that
Xplayer plugins only need to watch what songs are played and write a
Xrepresentation of each played song to its spool.
X
XThe format used for serializing songs is a simple YAML dictionary, which
Xcan be constructed with YAML libraries (available for many languages), or
Xprinted ad hoc. The spool is managed with standard unix permissions, and
Xmany different players can use the same daemon to submit. Each instance of
Xlastfmsubmitd uses a single account.
X
XWWW: http://www.red-bean.com/decklin/lastfmsubmitd
d1722a6973f1db13bf30c3fc9e85765f
echo x - lastfmsubmitd/distinfo
sed 's/^X//' >lastfmsubmitd/distinfo << '1c663356df27ba2b0dc4d404645458ac'
XSHA256 (lastfmsubmitd-1.0.6.tar.gz) = c2636d5095a95167366bacd458624d67b046e060244fa54ba2c2e3efb79f9b0e
XSIZE (lastfmsubmitd-1.0.6.tar.gz) = 19181
1c663356df27ba2b0dc4d404645458ac
echo c - lastfmsubmitd/files
mkdir -p lastfmsubmitd/files > /dev/null 2>&1
echo x - lastfmsubmitd/files/patch-doc-lastfmsubmitd.1
sed 's/^X//' >lastfmsubmitd/files/patch-doc-lastfmsubmitd.1 << '9c5e6e071f0eb1e5614edafca3e17188'
X--- doc/lastfmsubmitd.1.orig	2010-11-18 12:33:37.000000000 +0000
X+++ doc/lastfmsubmitd.1	2010-11-18 12:34:59.000000000 +0000
X@@ -80,7 +80,7 @@
X The directory where music players should write song information to be
X submitted by lastfmsubmitd.
X .TP
X-.B /etc/lastfmsubmitd.conf
X+.B %%PREFIX%%/etc/lastfmsubmitd.conf
X The configuration file.
X .SH AUTHOR
X Decklin Foster <decklin at red-bean.com>.
9c5e6e071f0eb1e5614edafca3e17188
echo x - lastfmsubmitd/files/patch-doc-lastmp.1
sed 's/^X//' >lastfmsubmitd/files/patch-doc-lastmp.1 << '412701f5118842bb7837f0eace0140ee'
X--- doc/lastmp.1.orig	2010-04-19 01:41:31.000000000 +0000
X+++ doc/lastmp.1	2010-11-18 14:28:20.000000000 +0000
X@@ -1,24 +1,15 @@
X .TH lastfm 1
X .SH NAME
X-lastmp, lastcd \- clients for lastfmsubmitd
X+lastmp \- client for lastfmsubmitd
X .SH SYNOPSIS
X .B lastmp
X .RI [ --debug ]
X .RI [ --no-daemon ]
X-.br
X-.B lastcd
X-.RI [ --debug ]
X-.RI [ --stdout ]
X .SH DESCRIPTION
X .B lastmp
X-and
X-.B lastcd
X-are clients which send song information to lastfmsubmitd. lastmp connects to
X+is a client which send song information to lastfmsubmitd. lastmp connects to
X MPD and periodically checks for new songs and how long the current song has
X-been played. lastcd reads a serialized list of songs that were played on an
X-offline CD player, such as a car or home stereo, and sends them with estimated
X-timestamps directly to lastfmsubmitd. Such lists can be generated with
X-.IR mbget (1).
X+been played. 
X .SH OPTIONS
X .TP
X .B \-d, \-\-debug
X@@ -31,7 +22,7 @@
X Write the serialized song information to standard output.
X .SH FILES
X .TP
X-.B /etc/lastfmsubmitd.conf
X+.B %%PREFIX%%/etc/lastfmsubmitd.conf
X The configuration file.
X .SH SEE ALSO
X .IR mpd (1).
412701f5118842bb7837f0eace0140ee
echo x - lastfmsubmitd/files/patch-README
sed 's/^X//' >lastfmsubmitd/files/patch-README << 'cb453cf4a7483f24cd5dbb4be4747ea9'
X--- README.orig	2010-11-18 12:46:22.000000000 +0000
X+++ README	2010-11-18 12:47:21.000000000 +0000
X@@ -18,7 +18,7 @@
X To send song information to lastfmsubmitd, you can do one of the
X following:
X 
X-  * Fork and exec /usr/lib/lastfm/lastfmsubmit. lastfmsubmit fills a
X+  * Fork and exec %%PREFIX%%/lib/lastfm/lastfmsubmit. lastfmsubmit fills a
X     role similar to sendmail(1). It will take the song specified on
X     the command line with --artist, --title, --length, and optionally
X     --album and --mbid, and encode it in UTF-8 YAML. Then, it will
cb453cf4a7483f24cd5dbb4be4747ea9
echo x - lastfmsubmitd/files/patch-contrib-INSTALL.lastmp
sed 's/^X//' >lastfmsubmitd/files/patch-contrib-INSTALL.lastmp << 'ca2104032a95c06ea6e40e003170250e'
X--- contrib/INSTALL.lastmp.orig	2010-11-18 13:05:02.000000000 +0000
X+++ contrib/INSTALL.lastmp	2010-11-18 12:47:42.000000000 +0000
X@@ -1,7 +1,7 @@
X Installation
X ============
X 
X-Create a file ``/etc/lastmp.conf`` and put in something like:
X+Create a file ``%%PREFIX%%/etc/lastmp.conf`` and put in something like:
X 
X     [mpd]
X     host: localhost
ca2104032a95c06ea6e40e003170250e
echo x - lastfmsubmitd/files/patch-lib-lastfm-config.py
sed 's/^X//' >lastfmsubmitd/files/patch-lib-lastfm-config.py << '59af52213ae8b094b824ddb165e319f6'
X--- lib/lastfm/config.py.orig	2010-11-18 13:22:43.000000000 +0000
X+++ lib/lastfm/config.py	2010-11-18 13:23:53.000000000 +0000
X@@ -17,7 +17,7 @@
X     def __call__(self, use_sys_path, name):
X         return self.funcs[use_sys_path](name)
X 
X-CONF = DefaultPath(lambda n: '/etc/%s.conf' % n,
X+CONF = DefaultPath(lambda n: '%%PREFIX%%/etc/%s.conf' % n,
X                    lambda n: '~/.%s/conf' % n)
X LOG = DefaultPath(lambda n: '/var/log/lastfm/%s.log' % n,
X                   lambda n: '~/.%s/log' % n)
X@@ -35,8 +35,8 @@
X     """The minimum configuration needed by any program that communicates
X     through the lastfmsubmitd protocol: where to put the serialized
X     submissions and where to log. If the provided path or ~/.NAME/config is
X-    found, the "user" defaults are used. Otherwise, /etc/NAME.conf is read,
X-    and the "system" defaults are used."""
X+    found, the "user" defaults are used. Otherwise, %%PREFIX%%/etc/NAME.conf
X+    is read, and the "system" defaults are used."""
X 
X     def __init__(self, path='', name='lastfmsubmitd'):
X         self.cp = SaneConfParser()
59af52213ae8b094b824ddb165e319f6
echo x - lastfmsubmitd/files/patch-INSTALL
sed 's/^X//' >lastfmsubmitd/files/patch-INSTALL << 'cf4796f12e3d976207820858d99531b5'
X--- INSTALL.orig	2010-11-18 16:44:30.000000000 +0000
X+++ INSTALL	2010-11-18 16:45:51.000000000 +0000
X@@ -1,6 +1,9 @@
X Installation
X ============
X 
X+ [ Port maintainer note: Steps 1 and 2 are for reference, as the port
X+   or package install have already taken care of those. ]
X+
X  1. Run ``./setup.py install`` as usual.
X 
X  2. Create a user/group for the daemon(s) (I use lastfm:lastfm), and
X@@ -14,8 +17,8 @@
X     the daemon(s) and/or music players. ``doc/install-example.sh`` shows
X     how this should be done on most systems.
X 
X- 3. Create a configuration file, ``/etc/lastfmsubmitd.conf``. This is a
X-    regular Python ConfigParser file, and should look like::
X+ 3. Create a configuration file, ``%%PREFIX%%/etc/lastfmsubmitd.conf``.
X+    This is a regular Python ConfigParser file, and should look like:
X 
X         [account]
X         user: decklin
cf4796f12e3d976207820858d99531b5
echo x - lastfmsubmitd/files/pkg-message.in
sed 's/^X//' >lastfmsubmitd/files/pkg-message.in << 'a519a3d6c78e2b912670ddada4d49db5'
X--------------------------------------------------------------------------
Xlastfmsubmitd was sucessfully installed.
X
XFor default use, create a configuration file at the following place:
X    %%PREFIX%%/etc/lastfmsubmitd.conf
XThis is a regular Python ConfigParser file, and should look like:
X
X    [account]
X    user: decklin
X    password: ********
X
XIf you've install documentation, the following file documents the format:
X    %%PREFIX%%/share/doc/lastfmsubmitd/INSTALL
X
XThen, you can start the server with %%PREFIX%%/etc/rc.d/lastfmsubmitd start
XSet lastfmsubmitd_enable to YES in /etc/rc.conf or use 'onesart'
X                                              instead of 'start'.
X--------------------------------------------------------------------------
a519a3d6c78e2b912670ddada4d49db5
echo x - lastfmsubmitd/files/lastfmsubmitd.in
sed 's/^X//' >lastfmsubmitd/files/lastfmsubmitd.in << 'c6fb0ac0556ad6316b0cbb1334cb13b1'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X# PROVIDE: lastfmsubmitd
X# REQUIRE: DAEMON
X#
X# Add the following lines to /etc/rc.conf to run lastfmsubmitd:
X#
X# lastfmsubmitd_enable (bool):	Set it to "YES" to enable lastfmsubmitd.
X#				Default is "NO".
X# lastfmsubmitd_user (user):	Set user to run lastfmsubmitd.
X#				Default is "lastfm".
X#
X
X. /etc/rc.subr
X
Xname="lastfmsubmitd"
Xprocname="%%PYTHON_CMD%%"
Xrcvar=${name}_enable
Xpidfile=/var/run/lastfm/lastfmsubmitd.pid
X
Xload_rc_config ${name}
X
X: ${lastfmsubmitd_enable="NO"}
X: ${lastfmsubmitd_user="lastfm"}
X
Xcommand=/usr/bin/su
Xcommand_args="-m ${lastfmsubmitd_user} -c '%%PREFIX%%/bin/lastfmsubmitd'"
X
Xunset lastfmsubmitd_user
X
Xrun_rc_command "$1"
c6fb0ac0556ad6316b0cbb1334cb13b1
echo x - lastfmsubmitd/pkg-plist
sed 's/^X//' >lastfmsubmitd/pkg-plist << '8cc4422a616d258ffe47f33d61b93271'
X at stopdaemon lastfmsubmitd
Xbin/lastfmsubmit
Xbin/lastfmsubmitd
Xlib/lastfmsubmitd/lastfmsubmit
X%%PYTHON_SITELIBDIR%%/lastfm/__init__.py
X%%PYTHON_SITELIBDIR%%/lastfm/__init__.pyc
X%%PYTHON_SITELIBDIR%%/lastfm/__init__.pyo
X%%PYTHON_SITELIBDIR%%/lastfm/client.py
X%%PYTHON_SITELIBDIR%%/lastfm/client.pyc
X%%PYTHON_SITELIBDIR%%/lastfm/client.pyo
X%%PYTHON_SITELIBDIR%%/lastfm/config.py
X%%PYTHON_SITELIBDIR%%/lastfm/config.pyc
X%%PYTHON_SITELIBDIR%%/lastfm/config.pyo
X%%PYTHON_SITELIBDIR%%/lastfm/marshaller.py
X%%PYTHON_SITELIBDIR%%/lastfm/marshaller.pyc
X%%PYTHON_SITELIBDIR%%/lastfm/marshaller.pyo
X at dirrmtry %%PYTHON_SITELIBDIR%%/lastfm
8cc4422a616d258ffe47f33d61b93271
echo x - lastfmsubmitd/pkg-deinstall
sed 's/^X//' >lastfmsubmitd/pkg-deinstall << 'd53e752e0e03de916946954a129947cf'
X#!/bin/sh
Xif [ "$2" = DEINSTALL ]; then
X	echo "-------------------------------------------------------------------------"
X	echo "If you are permanently removing this port,"
X	echo "you should manually remove the lastfm user and group."
X	echo "-------------------------------------------------------------------------"
Xfi
d53e752e0e03de916946954a129947cf
echo x - lastfmsubmitd/pkg-install
sed 's/^X//' >lastfmsubmitd/pkg-install << 'f1f374d773f2b7f97111ad4aa4151a72'
X#!/bin/sh
X
X#
X# This install script performs the following tasks:
X#     i. create lastfm user and group
X#    ii. make /var/log/lastfm /var/run/lastfm and /var/spool/lastfm directories
X#
X
Xif [ "$2" = INSTALL ]; then
Xpw groupadd -n lastfm -g 212
Xpw useradd  -n lastfm -u 212 -c "liblastfmd daemon" -d /nonexistent -g lastfm -s /nonexistent
Xfor d in /var/log /var/run /var/spool; do
X    mkdir $d/lastfm
X    chown lastfm:lastfm $d/lastfm
X    chmod 775 $d/lastfm
Xdone
Xfi
f1f374d773f2b7f97111ad4aa4151a72
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list