Update Rating from Ipod to MM and files
Posted: Mon Apr 16, 2007 9:30 am
Hello
I done this script that upadte rating tag file and library MM from rating database iPOD.
In fact a pbm for me was that i can change rating in iPod but i don't find any way to backup this change on the file.
Her this script respons to that and seems to work. it is perfectible on different way
a) i don't find how déclare dynamic array with 2 dimmension ex test(x,y)
b) i don't find how to jump directly on iPod. I must use manuel positionning
c) in several case, i must use MsgBox to wait that MM is correctly positionned on TreeMain Node
d) I must use sonlist.Writetags instead UpdateAll that be very slow ?
e) Fisrt time, open node Artist from Ipod by mous select. I think is because a reaction time from MM
f) and the last but not the least, it seems that SortCriteria do not work or i use it badly
If somewhone can improve that, i will be happy.
Sorry for my english, but i tried to set all information in english
In waiting this script work. I tested on my library for 4653 Files
Copy Script in Scripts Folder under MediaMonkey/scripts
You must only déclare this script in script.ini with
[UTAG]
FileName=APO_UpdateTags.vbs
ProcName=UTAG
Order=9
DisplayName=&_APO Update Rating from iPod to MM
Description=Update MM Rating from iPod
Language=VBScript
ScriptType=0
IMPORTANT in the state of scrip, You must modify your iPod Name in script
And run MediaMonkey
Thank's for your help
Here the script _______________
Option Explicit ' report undefined variables, ...
Dim Root
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' Alain Poujade
' version : 1.0
' date : 14 April 2007
'
' This script update tag rating in MM Library and files from Database Ipod
' that can be changed in move directly on iPod
' You must start this script from Ipod Node Database
' i don't find a way to select this node directly
' ..........................................................
' WARNING 1 : No control of good selection is done at the moment except message
' WARNING 2 : Maximum files to compare = 10 000
' You can change that by your value in Dim declaration for iPod, MM and Ko Array
' Here You must changeMyiPodName that is Name of your iPod showed in MediaMonkey
' ..........................................................
'Const MyiPodName = "IPOD (ALAIN - iPod (X:)"
Const MyiPodName = "iPod 5.5 80G - iPod (I:)"
Dim iPod(10000,4)
Dim MM(10000,4)
Dim Ko(10000,2)
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Sub UTAG
Dim Temp, Result, res
Dim iP, itm, list
Dim mk, tag, last
Dim iPm, mkm, ffind, ftag
Root = MyiPodName
res = SDB.MessageBox(" Run you this script from Device iPod Database Node or Child?", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
res = SDB.MessageBox("Retry after good selection on iPod",mtInformation,Array(mbOK))
Exit Sub
End If
'-------------------------------------------------------------------------------------
' First Find Artist Node on iPod that must be first child
Set Temp = SDB.MainTree.CurrentNode
Result = Temp.caption
On Error Resume Next
if Result <> Root Then
Do While Result <> Root
Set Temp = SDB.MainTree.PreviousNode(Temp) 'Node parent de l'actuel
Result = Temp.caption
If Err.Number <> 0 then
' Err.Clear
MsgBox "Seems to be not start from iPod Node"
Exit Sub 'Sécurity to quit if not iPod selected
End If
Loop
End If
Set Temp = SDB.MainTree.FirstChildNode(Temp)
SDB.MainTree.CurrentNode = Temp
Set Temp = SDB.MainTree.NextNode(Temp)
SDB.MainTree.CurrentNode = Temp
SDB.MainTree.CurrentNode.SortCriteria = 4 'Does means not work !!!!
res = SDB.MessageBox( "Positioned to iPod in Node Artist ? ", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
MsgBox "Opération canceled"
Exit Sub
End If
'-------------------------------------------------------------------------------------
' Here Work from iPod, scan Songs
' Iterate through the list and export all songs
Set list = SDB.CurrentSongList
for iP=0 to list.count-1
' for iP=0 to 3
Set itm = list.Item(iP)
iPod(iP,1) = itm.Title
iPod(iP,2) = itm.AlbumName
iPod(iP,3) = itm.ArtistName
iPod(iP,4) = itm.Rating
Progress.Value = iP+1
next
res = SDB.MessageBox( "End browsing " + CStr(iP) + " Songs from iPod", mtInformation, Array(mbOk))
'-------------------------------------------------------------------------------------
' Here switch to MM Database node Artist
Set Temp = SDB.MainTree.Node_Artist
SDB.MainTree.CurrentNode = Temp
SDB.MainTree.CurrentNode.SortCriteria = 4 'Does means not work !!!!
res = SDB.MessageBox( "Positioned to MM Library in Node Artist ? ", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
MsgBox "Opération canceled"
Exit Sub
End If
'-------------------------------------------------------------------------------------
' Here Work from MM, scan Songs
' Iterate through the list and export all songs
Set last = SDB.CurrentSongList
for mk=0 to last.count-1
' for mk=0 to 3
Set tag = last.Item(mk)
MM(mk,1) = tag.Title
MM(mk,2) = tag.AlbumName
MM(mk,3) = tag.ArtistName
MM(mk,4) = tag.Rating
next
res = SDB.MessageBox( "End browsing " + CStr(mk ) + " Songs from MediaMonkey", mtInformation, Array(mbOk))
MsgBox "Be Patient, that can be very long, Wait until next message End Processing, Thank's"
'-------------------------------------------------------------------------------------
' Here Compare Scanning and list delta
ffind = 0
ftag = 0
mkm = mk -1
iPm = iP -1
Set last = SDB.CurrentSongList
For iP=0 to iPm
' Find Title
mk = 0
Do While mk <= mkm
If iPod(iP,1) = MM(mk,1) Then
If iPod(iP,2) = MM(mk,2) then
If iPod(iP,3) = MM(mk,3) then
if iPod(iP,4) = MM(mk,4) then
ffind = ffind+1
Else
' Maybe here something with Progressvalue
Ko(ftag,1)=iP
Ko(ftag,2)=mk
ftag = ftag + 1
End If
Exit Do
End If
End If
End If
mk = mk +1
Loop
Next
res = SDB.MessageBox( "End processing " + CStr(ffind) + " / " + CStr(iPm+1)+ " Identical Songs", mtInformation, Array(mbOk))
res = SDB.MessageBox( CStr(ftag)+ " / " + CStr(iPm+1)+ " Rating to change", mtInformation, Array(mbOk))
'-------------------------------------------------------------------------------------
' Here Update MM File from delta
' Write all back to DB and update tags
if ftag > 0 Then
res = SDB.MessageBox(" Confirm Update MM Library and file's TAG", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
res = SDB.MessageBox("Opération canceled",mtInformation,Array(mbOK))
Exit Sub
Else
MsgBox "Progress Update"
Set last = SDB.CurrentSongList
Do While ftag > 0
iP = Ko(ftag-1,1)
mk = Ko(ftag-1,2)
Set tag = last.Item(mk)
tag.Rating=iPod(iP,4)
tag.WriteTags
tag.UpdateDB
ftag = ftag-1
Loop
' last.UpdateAll ' Other way but too long
MsgBox "Update Finished"
End If
End if
End Sub
I done this script that upadte rating tag file and library MM from rating database iPOD.
In fact a pbm for me was that i can change rating in iPod but i don't find any way to backup this change on the file.
Her this script respons to that and seems to work. it is perfectible on different way
a) i don't find how déclare dynamic array with 2 dimmension ex test(x,y)
b) i don't find how to jump directly on iPod. I must use manuel positionning
c) in several case, i must use MsgBox to wait that MM is correctly positionned on TreeMain Node
d) I must use sonlist.Writetags instead UpdateAll that be very slow ?
e) Fisrt time, open node Artist from Ipod by mous select. I think is because a reaction time from MM
f) and the last but not the least, it seems that SortCriteria do not work or i use it badly
If somewhone can improve that, i will be happy.
Sorry for my english, but i tried to set all information in english
In waiting this script work. I tested on my library for 4653 Files
Copy Script in Scripts Folder under MediaMonkey/scripts
You must only déclare this script in script.ini with
[UTAG]
FileName=APO_UpdateTags.vbs
ProcName=UTAG
Order=9
DisplayName=&_APO Update Rating from iPod to MM
Description=Update MM Rating from iPod
Language=VBScript
ScriptType=0
IMPORTANT in the state of scrip, You must modify your iPod Name in script
And run MediaMonkey
Thank's for your help
Here the script _______________
Option Explicit ' report undefined variables, ...
Dim Root
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' Alain Poujade
' version : 1.0
' date : 14 April 2007
'
' This script update tag rating in MM Library and files from Database Ipod
' that can be changed in move directly on iPod
' You must start this script from Ipod Node Database
' i don't find a way to select this node directly
' ..........................................................
' WARNING 1 : No control of good selection is done at the moment except message
' WARNING 2 : Maximum files to compare = 10 000
' You can change that by your value in Dim declaration for iPod, MM and Ko Array
' Here You must changeMyiPodName that is Name of your iPod showed in MediaMonkey
' ..........................................................
'Const MyiPodName = "IPOD (ALAIN - iPod (X:)"
Const MyiPodName = "iPod 5.5 80G - iPod (I:)"
Dim iPod(10000,4)
Dim MM(10000,4)
Dim Ko(10000,2)
'
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Sub UTAG
Dim Temp, Result, res
Dim iP, itm, list
Dim mk, tag, last
Dim iPm, mkm, ffind, ftag
Root = MyiPodName
res = SDB.MessageBox(" Run you this script from Device iPod Database Node or Child?", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
res = SDB.MessageBox("Retry after good selection on iPod",mtInformation,Array(mbOK))
Exit Sub
End If
'-------------------------------------------------------------------------------------
' First Find Artist Node on iPod that must be first child
Set Temp = SDB.MainTree.CurrentNode
Result = Temp.caption
On Error Resume Next
if Result <> Root Then
Do While Result <> Root
Set Temp = SDB.MainTree.PreviousNode(Temp) 'Node parent de l'actuel
Result = Temp.caption
If Err.Number <> 0 then
' Err.Clear
MsgBox "Seems to be not start from iPod Node"
Exit Sub 'Sécurity to quit if not iPod selected
End If
Loop
End If
Set Temp = SDB.MainTree.FirstChildNode(Temp)
SDB.MainTree.CurrentNode = Temp
Set Temp = SDB.MainTree.NextNode(Temp)
SDB.MainTree.CurrentNode = Temp
SDB.MainTree.CurrentNode.SortCriteria = 4 'Does means not work !!!!
res = SDB.MessageBox( "Positioned to iPod in Node Artist ? ", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
MsgBox "Opération canceled"
Exit Sub
End If
'-------------------------------------------------------------------------------------
' Here Work from iPod, scan Songs
' Iterate through the list and export all songs
Set list = SDB.CurrentSongList
for iP=0 to list.count-1
' for iP=0 to 3
Set itm = list.Item(iP)
iPod(iP,1) = itm.Title
iPod(iP,2) = itm.AlbumName
iPod(iP,3) = itm.ArtistName
iPod(iP,4) = itm.Rating
Progress.Value = iP+1
next
res = SDB.MessageBox( "End browsing " + CStr(iP) + " Songs from iPod", mtInformation, Array(mbOk))
'-------------------------------------------------------------------------------------
' Here switch to MM Database node Artist
Set Temp = SDB.MainTree.Node_Artist
SDB.MainTree.CurrentNode = Temp
SDB.MainTree.CurrentNode.SortCriteria = 4 'Does means not work !!!!
res = SDB.MessageBox( "Positioned to MM Library in Node Artist ? ", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
MsgBox "Opération canceled"
Exit Sub
End If
'-------------------------------------------------------------------------------------
' Here Work from MM, scan Songs
' Iterate through the list and export all songs
Set last = SDB.CurrentSongList
for mk=0 to last.count-1
' for mk=0 to 3
Set tag = last.Item(mk)
MM(mk,1) = tag.Title
MM(mk,2) = tag.AlbumName
MM(mk,3) = tag.ArtistName
MM(mk,4) = tag.Rating
next
res = SDB.MessageBox( "End browsing " + CStr(mk ) + " Songs from MediaMonkey", mtInformation, Array(mbOk))
MsgBox "Be Patient, that can be very long, Wait until next message End Processing, Thank's"
'-------------------------------------------------------------------------------------
' Here Compare Scanning and list delta
ffind = 0
ftag = 0
mkm = mk -1
iPm = iP -1
Set last = SDB.CurrentSongList
For iP=0 to iPm
' Find Title
mk = 0
Do While mk <= mkm
If iPod(iP,1) = MM(mk,1) Then
If iPod(iP,2) = MM(mk,2) then
If iPod(iP,3) = MM(mk,3) then
if iPod(iP,4) = MM(mk,4) then
ffind = ffind+1
Else
' Maybe here something with Progressvalue
Ko(ftag,1)=iP
Ko(ftag,2)=mk
ftag = ftag + 1
End If
Exit Do
End If
End If
End If
mk = mk +1
Loop
Next
res = SDB.MessageBox( "End processing " + CStr(ffind) + " / " + CStr(iPm+1)+ " Identical Songs", mtInformation, Array(mbOk))
res = SDB.MessageBox( CStr(ftag)+ " / " + CStr(iPm+1)+ " Rating to change", mtInformation, Array(mbOk))
'-------------------------------------------------------------------------------------
' Here Update MM File from delta
' Write all back to DB and update tags
if ftag > 0 Then
res = SDB.MessageBox(" Confirm Update MM Library and file's TAG", mtWarning, Array(mbYes,mbNo,mbAbort))
If res <> 6 Then
res = SDB.MessageBox("Opération canceled",mtInformation,Array(mbOK))
Exit Sub
Else
MsgBox "Progress Update"
Set last = SDB.CurrentSongList
Do While ftag > 0
iP = Ko(ftag-1,1)
mk = Ko(ftag-1,2)
Set tag = last.Item(mk)
tag.Rating=iPod(iP,4)
tag.WriteTags
tag.UpdateDB
ftag = ftag-1
Loop
' last.UpdateAll ' Other way but too long
MsgBox "Update Finished"
End If
End if
End Sub