IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Unique Album Category ID
necrosis
post May 29 2011, 07:45
Post #1


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



Hi everyone!

I have been working on getting my script up and running , but cant seem to figure out how to give an album an unique ID number.

The script i have so far:

CODE
$loop(%_folderpath%)%title%;$ifgreater($strstr($lower($get(memdirectory)),$lower(%_directory%)),0,test($get(memcounter)),$put(memcounter,%_counter%));$puts(memdirectory,%_directory%);


I use $strstr($lower($get(memdirectory)),$lower(%_directory%)) to compare the current directory with the previous directory (memdirectory) and determine if this is true (1) or untrue (0).

I cannot figure this out and have been working 6 hours on it......

This is what i would like to accomplish, but i guess i am just to stupid to figure it out...



I hope some of you code wizards can help me out blink.gif
Go to the top of the page
 
+Quote Post
DetlevD
post May 29 2011, 09:31
Post #2


Member


Group: Full Members
Posts: 4796
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.61d



QUOTE (necrosis @ May 29 2011, 08:45) *
... I have been working on getting my script up and running , but cant seem to figure out how to give an album an unique ID number. ...

Hi 'necrosis', please can you elaborate what you want to achieve?
What it the reason and what is the goal of your scripting efforts?
Do you need a simple running counter number per album in a small set of albums?
Do you need a worlwide everlasting unique id (GUID) per album?

DD.20110529.1032.CEST


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
necrosis
post May 29 2011, 14:04
Post #3


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



QUOTE (DetlevD @ May 29 2011, 10:31) *
Hi 'necrosis', please can you elaborate what you want to achieve?
What it the reason and what is the goal of your scripting efforts?
Do you need a simple running counter number per album in a small set of albums?
Do you need a worlwide everlasting unique id (GUID) per album?

DD.20110529.1032.CEST


Hi DetlevD

Thank you for your quick response. Because i have so many music, I want to organize and import my complete mp3 collection within a webbased collection tool. Then i want to link this to (for example XBMC), and listen to my music when en where i want.

For this to work i need to create a CateroryID and a ProductID (Those are just the field names the tool uses).

Please take a look at my screenshot, where I circled the red parts in what i despreately try to achieve:

The script needs to generate, for each directory (Albums) and sub directory's, an unique CategoryID number (not need to be worldwide unique, just within the tool). Within these directory's (CategoryID) are MP3 songs. These need to get an unique ProductID according to the CategoryID. My idea to keep it simple is to just append *.1, *.2 etc..

So for example my screenshot. The first album from the top gets an unique CatalogID numer 1 and a unique ProductID for song 1 => 1.1 and song2 =>1.2

I hope this makes things more clear?

Thank you for all your help, as i cant seem to figure things out!

This post has been edited by necrosis: May 29 2011, 14:34
Go to the top of the page
 
+Quote Post
DetlevD
post May 29 2011, 15:35
Post #4


Member


Group: Full Members
Posts: 4796
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.61d



