[MM2+3] Change Drive-ID after moving Files to a new Drive

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

Moderators: Peke, Gurus

meric
Posts: 8
Joined: Mon May 22, 2006 1:04 pm
Location: Ottawa, Canada

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by meric »

Thanks! My scripting skills are rudimentary and very rusty but I was determined to make the script work somehow! After changing that line, it worked great. Thanks for saving me hours of work!
wavicle3
Posts: 1
Joined: Tue Mar 04, 2008 12:27 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by wavicle3 »

The script works great.

On my Vista machine I had the same VB script error, line 429.

Right clicking the MM icon, and choosing "Run as Administrator" solved the problem, as someone in this forum suggested.

Thank you!
landoranon

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by landoranon »

the explanation at "http://www.mediamonkey.com/wiki/index.p ... w_computer" and the scropt worked perfectly. I had over 13,000 files to manage. It took less than 30 seconds to convert the MM library from one drive to another.

Well Done! and thanks again.
MickRob

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by MickRob »

Many thanks for your great script - it was really easy to transfer my MM database containing nearly 40,000 songs to a larger HD.
Benn
Posts: 300
Joined: Sat Jul 12, 2008 11:59 am
Location: Cornwall, United Kingdom

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by Benn »

Thank you, just about to use this. So, whether I've used this or not, am I right to assume that changing the drive letter only doesn't grey the tracks out?
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by MoDementia »

Yes changing drive letters will not require this script.
It is only for swapping physical drives (upgrades etc)
If the change in letter is the result of partitioning the drive the script will probably be required
Benn
Posts: 300
Joined: Sat Jul 12, 2008 11:59 am
Location: Cornwall, United Kingdom

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by Benn »

Yeah I installed a new drive, moved my music to that, then de-partitioned my old drive, then changed the letter of my new drive again to make it all neat and tidy...

Worked flawlessly, thank you.
tatoosh
Posts: 110
Joined: Thu Aug 03, 2006 7:43 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by tatoosh »

i need something that do this:

move from mapped network drive to external hdd - how to do so?
thanks!

okay solved it this way:
i opened the database file with SQLLiteBrowser http://sqlitebrowser.sourceforge.net/
go to Table MEDIAS
then i changed the SERIAL NUMBER, DRIVE TYPE, LABEL and SHOW LABEL to the new Drive
Image

I got the values for the new drive the same way. Just put some files in the database and the read out your serial number (drive id).
fast solution!!
theunderwaterdog
Posts: 4
Joined: Mon Jul 07, 2008 5:26 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by theunderwaterdog »

I have followed the instructions but when i try to save the script.ini with the update i get an error message saying 'Cannont create the C:\...\script.ini file. Make sure that the path and file name are correct.' Anyone any ideas? Thanks

PS I'm using Vista home premium - could this be the cause?
tatoosh
Posts: 110
Joined: Thu Aug 03, 2006 7:43 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by tatoosh »

i will write a little programm which can do the changes automatical.
but i am new in pogramming, so it will took a while ;)

i will give u the link, when i has finished.
tatoosh
Posts: 110
Joined: Thu Aug 03, 2006 7:43 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by tatoosh »

Now i have finished my little work:
You can download my software here. Please make a Backup of MM.DB before you use this.

MediaMonkey3 DB Drive Changer v0.1:
Image
Download http://www.tatoosh.de/download/MM3-DBDCv0.1.zip
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by nynaevelan »

There are already two scripts which do this, what is different about yours? And you should probably add yours to it's own thread explaining how to use it.

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
tatoosh
Posts: 110
Joined: Thu Aug 03, 2006 7:43 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by tatoosh »

okay i didnt know there are other scripts for it.
i posted it as a new script with a short description: http://www.mediamonkey.com/forum/viewto ... =2&t=35197
unnicorn
Posts: 18
Joined: Fri Mar 09, 2007 12:21 am

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by unnicorn »

hi,

Can someone please paste the code that I need to paste in MM_HDDSerial.vbs

Right now when I click on move device content I get an error message.

Thanks
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Post by nynaevelan »

It should be in the first post but if not here it is:

Code: Select all

'1. Shutdown MediaMonkey

