[Slim-Checkins] r33840 - /7.7/trunk/server/Slim/Plugin/MP3tunes/Plugin.pm

[email protected] Wed, 15 Feb 2012 10:34:57 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Wed Feb 15 02:34:57 2012
New Revision: 33840

URL: http://svn.slimdevices.com/slim?rev=33840&view=rev
Log:
Bug: n/a
Description: tweak title parsing for DAR.fm recordings. They're the same as mp3tunes, but use a slightly different title formatting.

Modified:
    7.7/trunk/server/Slim/Plugin/MP3tunes/Plugin.pm

Modified: 7.7/trunk/server/Slim/Plugin/MP3tunes/Plugin.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Plugin/MP3tunes/Plugin.pm?rev=33840&r1=33839&r2=33840&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Plugin/MP3tunes/Plugin.pm (original)
+++ 7.7/trunk/server/Slim/Plugin/MP3tunes/Plugin.pm Wed Feb 15 02:34:57 2012
@@ -6,6 +6,7 @@
 
 use strict;
 use base qw(Slim::Plugin::OPMLBased);
+use Date::Parse;
 
 use Slim::Formats::RemoteMetadata;
 use Slim::Networking::SqueezeNetwork;
@@ -70,6 +71,18 @@
 		my $album    = $2;
 		my $tracknum = $3;
 		my $title    = $4;
+		
+		# DAR.fm has slightly different formatting: $title would be the same as the track no.
+		# let's shuffle things around to get the recording title as the track title
+		if ($artist && $title && $title + 0 == $tracknum) {
+			$title = $artist;
+			$artist = '';
+			
+			if (my $date = Date::Parse::str2time($album)) {
+				$album  = Slim::Utils::DateTime::shortDateF($date);
+			}
+		}
+		
 		my $cover;
 		
 		if ( $url =~ /hasArt=1/ ) {