ScriptRequest, edit last played date

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

ScriptRequest, edit last played date

Post by Spazz » Sat Feb 16, 2008 1:05 pm

Would it be possible for a quick script that would set the last played date/time for a selection of songs to a date/time of your choosing? I managed to get, through the itunes script, to import my last.fm playcount from last.fm-itunes, then to mediamonkey. Problem is I don't have a last played date and it really screws with autorate accurate if you don't have last played dates, at the moment I just deleted the last played part from the formula but that's only a temporary solution.
Image

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Sun Feb 17, 2008 1:58 pm

Certainly possible, yes. Anyone up for it?
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Wed Feb 20, 2008 2:42 am

Actually, should mediamonkey be taking the last played date/time from itunes when it transfers the playcount? Cause mine didn't and this would eliminate any need for this script. On that note, a script that would parse the itunes library file and add those dates to mediamonkey would be even better.
Image

treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Post by treponem » Wed Feb 20, 2008 3:51 am

Hi Spazz

Take a look here: http://www.mediamonkey.com/forum/viewtopic.php?t=24445

It's the 'iDate Added 1.5' script by trix. I had the same problem as you, but got it managed to let MM import the date from Itunes xml. MM can't import the last played dates from Itunes by itself, so I changed a few lines in the script to do so. Haven't kept the files :(