QUOTE (necrosis @ May 29 2011, 15:04) *
... I want to organize and import my complete mp3 collection within a webbased collection tool.
For this to work i need to create a CateroryID and a"ProductID" (Those are just the field names the tool uses. ... generate for each directory (and sub directory's) an unique ID number (not need to be worldwide unique, just within the tool). Within these directory's are MP3 songs. These need to get an unique ProductID according to the CategoryID (it just append*.1, *.2 etc..) ...

As I understand the situation ...
- You speak of CatalogID, CategoryID, ProductID, so CatalogID and CategoryID are used as synonyms?
- Does the CategoryID have the importance of Genre or other musical classification? Or is it in your case of application just the same as the folderpath?
- The ProductID is needed per track? You want to create the PRoductID simply by appending a running number to the CategoryID?
- Does it be true, that all IDs are not visible to the user, must not be human readable, and are only used internally by the database?

I recommend to use a GUID as ProductID per track and a GUID per Album as CategoryID.
GUIDs can be created rather easy.
See also ...
http://forums.mp3tag.de/index.php?showtopi...ost&p=52341
Once the GUID list file has been created, the converter Textfile - Tag can import the GUIDs into the tracks.

If you want to create your own running number based routine, then you may play with the following MTE export script to understand how to code a $loop() ... $loopend() structure and how to use %_counter% placeholder.
Be aware that the Mp3tag Export Scripting Language does not support to $get() a $put() variable within a loop, which has been defined outside of the loop.

$filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.txt',ANSI)
$loop(%_folderpath%,1)$loopend()'1: All FolderCount = '%_max_counter%
$loop(%_path%)$loopend()'2: All FileCount = '%_max_counter%
$repeat('=',50)
$loop(%_folderpath%,1)
'3: FolderNumber = '%_counter%
'4: FolderPath = '%_folderpath%
$loop(%_path%)$loopend()'5: FileCount = '%_max_counter%
$loop(%_path%)
'6: FileNumber = '%_counter%
'7: FilePath = '%_path%
$loopend()$repeat('-',50)
$loopend()


DD.20110529.1637.CEST

This post has been edited by DetlevD: May 29 2011, 15:36


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
necrosis
post Jun 2 2011, 03:33
Post #5


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



QUOTE (DetlevD @ May 29 2011, 16:35) *
As I understand the situation ...
- You speak of CatalogID, CategoryID, ProductID, so CatalogID and CategoryID are used as synonyms?
- Does the CategoryID have the importance of Genre or other musical classification? Or is it in your case of application just the same as the folderpath?
- The ProductID is needed per track? You want to create the PRoductID simply by appending a running number to the CategoryID?
- Does it be true, that all IDs are not visible to the user, must not be human readable, and are only used internally by the database?

I recommend to use a GUID as ProductID per track and a GUID per Album as CategoryID.
GUIDs can be created rather easy.
See also ...
http://forums.mp3tag.de/index.php?showtopi...ost&p=52341
Once the GUID list file has been created, the converter Textfile - Tag can import the GUIDs into the tracks.

If you want to create your own running number based routine, then you may play with the following MTE export script to understand how to code a $loop() ... $loopend() structure and how to use %_counter% placeholder.
Be aware that the Mp3tag Export Scripting Language does not support to $get() a $put() variable within a loop, which has been defined outside of the loop.

$filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.txt',ANSI)
$loop(%_folderpath%,1)$loopend()'1: All FolderCount = '%_max_counter%
$loop(%_path%)$loopend()'2: All FileCount = '%_max_counter%
$repeat('=',50)
$loop(%_folderpath%,1)
'3: FolderNumber = '%_counter%
'4: FolderPath = '%_folderpath%
$loop(%_path%)$loopend()'5: FileCount = '%_max_counter%
$loop(%_path%)
'6: FileNumber = '%_counter%
'7: FilePath = '%_path%
$loopend()$repeat('-',50)
$loopend()


DD.20110529.1637.CEST


Wow!! Thank you for your response, this helped me a great deal in getting me going :-)

Is it also possible to get the CATEGORYID (see screenshot) within every row?

Now you first loop the CATEGORYID and then loop the PRODUCTID. I tried again for one day now to get the CATEGORYID listed in the same row as the PRODUCTID.

The output right now is like this:


1: All FolderCount = 7
2: All FileCount = 20
==================================================

3: FolderNumber = 1
4: FolderPath = \\Africa_HiTech-Out_In_The_Streets-(WAP315DV)-WEB-2011-KOUALA\
5: FileCount = 1

6: FileNumber = 1
7: FilePath = \\Africa_HiTech-Out_In_The_Streets-(WAP315DV)-WEB-2011-KOUALA\01-africa_hitech-out_in_the_streets-kouala.mp3
--------------------------------------------------

3: FolderNumber = 2
4: FolderPath = \\Appleblim_And_October-NY_Fizzzzz-(PLATTER001)-WEB-2011-320\
5: FileCount = 2

6: FileNumber = 1
7: FilePath = \\Appleblim_And_October-NY_Fizzzzz-(PLATTER001)-WEB-2011-320\01-appleblim_and_october-ny_fizzzzz.mp3

6: FileNumber = 2
7: FilePath = \\Appleblim_And_October-NY_Fizzzzz-(PLATTER001)-WEB-2011-320\02-appleblim_and_october-fountains_of_paradise.mp3
--------------------------------------------------


But what i try to achieve is


1: All FolderCount = 7
2: All FileCount = 20
==================================================

3: FolderNumber = 1
4: FolderPath = \\Africa_HiTech-Out_In_The_Streets-(WAP315DV)-WEB-2011-KOUALA\
5: FileCount = 1

3: FolderNumber = 1
6: FileNumber = 1
7: FilePath = \\Africa_HiTech-Out_In_The_Streets-(WAP315DV)-WEB-2011-KOUALA\01-africa_hitech-out_in_the_streets-kouala.mp3
5: FileCount = 1
--------------------------------------------------

3: FolderNumber = 2
4: FolderPath = \\Appleblim_And_October-NY_Fizzzzz-(PLATTER001)-WEB-2011-320\
5: FileCount = 2

3: FolderNumber = 2
6: FileNumber = 1
7: FilePath = \\Appleblim_And_October-NY_Fizzzzz-(PLATTER001)-WEB-2011-320\01-appleblim_and_october-ny_fizzzzz.mp3
5: FileCount = 2

3: FolderNumber = 2
6: FileNumber = 2
7: FilePath = \\Appleblim_And_October-NY_Fizzzzz-(PLATTER001)-WEB-2011-320\02-appleblim_and_october-fountains_of_paradise.mp3
5: FileCount = 2
--------------------------------------------------



I feel so stupid that i cant accomplish this. If i could just use my variables outside the loops my problems would all be solved.. Hope you can help!

Thanks for any response from you coding wizards!

This post has been edited by necrosis: Jun 2 2011, 03:39
Go to the top of the page
 
+Quote Post
DetlevD
post Jun 2 2011, 07:51
Post #6


Member


Group: Full Members
Posts: 4796
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.61d



QUOTE (necrosis @ Jun 2 2011, 04:33) *
Wow!! Thank you for your response, this helped me a great deal in getting me going :-) ...
Is it also possible to get the CATEGORYID (see screenshot) within every row?
Now you first loop the CATEGORYID and then loop the PRODUCTID.
I tried again for one day now to get the CATEGORYID listed in the same row as the PRODUCTID. ... I feel so stupid that i cant accomplish this.
If i could just use my variables outside the loops my problems would all be solved. ...

