Currently scratching a very old itch (more later) but I do not want to
be caught out again with the very old Perl on Mac systems running LMS.
So - can a Mac user with LMS installed try this:
Create a file called testmatch.pl - containing
Code:
--------------------
my $thisTrackRegex = 'StreamTitle=\'(?<progtitle>.*?): (?<artist>.*?)(?: -
(?<title>.*?))?\'(?:;|$)(?:StreamUrl=\'(?<cover>.*)\'(?:;|$))?';
my $givenString;
sub matchThis {
print "\n\nTrying $givenString\n";
$givenString =~ m/$thisTrackRegex/s;
# For this to work ... the passed in regex has to have named captures
# Something like this
# artist.*title.*album.*year.*--.* --.* .*--.(?<artist>.*?) (?<title>.*?)
(?<album>.*?) (?<year>[0-9]+)
for my $fieldName ( 'artist','title','album','year','cover','progtitle' ){
print "\n$fieldName - ";
if ( defined $+{$fieldName} && $+{$fieldName} ne '' ){
print($+{$fieldName});
}
}
}
$givenString = "StreamTitle='Program One: No track
title';StreamUrl='https://somewhere.com/image1.jpg';";
matchThis;
$givenString = "StreamTitle='Program Two: Hello -
World';StreamUrl='https://somewhere.com/image2.jpg';";
matchThis;
--------------------
Then run it with the Perl that LMS is using ... something like
perl testmatch.pl
and the output should be like this if it worked
Code:
--------------------
Trying StreamTitle='Program One: No track
title';StreamUrl='https://somewhere.com/image1.jpg';
artist - No track title
title -
album -
year -
cover - https://somewhere.com/image1.jpg
progtitle - Program One
Trying StreamTitle='Program Two: Hello -
World';StreamUrl='https://somewhere.com/image2.jpg';
artist - Hello
title - World
album -
year -
cover - https://somewhere.com/image2.jpg
progtitle - Program Two
--------------------
The regex matching has named captures and nested optional matches -
perhaps one of those fails on very old Mac Perl.
Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc),
planetradio (bauer - kiss, absolute, scala, jazzfm etc), kcrw, abc
australia and cbc/radio-canada
and, via the extra \"radio now playing\" plugin, allzic radio, caroline
flashback, cesky rozhlas, frequence3, jukeradio, klassikradio.de, linn
radio, mother earth, naim radio, nova.fr, radioblues flac, radio espace,
radio swiss, rte ireland, somehow jazz, supla finland
------------------------------------------------------------------------
Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=115201
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins