Help - Search - Members - Calendar
Full Version: Need help for an action!
Mp3tag Forums > Mp3tag - International > Support
Hornhaut68
What I have to do, to delete all characters after the last ")" of the filename. For exemple:

Artist - Song (Song-addition) (Mix)lalalala to Artist - Song (Song-addition) (Mix)

or

Artist - Song (Mix)lalalala to Artist - Song (Mix)


Hope you can help me! tongue.gif biggrin.gif
dano
Use Convert > Tag - filename and enter

$regexp(%_filename%,'\)[^()]+$',')')
Hornhaut68
And that counts for any form of tags? I mean is this form is searching for the last ")"?

Very cool thank's, everthing works fine.

(I put this in an "Formate Tags" action, and it works fine. As I copy that into Mp3Tag there was a space there, I delete it,but I thought it was right, because it wasn't necessary, right?)
DetlevD
QUOTE (Hornhaut68 @ Apr 4 2012, 20:24) *
What I have to do, to delete all characters after the last ")" of the filename. ...

Action: Format value
Field: _FILENAME
Formatstring:
$left(%_filename%,$strrchr(%_filename%,')'))

... or ...


Convert | Tag - Filename | ALT+1

Select format string

Format string:
$left(%_filename%,$strrchr(%_filename%,')'))

Preview
Artist - Song (Song-addition) (Mix).mp3


... or ...


Convert | Tag - Tag | ALT+5

Select format string

Field:
_FILENAME

Format string:
$left(%_FILENAME%,$strrchr(%_FILENAME%,')'))

Preview
Artist - Song (Song-addition) (Mix)


DD.20120405.1658.CEST
Hornhaut68
So, I thoguht about that, and that what I really need is, that everthing after the second or fourth ")" will be delete, but that MP3Tag will search for that, if there's fourth closed bracket, it will delete that which will follow, but if not he delte everthing after the second closed bracket, is this possible?

(I just saw, that the last action [$left(%_filename%,$strrchr(%_filename%,')'))] above will delete all information out of the filename if theres is no bracket in it. The first one [$regexp(%_filename%,'\)[^()]+$',')')] act like the same above, but don't delete everything out of the filename if there's not a bracket in it.)

(All two actions worked fine, but there's a solution for the "problem" above, please tell me. tongue.gif biggrin.gif)
DetlevD
QUOTE (Hornhaut68 @ Apr 6 2012, 11:20) *
...I just saw, that the last action [$left(%_filename%,$strrchr(%_filename%,')'))] above will delete all information out of the filename if theres is no bracket in it. ...

Hm, yes, you are responsible for selecting the appropriate file name before applying the formula.
You can filter the view by a filter expression like this ...
"%_FILENAME%" HAS ")"

QUOTE (Hornhaut68 @ Apr 6 2012, 11:20) *
So, I thoguht about that, and that what I really need is, that everthing after the second or fourth ")" will be delete, but that MP3Tag will search for that, if there's fourth closed bracket, it will delete that which will follow, but if not he delte everthing after the second closed bracket, is this possible? ...

This is a new requirement?

Filter expression for two groups of opening and closing round brackets...
"%_FILENAME%" MATCHES "^[^()]*\([^()]*?\)[^()]*\([^()]*?\)[^()]*$"
... or ...
"%_FILENAME%" MATCHES "^(?:[^()]*\([^()]*?\)){2,2}[^()]*$"
... or ...
"%_FILENAME%" MATCHES "^(?:[^()]*\([^()]*?\)[^()]*){2,2}$"

Filter expression for four groups of opening and closing round brackets...
"%_FILENAME%" MATCHES "^[^()]*\([^()]*?\)[^()]*\([^()]*?\)[^()]*\([^()]*?\)[^()]*\([^()]*?\)[^()]*$"
... or ...
"%_FILENAME%" MATCHES "^(?:[^()]*\([^()]*?\)){4,4}[^()]*$"
... or ...
"%_FILENAME%" MATCHES "^(?:[^()]*\([^()]*?\)[^()]*){4,4}$"

DD.20120406.1230.CEST
Hornhaut68
Ok, thank's for all that actions, I'll try and choose that one which works best.
ohrenkino
ZITAT(Hornhaut68 @ Apr 6 2012, 12:17) *
Ok, thank's for all that actions, I'll try and choose that one which works best.

I'd still say that the best procedure would be to apply the converter filename-filename instead of insisting on an action.
But this has been described exhaustively in
http://forums.mp3tag.de/index.php?showtopi...amp;#entry62939
(the German thread where you asked the same question).
Using that converter plus the filter
%_filename% HAS ")"
would save you the bother of catering for various amounts of bracket pairs.
But everyone may do as he pleases.
DetlevD
QUOTE (Hornhaut68 @ Apr 6 2012, 12:17) *
Ok, thank's for all that actions, I'll try and choose that one which works best.

I would say ... the smartest proposal has been done by dano (see above in this thread) ...
Use Convert > Tag - filename and enter ...
$regexp(%_filename%,'\)[^()]+$',')')

... and maybe this will work too, just for the case when the last character is the closing round bracket ...
$regexp(%_filename%,'\)[^()]*$',')')

If you want to solve the problem using basic scripting functions, then this complicated looking expression will do it too.
$reverse($cutLeft($reverse(%_filename%),$sub($strchr($reverse(%_filename%),')'),1)))

DD.20120406.1740.CEST
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.