DateCreatedOrLastModified2DateAdded 1.21 (17/04/2008)[MM2+3]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

DateCreatedOrLastModified2DateAdded 1.21 (17/04/2008)[MM2+3]

Post by Big_Berny »

Hi MediaMonkeys! :)
Since some people asked for it I played a bit around and created a script which imports the date of creation of a file and writes it into DateAdded. It's very simple but it only imports the date when it's older than DateAdded.

Just select the files you want to change, open the script over Tools/Scripts/DateCreated2DateAdded.

By the way: I recommend to do a backup of your library first because there's no way to undo the change of DateAdded. Just to be on the safe side.

Have a nice weekend! :)
Big_Berny

Code: Select all

' MEDIAMONKEY SCRIPT: DateCreated2DateAdded 
' Author: Big_Berny supported by RedX
' Version: 1.21 
' Date: 17/04/2008 
' 
' This script reads the creation date of a file and writes it into the DateAdded-field. 
' 
' Install: 
' - Save this script as plain text file named DateCreatedOrLastModified2DateAdded.vbs to the MediaMonkey /Scripts-folder. 
' - Add the following lines to Scripts.ini: 
' 
'  [DateCreated2DateAdded] 
'  FileName=DateCreatedOrLastModified2DateAdded.vbs 
'  ProcName=TheDate2DateAdded("DateCreated")
'  Order=7 
'  DisplayName=DateCreated2DateAdded 
'  Description=Imports the file's Created-date and stores it in DateAdded 
'  Language=VBScript 
'  ScriptType=0 
'  [LastModified2DateAdded] 
'  FileName=DateCreatedOrLastModified2DateAdded.vbs 
'  ProcName=TheDate2DateAdded("DateLastModified")
'  Order=7 
'  DisplayName=LastModified2DateAdded 
'  Description=Imports the file's LastModified-date and stores it in DateAdded  
'  Language=VBScript 
'  ScriptType=0 
'************************************************************************************ 

Sub TheDate2DateAdded(TheDate)
	Dim SongList : Set SongList = SDB.CurrentSongList 
	Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject") 
	Dim File, Song, SongDate, i 
  
	If SongList.Count = 0 Then 
		SDB.MessageBox "No songs selected!", mtError, Array(mbOK) 
		Exit Sub 
	End If 

	Dim ProgressBar : Set ProgressBar = SDB.Progress
	ProgressBar.Text = "Importing..."
	ProgressBar.MaxValue = SongList.Count
	
	For i = 0 To SongList.Count - 1
		If ProgressBar.terminate Then
			Exit Sub
		End If
		ProgressBar.Value = i + 1
		Set Song = SongList.Item(i) 
		Set File = FSO.GetFile(Song.Path) 
		execute("SongDate = File."&TheDate)
		If DateValue(Song.DateAdded) > DateValue(SongDate) Then
			Song.DateAdded = SongDate
			Song.UpdateDB 
			Song.WriteTags 
		End If 
	Next 
End Sub
Last edited by Big_Berny on Wed Apr 16, 2008 6:39 pm, edited 6 times in total.
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
LordHades
Posts: 53
Joined: Sat Sep 29, 2007 4:45 am
Location: The Netherlands
Contact:

Post by LordHades »

Thank you sooo much for this script :D It works like a charm and all the 30k songs have there orginal added date back. Also made a backup of the .db now
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

No problem! I'm glad that it works! :D

Just see it as a little 'Thank you' for testing AutoRateAccurate! ;)

Big_Berny
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

LH:

I'm glad you found a solution to your problem. :P

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
RedX
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Post by RedX »

I added a progressbar to the script and the option to terminate with a right click of the mouse on the progress bar. Hope this is ok with you berny.

Btw nice script, was searching for something like this for a long time since i addad a lot of songs at once in the monkey :-)

Regards,
Red

Code: Select all

CODE REMOVED
NEW VERSION BELOW
Last edited by RedX on Mon Apr 07, 2008 2:15 pm, edited 1 time in total.
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

Sure, no problem. For me it's finished anyway.

The code with the bar looks a bit to big and complicated. Could be done a lot easier. But as long as it works... :)
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Post by treponem »

Hi Berny

Big thanks for this script (and also for Accurate)!

Unfortunately I've let MM autosort my files and also moved them to another drive, so the file date is set to march 2008.

Is there any possibility to recover the original date from the files? I think that Windows or MM created new files while sorting them, but perhaps someone knows something?
LordHades
Posts: 53
Joined: Sat Sep 29, 2007 4:45 am
Location: The Netherlands
Contact:

Post by LordHades »

Hmmm dont know if the orginal date is still in tact if you move it to other drive tho. This script worked like a charm for me tho and still many thanks m8 you made my day well week even!
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

@treponem: Yes, sometimes this happens but I don't know when exactly. Unfortunately the original date can't be restored. BUT you could look in the file preferences in windows if the 'Changed'-date is older than the 'Created'-date. If yes we could import that value.

I also have files which 'were created' on 14.4.2007 and changed on 4.3.2005 which isn't really logic...
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Post by treponem »

@Big_Berny: Nope, the 'changed-date' is older than the created one, but also set to March 08, too.
There would be no trouble for me if I had switched to MM earlier, I thought I was happy with Winamp for too long. Thanks again for your help, this script could have improve Autorate for me, it's my own fault not to have looked for a Winamp-alternative earlier than Jan '07. :roll:
Queseuq
Posts: 111
Joined: Sat Apr 05, 2008 8:30 am

Post by Queseuq »

Hi, I'm just looking for a script to change 'Original Date' to be the same as 'Date' on selected tracks. I thought I could alter this script to do what I want but I don't know enough about scripting to do it. Could someone show me what to change to make it do what I want?
nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Post by nohitter151 »

Queseuq wrote:Hi, I'm just looking for a script to change 'Original Date' to be the same as 'Date' on selected tracks. I thought I could alter this script to do what I want but I don't know enough about scripting to do it. Could someone show me what to change to make it do what I want?
Just use this.
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.
Queseuq
Posts: 111
Joined: Sat Apr 05, 2008 8:30 am

Post by Queseuq »

D'oh! Thanks nohitter.
mohikaani
Posts: 63
Joined: Wed Oct 31, 2007 2:25 pm

Post by mohikaani »

Big_Berny: is it posible to implement DateModified2DateAdded ?
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

Ok, here is a new version 1.2 of the script. Now you can import DateCreated and DateLastModified. I also integrated RedX' progressbar into my code which is simpler.

The files and the scripts.ini-entries are different from older versions. So please remove the older version and its ini-entries first.

Big_Berny

@Red: Could you please remove your code? So that the users really get the new code.

Code: Select all

Check first post!
Last edited by Big_Berny on Wed Apr 16, 2008 6:37 pm, edited 1 time in total.
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
Post Reply