<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>#! &#187; Audacious</title>
	<atom:link href="http://hash-bang.net/tag/audacious/feed/" rel="self" type="application/rss+xml" />
	<link>http://hash-bang.net</link>
	<description>The start of all wonderful things</description>
	<lastBuildDate>Mon, 30 Apr 2012 00:28:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Last.FM submissions with Audacious</title>
		<link>http://hash-bang.net/2010/06/lastfm-with-audacious/</link>
		<comments>http://hash-bang.net/2010/06/lastfm-with-audacious/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 00:35:10 +0000</pubDate>
		<dc:creator>mc</dc:creator>
				<category><![CDATA[Fixes]]></category>
		<category><![CDATA[Audacious]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://hash-bang.net/?p=162</guid>
		<description><![CDATA[Some time ago the good folks behind my favorite media player Audacious decided to abandon in-built support for Last.FM submissions. The reasoning behind this seems to be that the Last.FM API was becoming a little too much to maintain which I suppose is fair enough in its quest to remain just a music player i.e. [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago the good folks behind my favorite media player <a href="http://audacious-media-player.org/">Audacious</a> decided to abandon in-built support for Last.FM submissions.</p>
<p>The reasoning behind this seems to be that the Last.FM API was <a href="https://bugs.launchpad.net/ubuntu/+source/audacious-plugins/+bug/568651">becoming a little too much to maintain</a> which I suppose is fair enough in its quest to remain <em>just a music player</em> i.e. not a screen-hogging iTunes clone like so many others.</p>
<p>Heres how to put Last.FM support back into Audacity.</p>
<p>I&#8217;m going to assume you are a sensible person and using a Debian based system rather than Fedora. If you are one of these hat loving deviants, substitute &#8216;yum&#8217; for apt-get below and feel free to voyage though the countless pains required to get Yum to actually do its job.</p>
<h2>Installing LastFMSubmitD</h2>
<p>I&#8217;m not sure on the capitalization of the daemon process LastFMSubmitD so that might be the wrong name entirely.</p>
<p>Anyway, first install pretty much the only component we need:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p162code4'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1624"><td class="code" id="p162code4"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> lastfmsubmitd</pre></td></tr></table></div>

<h2>OPTIONAL &#8211; Set up the HTTP_PROXY</h2>
<p>For some reason the daemon does not get proxy details right. This is easily fixed by opening <em>/etc/init.d/lastfmsubmitd</em> in your favorite editor and inserting the following line somewhere near the top (I put it after the &#8216;GROUP=&#8217; line which should be the last bit of the daemon config area).<br />
If you have no idea what a proxy is or why you should be doing this you can probably skip this section.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p162code5'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1625"><td class="code" id="p162code5"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">http_proxy</span>=<span style="color: #ff0000;">&quot;http://whatever.stupid.proxy.edu.au:8080/&quot;</span></pre></td></tr></table></div>

<h2>Parse Audacious output</h2>
<p>Dump the following script somewhere you can find it. For this example I will use <em>/home/user/bin/scrobble</em></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://hash-bang.net/wp-content/plugins/wp-codebox/wp-codebox.php?p=162&amp;download=scrobble">scrobble</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1626"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code" id="p162code6"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-x</span> <span style="color: #ff0000;">'/usr/lib/lastfmsubmitd/lastfmsubmit'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;LastFMSubmitD does not appear to exist on this machine&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You can install it using Apt or Yum&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$#&quot;</span> == <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Usage: scrobble &quot;&lt;artist&gt; - &lt;song&gt;&quot; &quot;&lt;length&gt;&quot;'</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">ARTIST</span>=<span style="color: #800000;">${1%% - *}</span>
<span style="color: #007800;">SONG</span>=<span style="color: #800000;">${1##* - }</span>
<span style="color: #007800;">LENGTH</span>=$<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$2</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000;">1000</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ARTIST = [<span style="color: #007800;">$ARTIST</span>]&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SONG = [<span style="color: #007800;">$SONG</span>]&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;LENGTH = [<span style="color: #007800;">$LENGTH</span>]&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>lastfmsubmitd<span style="color: #000000; font-weight: bold;">/</span>lastfmsubmit <span style="color: #660033;">--artist</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ARTIST</span>&quot;</span> <span style="color: #660033;">--title</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SONG</span>&quot;</span> <span style="color: #660033;">--length</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$LENGTH</span>&quot;</span></pre></td></tr></table></div>

<h2>Pointing Song Change at your script</h2>
<p>First make sure you have the Song Change plugin enabled in Audacious first.</p>
<p>Now point the command Audacious is to run when starting a new song at the script in the following way:</p>
<pre>
/home/user/bin/scrobble "%s" "%l"
</pre>
<p>All done. Now any tracks played via Audacious will be passed to the script which will parse the incoming song title into a format that the LastFMSubmitD daemon can use.</p>
]]></content:encoded>
			<wfw:commentRss>http://hash-bang.net/2010/06/lastfm-with-audacious/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

