Help - Search - Members - Calendar
Full Version: I need help changing album names from "451 # Back in the USA" to
Mp3tag Forums > Mp3tag - International > General Discussion
Marcabove
"Back in the USA (No. 451)". I know that this is done with regular expression but they whip me.

Thanks
DetlevD
QUOTE (Marcabove @ Jan 29 2012, 15:25) *
I need help changing album names from "451 # Back in the USA" to "Back in the USA (No. 451)". I know that this is done with regular expression but they whip me.Thanks

Filter:
ALBUM MATCHES "^(\d+)\s+#\s+(.+?)$"

Action: Format value
Field: ALBUM
Formatstring: $regexp(%ALBUM%,'^(\d+)\s+#\s+(.+?)$','$2 (No. $1)')

DD.20120129.1557.CET
Marcabove
Thanks!
Marcabove
Is there a source that explains regular expression in an understandable way? Most have lots of explanation but few examples. I really hate to ask for help with these but they just don't click for me.

Thanks
Marcabove
If I understand this I can also use this to do the same thing but with folder names also? If the folder is formatted "448) Cheap Trick ~ In Color (1977)" and the album is only "In Color" I can extract the "448)" and make the album name "In Color (No. 448).
ohrenkino
ZITAT(Marcabove @ Jan 31 2012, 22:52) *
If I understand this I can also use this to do the same thing but with folder names also? If the folder is formatted "448) Cheap Trick ~ In Color (1977)" and the album is only "In Color" I can extract the "448)" and make the album name "In Color (No. 448).

If you have the correct information in the tags why don't you use the converter "Tag - Filename"?
DetlevD
QUOTE (Marcabove @ Jan 31 2012, 22:52) *
If I understand this I can also use this to do the same thing but with folder names also? If the folder is formatted "448) Cheap Trick ~ In Color (1977)" and the album is only "In Color" I can extract the "448)" and make the album name "In Color (No. 448).

Yes, if you understand this, you can.

Filter:
"%_directory%" MATCHES "^(\d+)\)\s+(.+?)\s+~\s+(.+?)\s+\((\d+)\)$"

Action: Format value
Field: ALBUM
Formatstring: $regexp(%_directory%,'^(\d+)\)\s+(.+?)\s+~\s+(.+?)\s+\((\d+)\)$','$3 (No. $1)')

Keep in mind, that renaming a folder is not only the process of giving the thing a new name, but it can result into a moving of the folder to another place in the file system. I rate this as a critical action and one must be careful what to do.

As user 'ohrenkino' said in this thread, for the long shot, it would come in handy, that all relevant data are stored within the media file in tag-fields.

Once this situation has been created ...

"448" ... put into ... CATALOG_ID
"Cheap Trick" ... put into ... ARTIST
"In Color" ... put into ... ALBUM
"1977" ... put into ... RELEASEDATE or maybe YEAR

.. then the renaming resp. moving of the folder can be done this way ...

1. Probably there is no need to apply a filter.
2. Apply an action "Format value".
Field: _DIRECTORY
Formatstring : %ALBUM%' (No. '%CATALOG_ID%')'

.. that's it.

How to get data from filename or foldername and put it into the tag-fields within the media file?

Use Mp3tag converter "Filename - Tag".
This converter can handle the names of folders or directories too, when formatting a mask, that represents a path string.

Fill the edit field with this format mask (each literal character is taken as is, no scripting functions allowed) ...

%CATALOG_ID%) %ARTIST% ~ %ALBUM% (%YEAR%)\%DUMMY%

... then the converter preview shows ...

CATALOG_ID 448
ARTIST Cheap Trick
ALBUM In Color
YEAR 1977


In this example the format mask represents the filesystem path situation of "folder\filename".
The placeholder %DUMMY% stands here for the filename, and discards the filename.
But the filename can be disassembled the same way by applying an appropriate format mask.

DD.20120202.0820.CET
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.