In this script you have to change:
'Date Added' to 'Last Time Played UTC' (check the Itunes XML for the correct spelling <- for getting the right Itunes xml values
and
'DateAdded' to 'LastTimePlayed' <- to tell MM where to write the info

Please make a backup of your MM database, I'm no scripter and can't remember 100% the changes I made to trix' script.

Best regards Treponem

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Wed Feb 20, 2008 1:39 pm

Any chance of you fixing that script up for me? Well, anyone but me since I've got a bitch of a CSCI assignment to do. How would you split a base 16 number like 14 into two digits? It makes my head hurt. I need a tens and a ones but you can't tell if it should be split like 0 | 14 or 1|4 or even 14|0
Image

treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Post by treponem » Wed Feb 20, 2008 4:22 pm

Sorry, I can't help you with this. I'm no scripter and don't know myself how to script this - and all in all I just did a quick search&replace of trix' script.

I imported the last played date from Itunes, I haven't set the date by myself.

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Wed Feb 20, 2008 5:26 pm

I'm guessing you use mm2? I tried the search and replace on the MM3 version and couldn't find anything.
Image

onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous » Wed Feb 20, 2008 5:57 pm

Try one of the scripts in this post perhaps:
http://www.mediamonkey.com/forum/viewtopic.php?t=5160

ModifyField requests a field and then a new value for the field. The difference is that it overwrites the entire field and it can take other fields as arguments (in <>). For example, enter the field "TITLE" and then replace it with "<TRACK#>. <TITLE>" and you'll end up with a title such as "11. Free Falling".

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Thu Feb 21, 2008 3:14 am

Ok, if anyone is up for an interesting project, likly not a very hard one but that's just a guess. This script http://bios.alterlinks.fr/index.php?opt ... &Itemid=58
that updates the itunes library with last.fm playcounts/last played can also write said info into a .csv file instead of updating the library, which could be parsed to update mediamonkey directly, eliminating the library clearing/rescanning and loosing your data on when songs were added. Kinda a moot point for me now ( other than the last played date ) but I thought it would be useful for others.
Image

treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Post by treponem » Thu Feb 21, 2008 7:32 am

Hi Spazz

No, I don't use MM2 any more.

A few days ago, I took the perl script you mentioned and imported the playcount & last played date to Itunes library (which I installed solely for this purpose).

Then I chose the tracks from which I wanted to update the date to MM3 and exported this list in Itunes to XML (trix' script can't deal with csv).
Trix' script can read this xml file and import the 'date added' information to MM3.
I made a quick rewrite (search & replace, see the topic above) of this script to tell MM3 to import the 'last played' date and not the 'date added'.

MM3 only updated the tracks I chose & exported in Itunes. And only the last played date was changed in MM3 after running trix' modified script.

I have no idea how to import csv in MM3, so I thought modifying a working script to get the played date should be easier.

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Thu Feb 21, 2008 1:52 pm

my issue is when I try and do the search and replace on those items you said to change it doesn't find anything; :(
Image

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Tue Mar 11, 2008 2:21 am

Well, I've been tinkering with this, and I got the idateadded script operational, however I can't get it to change the played date. Here's my isssue, it's not in the itunes xml. Here's a snip of my xml.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Major Version</key><integer>1</integer>
	<key>Minor Version</key><integer>1</integer>
	<key>Application Version</key><string>7.6.1</string>
	<key>Features</key><integer>5</integer>
	<key>Music Folder</key><string>file://localhost/C:/Users/Adam/Music/iTunes/iTunes%20Music/</string>
	<key>Library Persistent ID</key><string>35297534FFF2065B</string>
	<key>Tracks</key>
	<dict>
		<key>460</key>
		<dict>
			<key>Track ID</key><integer>460</integer>
			<key>Name</key><string>Killing Time</string>
			<key>Artist</key><string>(həd) p.e.</string>
			<key>Album Artist</key><string>(həd) p.e.</string>
			<key>Album</key><string>Broke</string>
			<key>Kind</key><string>MPEG audio file</string>
			<key>Size</key><integer>4677015</integer>
			<key>Total Time</key><integer>235807</integer>
			<key>Track Number</key><integer>1</integer>
			<key>Track Count</key><integer>12</integer>
			<key>Year</key><integer>2000</integer>
			<key>Date Modified</key><date>2008-02-15T19:18:50Z</date>
			<key>Date Added</key><date>2008-03-10T00:25:24Z</date>
			<key>Bit Rate</key><integer>158</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Sort Artist</key><string>hed p.e.</string>
			<key>Persistent ID</key><string>35297534FFF21D3D</string>
			<key>Track Type</key><string>File</string>
			<key>Location</key><string>file://localhost/D:/Music/(hed)p.e/2000%20-%20Broke/01%20-%20Killing%20Time.mp3</string>
			<key>File Folder Count</key><integer>-1</integer>
			<key>Library Folder Count</key><integer>-1</integer>
		</dict>
		<key>461</key>
		<dict>
			<key>Track ID</key><integer>461</integer>
			<key>Name</key><string>Waiting to Die</string>
			<key>Artist</key><string>(həd) p.e.</string>
			<key>Album Artist</key><string>(həd) p.e.</string>
			<key>Album</key><string>Broke</string>
			<key>Kind</key><string>MPEG audio file</string>
			<key>Size</key><integer>3839323</integer>
			<key>Total Time</key><integer>195918</integer>
			<key>Track Number</key><integer>2</integer>
			<key>Track Count</key><integer>12</integer>
			<key>Year</key><integer>2000</integer>
			<key>Date Modified</key><date>2008-02-15T19:18:51Z</date>
			<key>Date Added</key><date>2008-03-10T00:25:24Z</date>
			<key>Bit Rate</key><integer>156</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Sort Artist</key><string>hed p.e.</string>
			<key>Persistent ID</key><string>35297534FFF21D3F</string>
			<key>Track Type</key><string>File</string>
			<key>Location</key><string>file://localhost/D:/Music/(hed)p.e/2000%20-%20Broke/02%20-%20Waiting%20To%20Die.mp3</string>
			<key>File Folder Count</key><integer>-1</integer>
			<key>Library Folder Count</key><integer>-1</integer>
		</dict>
		<key>462</key>
		<dict>
			<key>Track ID</key><integer>462</integer>
			<key>Name</key><string>Feel Good</string>
			<key>Artist</key><string>(həd) p.e.</string>
			<key>Album Artist</key><string>(həd) p.e.</string>
			<key>Album</key><string>Broke</string>
			<key>Kind</key><string>MPEG audio file</string>
			<key>Size</key><integer>4884480</integer>
			<key>Total Time</key><integer>255373</integer>
			<key>Track Number</key><integer>3</integer>
			<key>Track Count</key><integer>12</integer>
			<key>Year</key><integer>2000</integer>
			<key>Date Modified</key><date>2008-02-15T19:18:51Z</date>
			<key>Date Added</key><date>2008-03-10T00:25:24Z</date>
			<key>Bit Rate</key><integer>152</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Sort Artist</key><string>hed p.e.</string>
			<key>Persistent ID</key><string>35297534FFF21D40</string>
			<key>Track Type</key><string>File</string>
			<key>Location</key><string>file://localhost/D:/Music/(hed)p.e/2000%20-%20Broke/03%20-%20Feel%20Good.mp3</string>
			<key>File Folder Count</key><integer>-1</integer>
			<key>Library Folder Count</key><integer>-1</integer>
		</dict>
Image

treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Post by treponem » Tue Mar 11, 2008 4:55 am

Just re-installed Itunes to see what's wrong. It seems you Itunes hasn't got the last play date in its database yet. Can you see the last play date in Itunes?
Here are two songs for comparing. The first one has no play date in Itunes, the second one has:

/EDIT: had a problem with the perl-script to import the last.fm information. Which version have you used? Only 0.1 of this script worked for me, other versions stopped working in the middle.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Major Version</key><integer>1</integer>
	<key>Minor Version</key><integer>1</integer>
	<key>Application Version</key><string>7.6.1</string>
	<key>Features</key><integer>5</integer>
	<key>Show Content Ratings</key><true/>
	<key>Music Folder</key><string>file://localhost/C:/Users/Epic%20Struggler/Music/iTunes/iTunes%20Music/</string>
	<key>Library Persistent ID</key><string>1FBA08409F93347E</string>
	<key>Tracks</key>
		<dict>
			<key>Track ID</key><integer>248</integer>
			<key>Name</key><string>Who Is He (And What Is He To You?)</string>
			<key>Artist</key><string>Bill Withers</string>
			<key>Album Artist</key><string>Various Artists</string>
			<key>Album</key><string>Jackie Brown - Music from the Motion Picture</string>
			<key>Genre</key><string>Soundtrack</string>
			<key>Kind</key><string>MPEG-Audiodatei</string>
			<key>Size</key><integer>3088384</integer>
			<key>Total Time</key><integer>191451</integer>
			<key>Track Number</key><integer>5</integer>
			<key>Track Count</key><integer>17</integer>
			<key>Year</key><integer>1997</integer>
			<key>BPM</key><integer>99</integer>
			<key>Date Modified</key><date>2008-02-22T15:46:50Z</date>
			<key>Date Added</key><date>2008-03-11T09:40:16Z</date>
			<key>Bit Rate</key><integer>128</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Artwork Count</key><integer>1</integer>
			<key>Persistent ID</key><string>1FBA08409F9334C9</string>
			<key>Track Type</key><string>File</string>
			<key>Location</key><string>file://localhost/E:/%23_MP3s/%23_Soundtracks/1997%20-%20Jackie%20Brown%20-%20Music%20from%20the%20Motion%20Picture/05%20-%20Bill%20Withers%20-%20Who%20Is%20He%20(And%20What%20Is%20He%20To%20You).mp3</string>
			<key>File Folder Count</key><integer>-1</integer>
			<key>Library Folder Count</key><integer>-1</integer>
		</dict>
		<dict>
			<key>Track ID</key><integer>240</integer>
			<key>Name</key><string>Across 110th Street</string>
			<key>Artist</key><string>Bobby Womack</string>
			<key>Album Artist</key><string>Various Artists</string>
			<key>Album</key><string>Jackie Brown - Music from the Motion Picture</string>
			<key>Genre</key><string>Soundtrack</string>
			<key>Kind</key><string>MPEG-Audiodatei</string>
			<key>Size</key><integer>3659805</integer>
			<key>Total Time</key><integer>227108</integer>
			<key>Track Number</key><integer>1</integer>
			<key>Track Count</key><integer>17</integer>
			<key>Year</key><integer>1997</integer>
			<key>BPM</key><integer>110</integer>
			<key>Date Modified</key><date>2008-03-03T13:10:03Z</date>
			<key>Date Added</key><date>2008-03-11T09:40:16Z</date>
			<key>Bit Rate</key><integer>128</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Play Count</key><integer>1</integer>
			<key>Play Date</key><integer>3288076902</integer>
			<key>Play Date UTC</key><date>2008-03-11T09:41:42Z</date>
			<key>Artwork Count</key><integer>1</integer>
			<key>Persistent ID</key><string>1FBA08409F9334C5</string>
			<key>Track Type</key><string>File</string>
			<key>Location</key><string>file://localhost/E:/%23_MP3s/%23_Soundtracks/1997%20-%20Jackie%20Brown%20-%20Music%20from%20the%20Motion%20Picture/01%20-%20Bobby%20Womack%20-%20Across%20110th%20Street.mp3</string>
			<key>File Folder Count</key><integer>-1</integer>
			<key>Library Folder Count</key><integer>-1</integer>
		</dict>

Guest

Post by Guest » Tue Mar 11, 2008 9:43 am

Yeah, I can see the last played date, that's why this is so wierd.

Spazz
Posts: 243
Joined: Tue Jan 11, 2005 9:49 pm

Post by Spazz » Tue Mar 11, 2008 11:51 am

Here's the current version of the script with the fields replaced like you said, still doesn't work though. It gives me an error about "object doesn't support this property or method: 'itm.LastTimePlayed' Line 175, column 8

maybe I'm just not destined for this to work.
Image

Post Reply