TwonkyMedia last.fm Scrobbler

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC
TwonkyMedia last.fm Scrobbler

Post by nerdsville » Fri Nov 07, 2008 3:40 pm

Hi,

I am a long time lurker and user of TwonkyMedia, primarily with Netgear MP101 wireless client, just thought you might be interested in this. :wink:

I have developed an experimental http://www.last.fm scrobbler to submit listened to tracks from TwonkyMedia (V4.1 onwards) utilising the in-built RSS feature. The TwonkyScobbler monitors the ‘last played’ feed and when the last entry changes submits the appropriate information.

It runs on windows and requires .NET 2.0 framework – I have only tested it on my Windows XP machine and only with mp3 files at present.

More information and a link to the zip file at
http://www.insanityworks.co.uk/twonkysc ... /index.htm

Please note this is experimental, please read the documentation on how to set it up, it is important that the feed is set up correctly and this has to be done manually at the moment!

But you are welcome to download it and give it a try.

Andrew

davideith
Posts:2
Joined:Sun Nov 09, 2008 9:23 pm
AV Hardware:2 Omnifi
SMC EZ Stream

Re: TwonkyMedia last.fm Scrobbler

Post by davideith » Sun Nov 09, 2008 9:40 pm

I think using the Last Played RSS feed is a brilliant idea. Many folks have been looking for this for quite a while.

Unfortunately, I have a problem. TwonkyScrobbler crashes as soon as I enter the RSS URL and cannot restart unless I replace the .config file. The log-file.txt shows nothing but previous starts and the windows event viewer shows no errors.

I'm using Twonky 4.2.2, mp3 files on 1 local disk and 3 network shares (just under 20K). I have a problem with subsequent releases not scanning shares. I do not serve videos or pictures. Running on Windows XP Pro Version 2002 Service Pack 2.

When I view the RSS feed via Firefox I noticed the dates are all over the place. The last played may be correct, but all previous are a mess.

I'm not necessarily asking for help, as I know that your created this for yourself, but if you could point me in the right direction, I would greatly appreciate it.

Thanks,

David

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Sun Nov 09, 2008 10:43 pm

I developed and tested the scrobbler using the latest versions of Twonky 4.4.x so it is possible that the RSS feed may be different on your older version, but I would just expect the program not to detect the entries rather than crashing. I do have some older versions of the server (somewhere) so will try and test it on those.

In the meantime if you want to email me the config file that crashes the program I can have a look at what might be causing it, also if possible if you could send me a copy of the xml source of the RSS feed, that might help.

twonky@insanityworks.co.uk

Thanks for giving it a go

Andrew

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Sun Nov 09, 2008 11:38 pm

Update,

Have just fired up an older version of TwonkyMedia (4.2) and discovered that the XML in the RSS feed is indeed in a different format to the later version, this is what is causing the crash. I will endeavour to sort the problem out and release an update soon.

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Mon Nov 10, 2008 4:57 pm

I have updated the TwonkyScrobbler

The problem was the RSS feeds on my server (v4.4.9) have a <playeddatetime> element for each track in the xml file, however on the earlier versions of the server this element is missing from the RSS feeds and rather than failing gracefully the program would crash.

The new version of the scrobbler will still attempt to find the <playeddatetime> element but if not found will fall back and use the other information <title>,<description> and <author> (i.e. title, album and artist) to detect a new track to scrobble.

The new version V1.0.1 requires an updated configuration file (all contained in the zip file)

More information/file at http://www.insanityworks.co.uk/twonkysc ... /index.htm

davideith
Posts:2
Joined:Sun Nov 09, 2008 9:23 pm
AV Hardware:2 Omnifi
SMC EZ Stream

Re: TwonkyMedia last.fm Scrobbler

Post by davideith » Mon Nov 10, 2008 9:37 pm

Thank you, thank you. Works like a champ.

michelr
Posts:21
Joined:Mon Aug 20, 2007 4:37 pm

Re: TwonkyMedia last.fm Scrobbler

Post by michelr » Wed Dec 03, 2008 7:56 pm

