Description: Script for syndicating your currently playing music to the net (store an Atom file on you Google Pages account).
You need to have previously signed for Google Pages service before using this script, and have cookies enable for Google Pages service as well.Last changelog:
Some bugs fixed
New text file,IMPORTANT, explains how to make this script work
Nice script!
I had to make a couple of changes to the script. The first was helping it find my cookies.txt file. Unfortunately there are two cookies.txt files findable from ~/.mozilla on my system, and it just happened to pick the one that isn't updated. I adjusted the start point to ~/.mozilla/firefox, which fixed the cookies problem.
Secondly, although the file amarok.xml was being generated, and it looked OK, RSS readers were not liking it, mostly refusing to render anything.
I made this change, to add the <? xml ...?> declaration to the head of the file:
Quote:
I'd love to try this, but I get an error. Kubuntu Feisty, Amarok 1.4.7, and Perl 5.8.8
The script 'atomSyndication.pl' exited with error code: 2
Details:
Can't locate XML/DOM.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 108.
BEGIN failed--compilation aborted at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 108.
OK, try to install XML::DOM module first
Open a term and type:
$cpan
If you are running CPAN for the first time, just follow the steps needed
Then, install XML::DOM
cpan> install XML::DOM
Thanks for the feedback, I did not realize maybe some perl configuration was needed to be done
Hope it works now, have fun!
Both are now installed, but it still has this error message:
The script 'atomSyndication.pl' exited with error code: 2
Details:
Can't locate Data/UUID.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 110.
BEGIN failed--compilation aborted at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 110.
Hello onlineapps,
The error is similar to the previous one, UUID library is not installed in your system. To install it proceed as before,
Run cpan
$ cpan
Then, install UUID
cpan> install Data::UUID
Thanks for the feedback, I did not realize maybe some libraries were missing. In the next released I will add some warnings telling which libraries are needed and how to install them, or better, will add a config script to install those libraries.
Till then, I put down here a list of the libraries used by the script. If someone gets an error on a missing library (I mean, similar to the previous ones) please check this list:
HTTP::Cookies
LWP::UserAgent
File::Find
XML::DOM
Data::Dumper
Data::UUID
URI::Escape
Ratings & Comments
6 Comments
Nice script! I had to make a couple of changes to the script. The first was helping it find my cookies.txt file. Unfortunately there are two cookies.txt files findable from ~/.mozilla on my system, and it just happened to pick the one that isn't updated. I adjusted the start point to ~/.mozilla/firefox, which fixed the cookies problem. Secondly, although the file amarok.xml was being generated, and it looked OK, RSS readers were not liking it, mostly refusing to render anything. I made this change, to add the <? xml ...?> declaration to the head of the file: Quote:
--- /home/pete/src/atomSyndication/atomSyndication.pl 2007-09-10 23:38:01.000000000 +0100 +++ ./atomSyndication.pl 2007-09-25 22:25:38.000000000 +0100 @@ -25,15 +25,21 @@ use LWP::UserAgent; use File::Find; -$username = ''; +$username = 'xxx'; $ATOM_FILE = 'amarok.xml'; $URL = "http://pages.google.com"; $URL_ATOM_FILE = "http://$username.googlepages.com/$ATOM_FILE"; +$XMLDECL = new XML::DOM::XMLDecl; +$XMLDECL->setVersion("1.0"); +$XMLDECL->setEncoding("UTF-8"); +$XMLDECL->setStandalone("yes"); + + $uploadURL = $URL."/upload-file-simple/$username"; -find(\&handleFind, "$ENV{'HOME'}/.mozilla/"); +find(\&handleFind, "$ENV{'HOME'}/.mozilla/firefox/"); sub handleFind { my $foundFile = $File::Find::name; @@ -194,11 +200,15 @@ sub GetXML { local($url) = @_; - local($parser, $xmldoc); + local($parser, $xmldoc, $xmldecl); eval { $parser = XML::DOM::Parser->new(); $xmldoc = $parser->parsefile($url); + $xmldecl = $xmldoc->getXMLDecl(); + if ( $xmldecl == undef ) { + $xmldoc->setXMLDecl($XMLDECL); + } }; if ($@) { @@ -247,10 +257,11 @@ { local($node); my $xmldoc = new XML::DOM::Document; - + my $xmldecl= new XML::DOM::XMLDecl; $feed{'updated'} = &GetTime; $feed{'id'} = 'urn:uuid:'.Data::UUID->new->create_str; $node = &ArrayToXML($xmldoc, 'feed', %feed); + $xmldoc->setXMLDecl($XMLDECL); $xmldoc->appendChild($node); return $xmldoc;
I'd love to try this, but I get an error. Kubuntu Feisty, Amarok 1.4.7, and Perl 5.8.8 The script 'atomSyndication.pl' exited with error code: 2 Details: Can't locate XML/DOM.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 108. BEGIN failed--compilation aborted at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 108.
OK, try to install XML::DOM module first Open a term and type: $cpan If you are running CPAN for the first time, just follow the steps needed Then, install XML::DOM cpan> install XML::DOM Thanks for the feedback, I did not realize maybe some perl configuration was needed to be done Hope it works now, have fun!
Both are now installed, but it still has this error message: The script 'atomSyndication.pl' exited with error code: 2 Details: Can't locate Data/UUID.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 110. BEGIN failed--compilation aborted at /home/andrew/.kde/share/apps/amarok/scripts/atomSyndication/atomSyndication.pl line 110.
Hello onlineapps, The error is similar to the previous one, UUID library is not installed in your system. To install it proceed as before, Run cpan $ cpan Then, install UUID cpan> install Data::UUID Thanks for the feedback, I did not realize maybe some libraries were missing. In the next released I will add some warnings telling which libraries are needed and how to install them, or better, will add a config script to install those libraries. Till then, I put down here a list of the libraries used by the script. If someone gets an error on a missing library (I mean, similar to the previous ones) please check this list: HTTP::Cookies LWP::UserAgent File::Find XML::DOM Data::Dumper Data::UUID URI::Escape
Thanks, that and LWP::UserAgent fixed it for me!