There are restrictions in the Mp3tag Export Scripting Language, I have pointed out.
I assume that it is necessary to create some custom tag-fields, which you fill with the correct values ​​in order to use them in an export. After exporting you can delete the custom tag-fields.

Or write two export scripts, which creates text data files for both cases, with the proper values in order to load the values back into the files into the tag-fields using converter 'Textfile - Tag'.

Proove your concept of numbering with a serial number.
Once you have to insert a new item into the set, you have to renumber the complete set.
This is inefficient.

DD.20110602.0914.CEST


I have pity with you, so I wrote a Mp3tag MTE export script, which generates a VBScript VBS command file, which generates a CSV text file, which can be used as input for the Mp3tag converter 'Textfile- Tag' to set a serial number for each folder and within each folder for each file.

Attached File  20110602.Export_VBS_SerialNumber.mte ( 5.6K ) Number of downloads: 113


DD.20110602.1234.CEST

This post has been edited by DetlevD: Jun 2 2011, 11:45


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
necrosis
post Jun 2 2011, 15:23
Post #7


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



QUOTE (DetlevD @ Jun 2 2011, 08:51) *
There are restrictions in the Mp3tag Export Scripting Language, I have pointed out.
I assume that it is necessary to create some custom tag-fields, which you fill with the correct values ​​in order to use them in an export. After exporting you can delete the custom tag-fields.

Or write two export scripts, which creates text data files for both cases, with the proper values in order to load the values back into the files into the tag-fields using converter 'Textfile - Tag'.

Proove your concept of numbering with a serial number.
Once you have to insert a new item into the set, you have to renumber the complete set.
This is inefficient.

DD.20110602.0914.CEST


I have pity with you, so I wrote a Mp3tag MTE export script, which generates a VBScript VBS command file, which generates a CSV text file, which can be used as input for the Mp3tag converter 'Textfile- Tag' to set a serial number for each folder and within each folder for each file.

Attached File  20110602.Export_VBS_SerialNumber.mte ( 5.6K ) Number of downloads: 113


DD.20110602.1234.CEST


I am lost with words on the way you help people with their problems.. This is really fantastic, thank you so much for helping me out on my quest to get my export right and working!

Creating some custom tag fields is no problem as long as i don't overwrite the original source file (MP3). I also thought about the two text files option, but wouldn't know where to begin...

The .vbs option didn't even come to mind......

The mp3tag generation of the vbs works fine, but when i click on the .vbs to execute i get an Windows Script Host error? Am i missing something or doing something wrong here?




Go to the top of the page
 
+Quote Post
necrosis
post Jun 2 2011, 15:41
Post #8


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



QUOTE (necrosis @ Jun 2 2011, 16:23) *
I am lost with words on the way you help people with their problems.. This is really fantastic, thank you so much for helping me out on my quest to get my export right and working!

Creating some custom tag fields is no problem as long as i don't overwrite the original source file (MP3). I also thought about the two text files option, but wouldn't know where to begin...

The .vbs option didn't even come to mind......

The mp3tag generation of the vbs works fine, but when i click on the .vbs to execute i get an Windows Script Host error? Am i missing something or doing something wrong here?



