Page 1 of 2

Import database form Collectorz MP3 Collector

Posted: Sat Dec 17, 2005 9:44 am
by Ewoud

I have used before MP3 Collector from and had create a .mpc database with al my MP3 CD's in it. Now I want to import this database to MM, but I can't figure out how! Please help me because I don't want to scan all my MP3's CD's again!

In MP3 Collector there is an export function to .txt, .html, .xml. Can someone help me to import them?



Posted: Sat Dec 17, 2005 9:45 am
by Guest
I've already tried to scan the .mpc files but that doesn't work :cry:


Posted: Sat Dec 17, 2005 11:37 am
by Bex
What do you mean?
Do you have music files in mpc format that you like to play and organize in MM or do you have a Database in with the extension .mpc?

There should be no problem to add/rescan mpc files into MM just select mpc in the "add file types"-box in the add/rescan window before you hit OK.

Posted: Sat Dec 17, 2005 3:16 pm
by trixmoto
@Bex: I think the .mpc file is a database file not a music file.

@Ewoud: Email me the .mpc file and I'll have a look.

Posted: Sun Dec 18, 2005 10:51 am
by Guest
That's right, the database file of MP3 Collector names them .mpc for somehow. Otherwise it would have been to easy!

I've create an .xml file, is their a converter perhaps? I will send you a copy trixmoto. Thanx!


Posted: Sun Dec 18, 2005 4:08 pm
by trixmoto
Thanks for the .mpc file. I am confused however, does MP3 Collector not allow you to save the information to the tags? Could you not then rescan this information into MM?

If not, please export as .xml and .txt and email them to me so I can decide which would be easier to read with a script.

Posted: Mon Dec 19, 2005 5:21 pm
by Guest
I'm not sure what you mean... :-? I can not figure out to do a rescan or something. I can scan all my mp3 cd's again with MM but that I want to prevent :D

I will send you the .xml file and the .txt as well. Thanx again!


Posted: Mon Dec 19, 2005 5:50 pm
by trixmoto
From the "File" menu select "Add/Rescan...", select the folder with your tracks. This should add all the information from the tags to the MM database. What fields are in the "MP3 Collector" database which are not written to the tags?

Posted: Mon Dec 19, 2005 6:29 pm
by Steegy
Well, I guess Ewoud means it would be too much work to scan all his mp3 cd's (not hard disk) again, now for MM. Importing would be much faster (and human).

The exported TXT file is probably the easiest to use, as you can read in all the lines one by one and get the separated fields out of it.
For the XML file, you would need to import some XML object and add more difficult code to make it work.
(Just FYI)

Oh, it would be so much fun to use a comma separated import feature like Excel's, or like MM's way of tagging (place the Fields in the right "context").
If this comma-separated-file importing becomes asked a lot (for programs able to export to txt), then a built in importing function (like the tagging function) would be great.

When exporting the txt file, make sure you export all fields you want (using the "Fields..." button in the "Export To Text" dialog), e.g. the fields that are filled.
Also write down all the names and order of the fields that you are exporting to the text file (comma or semicolon separated)


Posted: Mon Dec 19, 2005 9:26 pm
by Peke
I must dissapoint Ewoud :(
Even if we manage to make script that will import exported XML the big big problem will be CD Serials which is read by MM so recognize accessability of tracks and to assign drive letters to "?:\" paths in MM :(
There will be still need to insert CD in Drive althru all tag info that have been changed after CD is burned will be preserved in MM lib.

So my conclusion is that beside just importing of MP3 Collector database there must be way to assign serial number to Media(Media table in MDB) in MM lib.

Posted: Tue Dec 20, 2005 3:20 am
by Steegy
the big big problem will be CD Serials which is read by MM so recognize accessability of tracks and to assign drive letters to "?:\" paths in MM
This is only a problem if it is necessary for Ewoud that MM recognizes the entered discs. If not, no problem. MM works without (media field or) serial number.

But maybe it would be handy if you could "relink" the imported albums when you enter the corresponding cd. Therefore we need to know how to get the serial number from the entered disk.


Posted: Tue Dec 20, 2005 4:35 am
by trixmoto
Sorry, I'd lost track of the fact that the MP3's weren't on Ewoud's computer (although it does clearly state so at the top!) :oops:

Yes, having looked at the MPC, XML and TXT; TXT is definitely the easiest. The first line of the TXT lists the column headers (field names) so this is certainly possibly.

The CD serial number does pose a problem though. Maybe a script could also be written to assign a serial number to tracks? You can get the serial number using SDB.Media.SerialNumber, then use SQL?

Posted: Tue Dec 20, 2005 8:00 am
by Steegy
Here's a script to add cd serial numbers to selected files:

EDIT: I haven't tested this a lot so please backup your MediaMonkey database first (If you don't know how, do a forum search). It's always possible that there is a problem. (SQL Update and Insert queries)

