Get year from file name

Hi,

I´ve got a whole bunch of house livesets, all named artist @ title dd-mm-year.mp3, for example Armin van Buuren @ A State of Trance 322 01-04-2009.

How do I convert the year to the year-tag? I've got artist and title, but I can't find a way to tell Mp3tag to use the four digits before .mp3 as the year tag.

Steven

there are several ways.
first suggestion:
Use an action of the type format tag field with regular expression for YEAR and put as format string $right(%_filename%,4)
which takes the rightmost 4 characters and inserts then into year.

Or (second suggestion):
use "Filename - TAG" with a mask like
%dummy%-%year%
which wll put the year into YEAR and also create a tag dummy but that can be deleted afterwards.
The preview should show whether you reach your goal.

thanks, second one works!

Hmm, as I understand correctly what has been written above ...

ohrenkino's first suggestion is the simplest way to extract the rightmost four characters from the given filename sting (... but there is no need of handling a regular expression).
Action: Format value
Tagfield: YEAR
Value: right(%_FILENAME%,4)

Now I am curious how you got artist and title from the filename string.

DD.20100425.1414.CEST

simply: artist @ title :slight_smile:

Well it looks like, if you use this "artist @ title" as a format string, but it is not a well formed one.
And what action should I use together with this Format string?
To split ...
Armin van Buuren @ A State of Trance 322 01-04-2009.
Into separated tag fields Artist and Ttitle ...
Using format string ...
%artist% @ %title%

DD.20100426.2103.CEST
Edit.
DD.20100504.1545.CEST

the filename-to-tag function.. Or don't I understand your question? :wink:

Sorry Stefanovic ...

using the given filename:
Armin van Buuren @ A State of Trance 322 01-04-2009.

and using Convert/Filename to Tag with Format string:
artist @ title

... there is no way to fill any tag field.

Please give a short description what I have to do to get ...
ARTIST=Armin van Buuren
TITLE=A State of Trance 322
... ???

Thanks in advance.

DD.20100427.2004.CEST

Hi Stefanovic, is there any chance to get a helpful description from you how to solve this task?

How to split the filename into three parts and set tag fields accordingly?

Given filename:
Armin van Buuren @ A State of Trance 322 01-04-2009

Goal:
ARTIST=Armin van Buuren
TITLE=A State of Trance 322
YEAR=2009-04-01

DD.20100503.2005.CEST

first do filename to tag: artist @ title
This will make the tags:
artist = Armin van Buuren
and title = A State of Trance 322 01-04-2009

Then do %dummy%-%dummy%-%year% to get year = 2009.

I don't know how to do the entire date as a year.

Never mind, the Convert Dialogues could not help to solve the task in a straight manner.
But I have found a way to split the filename into three parts and to fill the related tag fields by using a $regexp() function, which prepares the filename string for easy splitting afterwards by the action "Guess values" (in german "Aktion Tag-Felder importieren").

From Filename:
Armin van Buuren @ A State of Trance 322 18-10-2007
To Tag Fields:
ARTIST=Armin van Buuren
TITLE=A State of Trance 322
YEAR=2007-10-18

Actiontype 7: Import tag fields (guess values)
Source format: $regexp(%_FILENAME%,'^(.+?)÷@÷(.+?)÷(\d\d)-(\d\d)-(\d\d\d\d)$','$1|$2|$5-$4-$3')
Guessing pattern: %ARTIST%|%TITLE%|%YEAR%
Note: Replace each special ÷ character with one space character.

DD.20100504.1429.CEST