I got the script working smile.gif Changed UTF-8 to ANSI and then it exports the txt file.

Now on to figuring out the rest biggrin.gif
Go to the top of the page
 
+Quote Post
necrosis
post Jun 3 2011, 17:05
Post #9


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



QUOTE (necrosis @ Jun 2 2011, 16:41) *
I got the script working smile.gif Changed UTF-8 to ANSI and then it exports the txt file.

Now on to figuring out the rest biggrin.gif


Thanks to your help i got everything almost ready for processing :-D Without your help i wouldn't have come this far in a million years! Your examples really given me a boost in understanding MP3TAG its possibilities and limitations.

I still have two mayor problem left where i have spend the night on trying to solve (yes again now the fourth day in a row...). Seems like i can't tackle these problems so any help is REALLY appreciated!

First problem i am facing:

Is the extraction/renaming of mp3 files, here a couple of example files:

Cameo-1xtra_Showcase_Live_on_Radio_1_(Jason_Kaye_Guestmix)-CABLE-05-22-2011-uC
3rd_Party-3RD02-noise_factory-1992-sour
Dillinja_-_Cybotron-Retail_CD-2001-BOSS_INT
Refresh-Your_Skills_Once_In_A_While_By_Pressing_Buttons-2011-404
VA-Hardware_XV-15_Years_Of_Renegade_Hardware-(HWAREXVCD1)-3CD-2011-hM
VA-Legendary_Sounds_Volume_1-RIVETCD21-2005-PiCKLE_iNT
VA-MOS_The_Mash_Up_Mix_Bass__Mixed_By_The_Cut_Up_Boys-2CD-2011-BPM
Kromestar-Bonafied_Hustlahz-(DPH003)-Vinyl-2010-BNP
white_label-unknown_artist-bw001-(200x)-sour