Code: Select all

' MediaMonkey Script 
' NAME: AssignCDMedia v1.0 
'  Assign the selected tracks to the entered cd. This is necessary for tracks that are imported
'   from antoher database and need to be relinked to the original cd, when that one is entered.
'  The function has to be manuelly invoked through the Tools>Scripts menu.
'  It finds all available cd volumes and then asks to which one you want to assign the tracks.
' AUTHOR: Steegy aka RC
' DATE  : 20.12.2005 
' - Copy script to MM directory "Scripts" (and add an entry to "scripts.ini")

Dim myVolume

Sub AssignCDMedia

  Set list = SDB.SelectedSongList 
  If list.count = 0 Then 
    Set list = SDB.AllVisibleSongList 
      If list.count = 0 Then 
        Result = SDB.MessageBox("Nothing Selected!", mtError, Array(mbOK)) 
        Exit Sub
      End If 
  End If

  strComputer = "."
  Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
  Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk")

  For Each objDisk in colDisks

    If objDisk.FileSystem = "CDFS" And objDisk.DriveType = 5 And objDisk.VolumeSerialNumber <> "" Then
      '"Device ID: " & vbTab &  objDisk.DeviceID
      '"Volume Name: "& vbTab & objDisk.VolumeName
      '"File System: "& vbTab & objDisk.FileSystem
      '"Drive Type: "& vbTab & objDisk.DriveType
      '"Volume Serial Number: "& vbTab & objDisk.VolumeSerialNumber
      Set myVolume = objDisk

      If SDB.MessageBox("Device ID: " & vbTab &  objDisk.DeviceID & vbCrLf _
        & "Volume Name: "& vbTab & objDisk.VolumeName & vbCrLf & vbCrLf _
        & "Is This The CD You Want?", mtConfirmation, Array(mbYes, mbNo)) = mrYes Then

        MediaDeviceID = (Asc(Left(myVolume.DeviceID,1))-65)
        Set Iter = SDB.Database.OpenSQL("SELECT (Max(IDMedia)+1) as NextMediaID FROM Medias;")  'We don't need this to add a record because IDMedia is autonumbering. But we would need it to find the ID of the added record, so I'm using it anyway.
        MediaVolSN = ("&H" & myVolume.VolumeSerialNumber)*1
        NextMediaID = Iter.StringByIndex(0)		'or StringByName("NextMediaID")
        MediaLabel = myVolume.VolumeName

        Set Iter = SDB.Database.OpenSQL("SELECT IDMedia FROM Medias WHERE SerialNumber = " & MediaVolSN & ";")
        If Iter.EOF Then
          SDB.Database.ExecSQL("INSERT INTO Medias(IDMedia, SerialNumber, DriveType, Label, ShowLabel, TurnedSN, DriveLetter) Values (" & NextMediaID & ", " & MediaVolSN & ", 5, '" & MediaLabel  & "', '" & MediaLabel &"', 0, " & MediaDeviceID & ");")
          NextMediaID = Iter.StringByIndex(0)
        End If

        For i=0 to list.count-1 
          Set mySong = list.Item(i) 
          SDB.Database.ExecSQL("UPDATE Songs SET IDMedia = " & NextMediaID & " WHERE ID = " & mySong.ID & ";")

        Exit Sub

      End If

    End If


End Sub

With Scripts.ini:

Code: Select all


Posted: Tue Dec 20, 2005 8:20 am
by trixmoto
Looks good to me (although I'd have checked for selected tracks at the beginning). I suppose I'd better get working on the import script then! :)

Posted: Tue Dec 20, 2005 8:38 am
by Steegy
You're right, I changed it now. Thanks!