Help - Search - Members - Calendar
Full Version: Help Using Export
Mp3tag Forums > Mp3tag - International > Development > Export
sparkman
Hi all,

I use a program called CDJ to play my music. It's used to control Sony CD jukeboxes and also plays mp3 files. It's fairly tightly integrated with all of my home automation systems, so changing to something else is not an option I want to consider. I'm getting rid of the jukeboxes, so am in the process of converting all of my CDs to mp3s. I'm storing my mp3s in a directory structure of folders for each artist with subfolders for each album. I'm trying to use mp3tag to export mp3 information to import into CDJ. CDJ stores its information in an Access database in two tables (Albums and Tracks). I've created the following export files to populate the tables:

Albums:
CODE
$loop(%_folderpath%,1)%artist%;%album%;%_total_files%;%_total_time_raw%;%artist% - %album%.jpg
$loopend()


Tracks:
CODE
$loop(%artist%)$loop(%album%)%artist%;%album%;%title%;$regexp(%track%,^(\d+)/\d+,$1);%_length_seconds%;%_path%;%genre%
$loopend()$loopend()


A fair amount of manual work remains to import this into CDJ as CDJ uses a unique identifier (called CDJID) that is a 16 character hex number. This identifier is unique to each Album and is also used in the Tracks table to match each track to its album. I have three questions:

1. Can I combine the two exports above into one that still creates two separate files (one called tracks.csv and one albums.csv)? If so, how do I do that?

2. Once I have the export combined into one, how can I generate a 16 char hex number that I can then use as a field in the album file and in the tracks file?

3. CDJ uses two fields for album and track lengths: minutes and seconds. Can I use scripting/regular expressions in the mp3tag export that takes the information in seconds and converts it into two values (minutes and remaining seconds)?

Thanks for any help.

Cheers
Al
Florian
Hi Al,

I was curious whether Mp3tag is able to accomplish that task so I tried it smile.gif

First of all, you can't create multiple export files from one export, but you can use multiple exports in mt_format.png Actions with the current Development Build. Everything that follows was done using this build.

To calculate the CDJID I've created a new export configuration Al-01-Create CDJID.mte which exports the first 16 characters of the MD5 sum of the first selected file
CODE
$filename(%artist%-%album%-CDJID.txt)$loop(%_folderpath%,1)$left(%_md5audio%,16)$loopend()


I've created a new action group named "Create CDJID" and added this export as action.

Since Export actions are always executed at the end of an action group, I've created a new action group named "Import CDJID and Export". I've added a new action Import text file using %artist%-%album%-CDJID.txt as file name and CDJID as field. This imports the content of the CDJID file to the CDJID custom tag field. In addition to the import action, I've added two export actions for the exports you've posted above. You have to modify them to use the %cdjid% field where necessary.

Now, first run the "Create CDJID" action group by choosing the entry from the drop down menu of the mt_format.png Actions toolbar button. Then run "Import CDJID and Export" to create the export files.

To answer your third question: You can use $div(%_length_seconds%,60) to get the minutes part and $mod(%_length_seconds%,60) to get the seconds part of the track length.

Hope this helps!

Florian
sparkman
Thanks Florian!

That helps a lot. The CDJIDs are being calculated, files are being created, etc. There was one minor issue though, the CDJID files were being created in the root directory (in my case Y:\music\), whereas the import was looking for them in the Y:\music\artist\album\ folder. Here's an example of an error message that occured:

Import text file "%artist%-%album%-CDJID.txt": CDJID: File Y:\music\3 Doors Down\Seventeen Days\3 Doors Down-Seventeen Days-CDJID.txt cannot be accessed.

I like that they're being created in the root, because that will make clean up much easier ;-), so I modified the Import Text File portion to have a filename of y:\music\%artist%-%album%-CDJID.txt. The only issue that remains is for cases where the album or artist name does not match the file names because of illegal characters (an example being AC/DC where the filename contains ACDC). Is there a way to fix that?

Thanks again for your help!

Cheers
Al


Looks like I found a solution myself by changing the import filename to y:\music\$validate(%artist%,)-$validate(%album%,)-CDJID.txt.

Thanks
Al
sparkman
Hi Florian,

I tried running the create CDJID portion against a large number of files (about 25000) and mp3tag died after a while. Below is the contents of the error log file. Is there a limit to how many files I should run this against at any one time?

Thanks
Al

CODE
=======================================================================
=========
Mp3tag v2.39o - 10.02.2008 - 15:37:52
--------------------------------------------------------------------------------
OS-Version: Windows XP Service Pack 2 (Build 2600)
--------------------------------------------------------------------------------
Build: Feb 9 2008 21:49:31
--------------------------------------------------------------------------------
AppPath: 19.724.034.048 Bytes frei (C:\Program Files\Mp3tag\)
DataPath: 19.724.034.048 Bytes frei (C:\Documents and Settings\AL\Application Data\Mp3tag\data\)
TempPath: 19.724.034.048 Bytes frei (C:\DOCUME~1\AL\LOCALS~1\Temp\Mp3tag v2.39o\)
================================================================================

--------------------------------------------------------------------------------
CATCH
--------------------------------------------------------------------------------
File: .\mtmainframe.cpp
Line: 1492
================================================================================

--------------------------------------------------------------------------------
CATCH
--------------------------------------------------------------------------------
File: .\mtfilelistctrl.cpp
Line: 1320
================================================================================
Florian
QUOTE (sparkman @ Feb 11 2008, 01:29) *
I tried running the create CDJID portion against a large number of files (about 25000) and mp3tag died after a while.
Seems like this failure was caused by an out-of-memory situation. There is no specific limit but I'd try smaller batches of files, e.g. 5000 at a time.

Kind regards,
Florian
sparkman
QUOTE (Florian @ Feb 10 2008, 23:07) *
Seems like this failure was caused by an out-of-memory situation. There is no specific limit but I'd try smaller batches of files, e.g. 5000 at a time.

Kind regards,
Florian


Thanks for all of your help Florian! I was able to do it in batches of up to about 8000 at a time.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.