lastFM2Itunes is a perl script that updates iTunes tracks play count and play date with last.FM tracks information.
Copyright (c) 2014 Lionel Grenier (lastfm2itunes@igrenier.com / lastfm.igrenier.com)

What the script does

    * parses your lastFM data
    * looks for matching tracks in your iTunes library based on Artist/Song
    * if found updates the iTunes play count if it is less than the lastFM one and update the last play date too. 
    * if enable, data can be saved into a csv file (csv option)

Requirements

    * Windows
    * perl installed with XML-DOM package
    * iTunes installed localy
    * lastFM account 

Manual

    * open a command line shell to run a perl script
    * run "perl lastFM2Itunes.pl lastFMusername [t DD MM YYYYY [v] [csv filename]"
          o user: your lastFM account name. (mandatory)
          o t DD MM YYYY : (optional) enable to choose the starting date of the import 
	  o v: (optional) enable verbose mode 
	  o csv: (optonal) verbose on + write data to csv file. In this case iTunes is not updated
		- provide a valid filename to save
    * sample: perl lastFM2Itunes.pl lebios csv lebios.csv > lebios.log
	this will poll all my profil info and copy them into lebios.csv file. Also the command line output will be written on lebios.log file and not on the screen

Script History
    * 0.65 (MAY-2014) : more verbose info + bug fix
    * 0.61 (APR-2012) : 
    * 0.6 (07-FEB-2009) : use lastFM 2.0 XML version now
    * 0.5 (27-AVR-2008) : add option to specify a starting date, output format is tab separated value now
    * 0.4 (10-FEB-2008) : remove debug code that prevent from dl all weeks
    * 0.3 (07-JAN-2008) : support UTF encoding
    * 0.2 (06-JAN-2008) : can output data to csv file 
    * 0.1 (05-JAN-2008) : first release 

Origin of the script
Recently I lost my iTunes library and so had to rebuild it from scratch. That's not a big deal, but several of my smart playlists based on play count were useless since all the tracks count has been reset to 0. On the other hand I always synchronised my iTunes with my lastFM account. So my tracks play counts were available there.

Contact
For any question (how to use the script), any problem, any wanted evolution do not hesitate to contact me at lastfm2itunes@gmail.com.
Lionel Grenier