Nice work. This worked for me for a while this morning. Then it stopped (for some reason I didn't write down the error message - something about the server doing something illegal or whatever.) This was right after I stopped a song after a few seconds, then started playing another.

After trying a few things, I tried rebuilding the database. Now the Last Played feed only shows what seems to be the first 100 songs in the database (I guess that's some sort of default behavior.) It doesn't seem to be updating the last played feed at all! Obviously nothing to do with the scrobbler, but I was wondering if anyone had any idea what's up with that RSS feed and if there's a way to fix it?

I'm running v4.4.9 by the way.

Thanks,
Michel

User avatar
mgillespie
Posts:1222
Joined:Fri Jul 08, 2005 1:19 pm
AV Hardware:TwonkyMedia AV UPnP Mediaserver (Marvell Kirkwood ARM Sheevaplug with Debian Squeeze).
2x Noxon V2 audio client
1x PS3 Slim 500GB Audio/Video UPnP client.
1x Sony VGF-CP1 Wireless Photoframe.
Location:UK

Re: TwonkyMedia last.fm Scrobbler

Post by mgillespie » Wed Dec 03, 2008 8:01 pm

Never had much luck with the RSS feeds, if I restarted the PC (and hence the server), it would say I have played some tracks that I have not played.

Nice idea, but currently the RSS feed in TwonkyMedia is too broken to make scrobbling reliable :-( I wish it was not the case, as I am desperate for Last.FM scrobbling.

I was thinking of perhaps some fake transcoder that scrobbled and sent the same stream back. That might be a better method.
Please note: Moderators here are voluntary and do not work for PacketVideo or Twonky, please do not attack us. Any posts are personal opinion, and may not be those of PV/Twonky.

michelr
Posts:21
Joined:Mon Aug 20, 2007 4:37 pm

Re: TwonkyMedia last.fm Scrobbler

Post by michelr » Wed Dec 03, 2008 9:25 pm

OK, so it's probably not something I did then... :( Gotta wonder why something so simple doesn't work.

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Thu Dec 04, 2008 10:23 am

Thanks for giving it a try, just a few observations

Sometimes the TwonkyScrobblers attempts to connect to the RSS feed and cannot, reporting an error. However it isn't a fatal error and the scrobbler will continue working and make another attempt 30 seconds later. I have seen this behaviour when skipping tracks and suspect it happens when the mediaserver updates the feed midway through an access.

True the RSS feed is unreliable with most of the entries being garbage, but my observations on a number of different versions and on a number of installations (Win2000/XP) suggest the last entry is correct. These were all PC versions of the server and I have no idea if the behaviour is correct on other NAS/Linux versions.

Please check the URL of the feed, the last played feeds I've seen seem to be limited to only 20 items, not 100.

One thing I did do during development that seemed to clean up the RSS feed considerably was to manually delete the database and let the server build it again from scratch (not sure the rebuild option does a full clean before hand) These database files are in folder C:/Documents and Settings/Username/Application Data/Twonkymedia/ - I stopped the server then deleted everything apart from the twonkyvision-mediaserver.ini file and then restarted the server and let it build the database before trying to play anything. (I give no guarantees about this and you do it at your own risk)

I have been using the TwonkyScrobbler for over a month now, with a number of different clients accessing the server (MP101, XBMC etc) and it has proved reliable. I have had a number of reports of other users who have reported success, so do hope you can get it to work.

michelr
Posts:21
Joined:Mon Aug 20, 2007 4:37 pm

Re: TwonkyMedia last.fm Scrobbler

Post by michelr » Thu Dec 04, 2008 2:29 pm

Thanks for the tips! I did the directory cleanup, deleting everything but the ini file, but no joy. The Last Played feed still shows 100 entries which, from the looks of it, are the first 100 songs in the database (going alphabetically, by artist anyway... Just a guess.) It just doesn't seem to get updated. The Most Played feed however seems to be updating correctly. This is weird.

Do you know if the ini file has some entries that are related to the feeds? Maybe I've got something fishy in mine. I had to make it read-only (as per advice from tech support) because it kept wiping out the licence key. I also noticed that version 4.4.4 (I think) and later kept wiping out the custom music tree, another reason to keep the ini file read-only. Very annoying. One thing I haven't tried it to uninstall the server, delete everything, and let it create a new ini file on reinstall, then configure it and make it read-only (to prevent the problems mentioned above.)

Thanks for your help!

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Thu Dec 04, 2008 5:14 pm

Just had a look in my ini file and noticed the two interesting entries below, maybe it would worth checking them and if necessary try modifying the playlistnumentries to 20 if it isn't? (I wouldn't be surprised given the flaky nature of the RSS feeds that 100 might be too many and the server gives up and doesn't update the feed correctly?)

Let me know if you do try it and it works.

Code: Select all

# Number of entries for auto generated playlists
playlistnumentries=20

# Last played
playlistlastplayed=- Last played -

michelr
Posts:21
Joined:Mon Aug 20, 2007 4:37 pm

Re: TwonkyMedia last.fm Scrobbler

Post by michelr » Fri Dec 05, 2008 4:48 pm

100 is definitely useless. I've just changed it to 20 - thanks for the info.

Funnily, things have started to work. I did a full uninstall/reinstall, then edited the ini file. Then the Last Played feed wasn't getting updated, but the Most Played one was, so I entered that in the scrobbler for the time being. Eventually that one stopped working, so I changed it to the Last Played feed, which had suddenly kicked in(!) That worked well for a while. I then put the PC to sleep while I went out, and upon return the Last Played feed stopped being updated. Annoyed. However I noticed that, when I restarted the playing, I played the same album that was playing before it went to sleep. As soon as I started playing another album, the feed got updated. And it's been working ever since. I think the TwonkyMedia feed is possessed by evil forces, but I seem to have tamed them for now. :)

So things are working fine for now! Thanks again for this little piece of work, it's nice to get my last.fm charts updated when using the media server!

hajuro
Posts:12
Joined:Sun Jul 01, 2007 6:42 pm

Re: TwonkyMedia last.fm Scrobbler

Post by hajuro » Mon Dec 08, 2008 10:17 am

Great work!

I've noticed a little problem with Umlauts. Is there a way to fix it?
2008-12-08 10:11:53,406 INFO - Enqueued Artist: Abw??rts; Title: Alkohol; Album: Abw??rts

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Mon Dec 08, 2008 11:39 am

hajuro wrote:Great work!

I've noticed a little problem with Umlauts. Is there a way to fix it?
I am currently testing an updated 'beta' version which will hopefully fix this problem, you are welcome to give it a try.
http://www.insanityworks.co.uk/twonkysc ... erBeta.zip

hajuro
Posts:12
Joined:Sun Jul 01, 2007 6:42 pm

Re: TwonkyMedia last.fm Scrobbler

Post by hajuro » Mon Dec 08, 2008 12:07 pm

The beta works perfect. No strange letters or question marks in song title or artist. Thanks

hajuro
Posts:12
Joined:Sun Jul 01, 2007 6:42 pm

Re: TwonkyMedia last.fm Scrobbler

Post by hajuro » Tue Dec 09, 2008 10:58 pm

Still a little problem. The "&" is shown as "& amp". Song will not be transmitted to Last.fm.

nerdsville
Posts:8
Joined:Thu Nov 06, 2008 8:57 am
AV Hardware:TwonkyMedia, Netgear MP101, XBMC

Re: TwonkyMedia last.fm Scrobbler

Post by nerdsville » Wed Dec 17, 2008 4:28 pm

hajuro wrote:Still a little problem. The "&" is shown as "& amp". Song will not be transmitted to Last.fm.
I have updated the Scrobbler to version 1.0.3, this version has the fix to handle Unicode characters such as umlauts and also should fix the "&amp" problem (due to literal character string being embedded in RSS feed)

More information and a link to the zip file at
http://www.insanityworks.co.uk/twonkysc ... /index.htm

hajuro
Posts:12
Joined:Sun Jul 01, 2007 6:42 pm

Re: TwonkyMedia last.fm Scrobbler

Post by hajuro » Thu Dec 18, 2008 10:12 am

nerdsville wrote: I have updated the Scrobbler to version 1.0.3, this version has the fix to handle Unicode characters such as umlauts and also should fix the "&amp" problem (due to literal character string being embedded in RSS feed)
Thanks, it works :-)

Locked