Basically remove the last part (which can consist out of character and or number) but is not allways present to should check, remove the year and encapsulation (always written as 4 numbers or three numbers and any character e.g. 200x, sometimes accompanied bij encapsulation e.g. (1999)

Secondly i would really like to copy the ALBUM ID's to a separate tag field %albumsort%. These ID's are currently not in the Tag fields, but only in the directory name sad.gif
This are ID's like (DPH003), 3RD02 or RIVETCD21). These album ID's are always formatted like this e.g. Any word character times * followed bij two or 3 numbers =>DPH003
Sometimes they are encapsulated bij () and sometimes bij spaces or the - signs.
It would be visually nice to give each first character a YUppercase and the ALBUM ID all uppercases.

When done i would be ecstatic if the result will show:

Cameo-1xtra_Showcase_Live_on_Radio_1_(Jason_Kaye_Guestmix)
3rd_Party-3RD02-noise_factory
Dillinja_-_Cybotron-Retail_CD
Refresh-Your_Skills_Once_In_A_While_By_Pressing_Buttons
VA-Hardware_XV-15_Years_Of_Renegade_Hardware-(HWAREXVCD1)-3CD
VA-Legendary_Sounds_Volume_1-RIVETCD21
VA-MOS_The_Mash_Up_Mix_Bass__Mixed_By_The_Cut_Up_Boys-2CD
Kromestar-Bonafied_Hustlahz-(DPH003)
White_Label-Unknown_Artist-BW001

And be presented cleanly in the output like:

Cameo - 1xtra Showcase Live on Radio 1 - (Jason Kaye Guestmix)
3rd Party - Noise_Factory - 3RD02
Dillinja - Cybotron - Retail CD
Refresh - Your Skills Once In A While By Pressing Buttons
VA - Hardware XV - 15 Years Of Renegade Hardware - HWAREXVCD1 - 3CD
VA - Legendary Sounds Volume 1 - RIVETCD21
VA - MOS The Mash Up Mix Bass - Mixed By The Cut Up Boys - 2CD
Kromestar - Bonafied Hustlahz - DPH003
White Label - Unknown Artist - BW001

Second Problem

Second problem im facing is that when i add new songs to my library and run your awesome vbs script again, everything gets renumbered.... Is there a way to only update new and or changed songs? I thought of using filters? but i don't know if that is the best way to approach this? Maybe store the last catergoryid and productid in a text file and go from there?

And that's about it....... Not your everyday problem around here i guess... I feel so stupid that i cant solve these (even after two nights of coding).

Thank you all for any help you can give me in trying to solve my technically challenged questions smile.gif

This post has been edited by necrosis: Jun 3 2011, 17:23
Go to the top of the page
 
+Quote Post
ohrenkino
post Jun 3 2011, 18:18
Post #10


Member


Group: Full Members
Posts: 4382
Joined: 9-December 09
From: Norddeutschland / Northern Germany
Member No.: 11458
Mp3tag Version: 2.61d



ZITAT(necrosis @ Jun 3 2011, 18:05) *
First problem i am facing:
Cameo-1xtra_Showcase_Live_on_Radio_1_(Jason_Kaye_Guestmix)-CABLE-05-22-2011-uC

If data is as wildly structured as this, I would always use filters to see whether any wildcard action really hits the files I want to manipulate.
If I have a look at the examples it looks like the following pattern to me:

<data>-<data>_<data>-<garbage>
So any string you want to chop off the end from has the pattern
underscore<data>hyphen<garbage>.
A filter with
%_filename% MATCHES ".*-.*_.*-.*"
should filter all those that still have a hyphen<garbage> at the end.
Then you could perform a replace with regular expression action to chop off the end until you are left with no other hypen than the starting one.

One problem that you have to solve for yourself is the wish to in some cases keep data at the end
ZITAT
VA-Hardware_XV-15_Years_Of_Renegade_Hardware-(HWAREXVCD1)-3CD-2011-hM
...
VA - Hardware XV - 15 Years Of Renegade Hardware - HWAREXVCD1 - 3CD

and sometimes not.
Also the change places bit in
ZITAT
3rd_Party-3RD02-noise_factory-1992-sour
....
3rd Party - Noise_Factory - 3RD02

requires a lot of clairvoyance by a program/script...


--------------------
42 - wie war die Frage / what was the question / comment était la question
Go to the top of the page
 
+Quote Post
necrosis
post Jun 11 2011, 03:01
Post #11


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



Thanks for your reaction smile.gif

I have done some serious diggin on ReEx and written a script to do most of what i need!

\b[\d0-9]?([a-z]{2,}?[\d0-9]{2,}?|[a-z]{2,}?[\d0-9]+[a-z]+|[a-z]{4,}?[\d0-9]+|[a-z]{2,}?[\d0-9]{2,}?|[\d0-9]+[a-z][\d0-9]+|[\d0-9]{5,})\b

9 times out of 10 it filters out the Album ID:

VA-Points_in_Time_007-(GLRPIT007)-CD1-2000-CT_INT
XL_Recordings-XLS24CD-SL2-1991-sour

It picks up GLRPIT007 and also XLS24CD.

I have searched everywhere, but how can use this regex and manage to match these within a directory field and put this in a custom Field? I only see the replace function within mp3tag?
Go to the top of the page
 
+Quote Post
necrosis
post Jun 13 2011, 15:37
Post #12


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



Anybody has knowledge on this?

I have turned to Visual Basic as i believe it is not possible within MP3TAG....
Go to the top of the page
 
+Quote Post
dano
post Jun 13 2011, 16:24
Post #13


Moderator


Group: Moderators
Posts: 5680
Joined: 4-September 03
From: Germany
Member No.: 201
Mp3tag Version: 2.61d



Take a look at the Actions (Alt+5)
Format value with $regexp() function and Replace with regular expression can be used.


--------------------
Go to the top of the page
 
+Quote Post
necrosis
post Jun 13 2011, 16:42
Post #14


Member


Group: Full Members
Posts: 9
Joined: 29-May 11
Member No.: 14556
Mp3tag Version: 2.49



QUOTE (dano @ Jun 13 2011, 17:24) *
Take a look at the Actions (Alt+5)
Format value with $regexp() function and Replace with regular expression can be used.


Hi Dano,

Thank you for your response. I looked at that, but i cant seem to figure out how to do this. I do not want to replace anything i just want to match the Albumid within the Directory and place this match in a tag field? Could you please help me? I looked all around the forum and couldn't find any topic related to my problem.

This post has been edited by necrosis: Jun 13 2011, 16:44
Go to the top of the page
 
+Quote Post
dano
post Jun 13 2011, 17:43
Post #15


Moderator


Group: Moderators
Posts: 5680
Joined: 4-September 03
From: Germany
Member No.: 201
Mp3tag Version: 2.61d



Ok this one seems best:

Action type: Guess values
Source format: $regexp(%_directory%,'\b\d?([a-z]{2,}?\d{2,}?|[a-z]{2,}?\d+[a-z]+|[a-z]{4,}?\d+|[a-z]{2,}?\d{2,}?|\d+[a-z]\d+|\d{5,})\b',~~~$1~~~,1)
Guessing pattern: %dummy%~~~%albumsort%~~~%dummy%

* I shortened [\d0-9] to \d


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 25th July 2014 - 20:57