TwonkyScrobbler - V1.0.3

By Andrew Garratt

 

DOWNLOAD APPLICATION  HERE! (ZIP FILE)

 

DOWNLOAD SOURCE HERE!

 

 

email twonky@insanityworks.co.uk

http://www.insanityworks.co.uk

http://last.fm/users/nerdsville

 

This application is based on the Kexp Radio Scrobbler by Markus Palme (http://www.codeplex.com/kexpscrobbler/) and is designed to scrobble the last played song from the TwonkyMedia 4.1 or later media by TwonkyVision to the http://last.fm social networking website.

 

Developed and tested on Windows XP Sp2 and Windows 2000 Sp4

 

Requires the .NET Framework 2.0

 

1. TwonkyMedia Server Setup

 

Requires TwonkyMedia server version 4.2 or later which exports RSS audio feeds to allow non-uPnP devices such as the Sony PSP® to stream audio files directly from the media server.  (See section 5 for more details on RSS feeds)

 

There is no specific setup required

 

2. TwonkyScrobbler Setup

 

It is likely that the TwonkyScrobbler will be run on the same PC that is running the server, however it is perfectly possible to connect to a remote server running on another machine.

 

2.1 Installation

There is no installer simply extract the zip file into a directory of your choice. Three files are supplied

 

TwonkyScrobbler.exe, log4net.dll and TwonkyScrobbler.exe.config. (please note a new config file is required if updating from V1.0.0, see section 5)

 

Opening the TwonkyScrobbler.exe will present you with the following display

 

 

The top panel shows the details of the last audio file processed, currently unpopulated and details of the current status, last.fm username and RSS URL. The status may well show “Invalid URI: The URI is empty” as the TwonkyScrobbler needs configuring.

2.2 Configuration

Use the Options button to open the configuration control.

 

 

Last.fm username

enter your last.fm username in here

 

Last.fm password

enter your last.fm password in here

 

Server URL

Set the URL of the web service on the computer running the TwonkyMedia server (including the port number, by default 9000)

 

This would be http://localhost:9000 assuming the TwonkyScrobbler is running on the same PC as the server.

 

You can check this URL by entering it into a web browser, you should see something like this

 

 

Last Played RSS Feed URL

This is the URL of the appropriate RSS feed, see section 2.3.

 

Show Balloon tips when new song starts

Set this as required.

 

Click OK to return to main screen.

 

2.3 Configuring RSS Feed.

 

Assuming you have configured the Server URL correctly if you now click the Server RSS button on the main screen a web browser will open up showing the RSS feeds available from the TwonkyMedia server.

 

 

Now open the Playlists link, then on the next page open the - Last played – link. The URL/address of this page is what you require. Copy this address and then go back to the options panel and put it in the Last Played RSS Feed URL box.

 

This URL has the form http://localhost:9000/rss/feed/1$11$201405894.xml

The numbers seem randomly assigned, so will be unique to your server setup.

 

Assuming you have done everything correctly the TwonkyScrobble will then monitor this feed every 30 seconds and if the last entry changes it will extract the appropriate details, update the display and queue it to send to the last.fm/audioscrobbler server.

 

 

On later versions of the RSS feed the played time of this file is used to determine if it is a new song to be submitted. On older versions the artist/album and title are used to determine if a new song and the ‘played time’ is assumed to be the time this is detected. (see section 5 for more information on the RSS feed)

 


3. Notes

 

This program is very likely to have bugs/issues and is supplied as is.

 

This application was developed for my own personal use and I am making it available as a courtesy. You use completely at your own risk – no liability will be accepted for any damage or loss caused by this application.

 

This is a work in development and no direct support is available, however if you wish to submit bugs, observations or other comments then feel free to email me.

twonky@insanityworks.co.uk

 

4. Bugs/Known Issues

 

The RSS feeds from the TwonkyMedia server appear to be buggy, from observation it appears the last entry in the  -last played- feed appears to be correct, however there is no guarantee that it will be on your setup.

 

If there are problems with your feeds then I recommend you rebuild the server database.

 

I have assumed that the TwonkyMedia server RSS feed contains just audio files I have no idea what will happens if other files are present in the feed.

 

The time on the server PC must be correct as this is used to determine the status of submissions.

 

Certain special characters in artists/titles etc may be displayed incorrectly, this is a known problem with the RSS feeds.

 

The data sent is not derived from the actual files but from the data in the RSS feed, incorrectly tagged files will produce spurious results.

 

Songs are queued and may be sent to last.fm in batches, with a retry method if submission fails. However if the program is exited before the queue is submitted then any queued tracks won’t be scrobbled. 

 

5. RSS Feeds

 

The initial version of the TwonkyScrobbler was developed and tested using the latest TwonkyMedia version 4.4.9, The RSS feed facility was introduced in version 4.1 and I had made the incorrect assumption that the RSS feeds were unchanged.

 

In Version 4.4.9 I observed the items in the RSS feed have the following format

 

<item>

<title>Gemini</title>

<link>http://192.168.0.20:9000/disk/O1$11$207905894$2623831632.mp3</link>

<description>Eye In The Sky</description>

<author>Alan Parsons Project, The</author>

<enclosure url=http://192.168.0.20:9000/disk/O1$11$207905894$2623831632.mp3 type="audio/mpeg" />

<pubDate>Mon, 01 Jan 1981 01:00:00 GMT</pubDate>

<moddatetime>Thu, 20 Apr 2006 20:38:10 GMT</moddatetime>

<playeddatetime>Sat, 08 Nov 2008 07:44:01 GMT</playeddatetime>

<class>object.item</class>

<genre>Rock</genre>

<playcount>1</playcount>

<tracknumber>32148</tracknumber>

<duration>131000</duration>

<bitrate>192</bitrate>

<frequency>44100</frequency>

<audiochannels>2</audiochannels>

</item>

 

The scrobbler was using the <playeddatetime> element to determine if the song was a new one, storing the value in the program configuration file.

 

Following a bug report from a user I installed a much older version (4.2.1) and discovered that items in the RSS feed have the following format

 

<item>

<title>Old Ghosts</title>

<link>http://192.168.0.21:9000/disk/O1$11$134217730$2550136852.mp3</link>

<description>Stormwatch</description>

<author>Jethro Tull</author>

<enclosure url="http://192.168.0.21:9000/disk/O1$11$134217730$2550136852.mp3" type="audio/mpeg" />

<pubDate>Mon, 28 Apr 2008 12:59:26 GMT</pubDate>

</item>

 

This obviously created a problem because the <playeddatetime> element is missing, the <pubDate> element isn’t related to the time the song was played.

 

To attempt to remedy this problem I have modified the scrobbler so it attempts to find the <playeddatetime> element, however if it is missing the other information <title>,<description> and <author> (i.e. title, album and artist) are compared to the last scrobbled track and any difference is assumed to signal a new track and the new track is scrobbled using the current time as the played time.

 

Updating from V1.0 will require a new configuration/state file with the extra data. 

 

6. Change log

 

V1.0.0 Initial version.

 

V1.0.1 Changes to RSS decode to support older versions of TwonkyMedia Server (see section 5)

 

V1.0.2 (Released as Beta) changes to support Unicode so special characters supported

 

V1.0.3 Fix to support & character (RSS feed inserts literal string &amp)