'2. Create the follwing Lines (without 'REM ' )  in MediaMonkey\Scripts\Scripts.ini:
REM [HDDSerial]
REM FileName=MM_HDDSerial.vbs
REM ProcName=Change_HDD_Serial
REM Order=99
REM DisplayName=Move Device Content
REM Description=Corrects broken links after exchanged harddrive
REM Language=VBScript
REM ScriptType=0

'3.  Restart MediaMonkey
'4. Make sure every Device (harddrive) has a Label (Library -> Location)
'5. Select Tools -> Scripts -> Move Device Content
'6. Select on the left side the old device (harddrive)
'7. Select on the right side the new drive
'8. OK
'9. Restart MediaMonkey

'Now MediaMonkey should find all the files which where located on the old drive and are now on the new one.

Option Explicit

Sub Change_HDD_Serial()
  Const PanelWidth = 200
  Const PanelHeight = 100
  Const objSpace = 10
  
  Dim cntMedias
  Dim arrRadioMedia()
  Dim arrRadioMediaID()
  Dim cntDrives
  Dim arrRadioDrive()
  Dim arrRadioDriveLetter()
  Dim arrRadioDriveSN()
  Dim arrRadioDriveTypes()

  Dim SDB
  Set SDB = CreateObject("SongsDB.SDBApplication")
  Dim FSO
  Set FSO = CreateObject("Scripting.FileSystemObject")
  Dim UI
  Set UI = SDB.UI

  'Create the window to be shown
  Dim Form
  Set Form = UI.NewForm
  Form.Common.ClientWidth = objSpace + PanelWidth + objSpace + PanelWidth + objSpace
  Form.FormPosition = 4   ' Screen Center
  Form.BorderStyle = 3    ' Dialog
  Form.Caption = "Move MediaMonkey's Device Content"
  
  Dim Label
  Set Label = UI.NewLabel(Form)
  Label.Caption = "from ..."
  Label.Common.Top = objSpace
  Label.Common.Left = objSpace
  Label.Common.Width = PanelWidth
  
  Set Label = UI.NewLabel(Form)
  Label.Caption = "to ..."
  Label.Common.Top = objSpace
  Label.Common.Left = objSpace + PanelWidth + objSpace
  Label.Common.Width = PanelWidth
  
  Dim PanelMedia
  Set PanelMedia = UI.NewPanel(Form)
  PanelMedia.Common.SetRect objSpace, objSpace + Label.Common.Height + objSpace, PanelWidth, PanelHeight
  
  'Add Medias
  Dim ds
  Dim RadioBtn
  Dim BtnTop
  Dim Caption
  
  BtnTop = 0
  cntMedias = 0
  Set ds = SDB.DataBase.OpenSQL("SELECT * FROM Medias WHERE DriveType < 10")
  While Not ds.EOF
    Caption = ""
    'If ds.StringByName("Driveletter") <> "" Then Caption = Chr(ds.ValueByName("DriveLetter") + 65) & ": "
    If ds.StringByName("Label") <> "" Then
      'If Caption <> "" Then Caption = Caption & "- "
      Caption = Caption & ds.StringByName("Label")
    End If
    If ds.StringByName("ShowLabel") <> "" Then
      If Caption <> "" Then Caption = Caption & "- "
      Caption = Caption & ds.StringByName("ShowLabel")
    End If
    If Caption = "" Then Caption = ds.StringByName("Comment")
    
    Set RadioBtn = UI.NewRadioButton(PanelMedia)
    RadioBtn.Common.Top = BtnTop
    RadioBtn.Common.Width = PanelWidth
    BtnTop = BtnTop + RadioBtn.Common.Height + 3
    PanelMedia.Common.ClientHeight = BtnTop
    RadioBtn.Caption = Caption
    RadioBtn.Common.Hint = ds.StringByName("Comment")
    
    cntMedias = cntMedias + 1
    ReDim Preserve arrRadioMedia(cntMedias)
    ReDim Preserve arrRadioMediaID(cntMedias)
    Set arrRadioMedia(cntMedias) = RadioBtn
    arrRadioMediaID(cntMedias) = ds.ValueByName("IDMedia")
    
    ds.Next
  Wend
  
  Dim PanelDrives
  Set PanelDrives = UI.NewPanel(Form)
  PanelDrives.Common.SetRect objSpace + PanelWidth + objSpace, objSpace + Label.Common.Height + objSpace, PanelWidth, PanelHeight
  
  'Add DriveLetters
  BtnTop = 0
  cntDrives = 0
  Dim Drive
  For Each Drive In FSO.Drives
    If Drive.IsReady Then
      Caption = Drive.DriveLetter & ":"
      Caption = Caption & " - " & Drive.VolumeName
    
      Set RadioBtn = UI.NewRadioButton(PanelDrives)
      RadioBtn.Common.Top = BtnTop
      RadioBtn.Common.Width = PanelWidth
      BtnTop = BtnTop + RadioBtn.Common.Height + 3
      PanelDrives.Common.ClientHeight = BtnTop
      RadioBtn.Caption = Caption
     RadioBtn.Common.Hint = CStr(Drive.SerialNumber) 'TotalSize / 1024 / 1024 / 1024
    
      cntDrives = cntDrives + 1
      ReDim Preserve arrRadioDrive(cntDrives)
      ReDim Preserve arrRadioDriveLetter(cntDrives)
      ReDim Preserve arrRadioDriveSN(cntDrives)
      ReDim Preserve arrRadioDriveTypes(cntDrives)
      Set arrRadioDrive(cntDrives) = RadioBtn
      arrRadioDriveLetter(cntDrives) = Drive.SerialNumber
      arrRadioDriveSN(cntDrives) = Drive.SerialNumber
      arrRadioDriveTypes(cntDrives) = Drive.DriveType + 1
    End If
  Next
  
  If PanelDrives.Common.Height > PanelMedia.Common.Height Then
    BtnTop = PanelDrives.Common.Height
  Else
    BtnTop = PanelMedia.Common.Height
  End If
  
  Set Label = UI.NewLabel(Form)
  Label.Caption = "Only the Database-Entries are updates. The Files aren't moved physically on the Harddisk!"
  Label.Common.Top = objSpace + Label.Common.Height + objSpace + BtnTop + objSpace
  Label.Common.Left = objSpace
  Label.Common.Height = Label.Common.Height * 2
  Label.Common.Width = Form.Common.ClientWidth - objSpace - objSpace
  Label.MultiLine = True
  
  Dim Btn
  Set Btn = UI.NewButton(Form)
  
  BtnTop = Label.Common.Top + Label.Common.Height + objSpace
  
  Btn.Caption = SDB.Localize("&Ok")
  Btn.Common.SetRect objSpace, BtnTop, PanelWidth, 25
  Btn.ModalResult = 1
  Btn.Default = True

  Set Btn = UI.NewButton(Form)
  Btn.Caption = SDB.Localize("&Cancel")
  Btn.Common.SetRect objSpace + PanelWidth + objSpace, BtnTop, PanelWidth, 25
  Btn.ModalResult = 2
  Btn.Cancel = True
  
  Form.Common.ClientHeight = BtnTop + 25 + objSpace
  
  If Form.ShowModal = 1 Then 'OK
    Dim SelMedia     'Media-ID
    Dim SelDrive     'Drive Letter
    Dim selDriveSN   'SerialNumber
    Dim SelDriveType 'Drive Type
    SelMedia = ""
    SelDrive = ""
    
    Dim intTemp
    For intTemp = 1 To cntMedias
      If arrRadioMedia(intTemp).Checked Then SelMedia = arrRadioMediaID(intTemp)
    Next
    For intTemp = 1 To cntDrives
      If arrRadioDrive(intTemp).Checked Then
        SelDrive = arrRadioDriveLetter(intTemp)
        selDriveSN = arrRadioDriveSN(intTemp)
        SelDriveType = arrRadioDriveTypes(intTemp)
      End If
    Next
    
    If (SelDrive <> "") And (SelMedia <> "") Then
      If SDB.MessageBox("Are you really sure?", 0, Array(0, 2)) = 6 Then
        Set ds = SDB.DataBase.OpenSQL("SELECT * FROM Medias WHERE SerialNumber = " & selDriveSN)
        If Not ds.EOF Then
          SDB.DataBase.ExecSQL ("Update Songs set IDMedia = " & ds.StringByName("IDMedia") & " WHERE IDMedia = " & SelMedia)
        Else
          SDB.DataBase.ExecSQL ("Update Medias set SerialNumber = " & selDriveSN & ", DriveType = " & SelDriveType & " WHERE IDMedia = " & SelMedia)
        End If
      SDB.MessageBox "Please restart MediaMonkey", 2, Array(4)
      End If
    End If
  End If
End Sub
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
Post Reply