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
> Find date in the file name and change format, Date
Ken17
post Mar 27 2017, 11:35
Post #1


Member


Group: Full Members
Posts: 5
Joined: 27-March 17
Member No.: 23229
Mp3tag Version: 2.81



I have several thousand MP3 files of various radio shows in which the broadcast date is part of the filename. I would like include this date in the DATE field of the ID3v2.3 tag. The dates are all in in different positions of the filename - some are at the beginning, some in the end and others in the middle of the name. Is it possible to extrapolate those dates and copy them to the DATE field?

Also, how can I accurately change the format from dd.mm.yyyy to yyyy mm dd?

I found a previous topic (Format Date in File Name) from 2008 which discussed this, but I am unable to receive the desired results.

For instance, I created an Action to convert the date using the following regular expression:
QUOTE
Here is another one from MDY to YMD.
From "04.24.2008" to "2008.04.24" with

CODE
$regexp(%_date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

Based on the information provided in the thread mention above, I was under the impression it would change the date format from 08.24.1995 to 1995.08.24. However, nothing at all happens when I use that action.

Any tips would be very much appreciated.

Thanks!
Ken
Go to the top of the page
 
+Quote Post
ohrenkino
post Mar 27 2017, 11:40
Post #2


Member


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



ZITAT(Ken17 @ Mar 27 2017, 12:35) *
I have several thousand MP3 files of various radio shows in which the broadcast date is part of the filename. I would like include this date in the DATE field of the ID3v2.3 tag. The dates are all in in different positions of the filename - some are at the beginning, some in the end and others in the middle of the name. Is it possible to extrapolate those dates and copy them to the DATE field?

Also, how can I accurately change the format from dd.mm.yyyy to yyyy mm dd?

I found a previous topic (Format Date in File Name) from 2008 which discussed this, but I am unable to receive the desired results.

For instance, I created an Action to convert the date using the following regular expression:

QUELLTEXT
$regexp(%_date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

Based on the information provided in the thread mention above, I was under the impression it would change the date format from 08.24.1995 to 1995.08.24. However, nothing at all happens when I use that action.

Any tips would be very much appreciated.

Thanks!
Ken

Do you have a field %_date% or %date%?
The field %date% is only 4 digits long.

If you want to save the accurate date of a track, use %releasetime%

If the string is somewhere in the filename, use an action of the type "Guess values" where you cut off the undesired bits with %dummy%, e.g.

%dummy% - %releasetime% - %dummy%


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
Ken17
post Mar 27 2017, 14:28
Post #3


Member


Group: Full Members
Posts: 5
Joined: 27-March 17
Member No.: 23229
Mp3tag Version: 2.81



QUOTE (ohrenkino @ Mar 27 2017, 18:40) *
Do you have a field %_date% or %date%?
The field %date% is only 4 digits long.

If you want to save the accurate date of a track, use %releasetime%

If the string is somewhere in the filename, use an action of the type "Guess values" where you cut off the undesired bits with %dummy%, e.g.

%dummy% - %releasetime% - %dummy%


Thanks for the reply.

I was using field %date%. All the files that currently have any date entered in that field display the entire date - month, day, year. Not just 4 digits.

Nonetheless, I added dates to the %releasetime% field in a few different files and changed the action/reg exp accordingly to match that field, but the results are just the same. It doesn't change the format of the date. Would like to at least get that working before moving on to the "Guess values" issue.

Go to the top of the page
 
+Quote Post
ohrenkino
post Mar 27 2017, 15:35
Post #4


Member


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



You can use the function
Convert>Tag-Tag
for testing.
Enter as format string:
$regexp('08.24.1995',(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

and you see in the preview
"1995.08.24"
You can also test
$regexp(%date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

So check if the pattern in the field actually matches the pattern of the regular expression.
If there is no match, the the regular expression returns the search string.


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
Ken17
post Mar 27 2017, 15:56
Post #5


Member


Group: Full Members
Posts: 5
Joined: 27-March 17
Member No.: 23229
Mp3tag Version: 2.81



QUOTE (ohrenkino @ Mar 27 2017, 22:35) *
You can use the function
Convert>Tag-Tag
for testing.
Enter as format string:
$regexp('08.24.1995',(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

and you see in the preview
"1995.08.24"
You can also test
$regexp(%date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

So check if the pattern in the field actually matches the pattern of the regular expression.
If there is no match, the the regular expression returns the search string.


The Convert>Tag-Tag works to show the reformatted date in the preview.

However, the other regexp to actually change the dates in the files in question does nothing for me. Regardless if I attempt to use %date% or %releasetime%. The dates in both fields in my test file are precisely 08.24.1995, but they are not reformatted to the desired date format when running the action.
Go to the top of the page
 
+Quote Post
ohrenkino
post Mar 27 2017, 16:34
Post #6


Member


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



ZITAT(Ken17 @ Mar 27 2017, 16:56) *
The Convert>Tag-Tag works to show the reformatted date in the preview.

That is good as it shows that there is no syntax error in your local implementation.

ZITAT
However, the other regexp to actually change the dates in the files in question does nothing for me. Regardless if I attempt to use %date% or %releasetime%. ...

You have not yet showed us what kind of action you use for which field.
A "Format value" action assigns a value that is determined by the format string to a named field.
So e.g. to swap the date around in the field DATE, you have to create the action for that field (DATE).
Enter the format string that supplies the correct data, e.g. the one that you have seen that is working.
So an example would be:
Format value
Field: DATE
Format string: $regexp(%date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
Ken17
post Mar 27 2017, 17:13
Post #7


Member


Group: Full Members
Posts: 5
Joined: 27-March 17
Member No.: 23229
Mp3tag Version: 2.81



QUOTE (ohrenkino @ Mar 27 2017, 23:34) *
That is good as it shows that there is no syntax error in your local implementation.


You have not yet showed us what kind of action you use for which field.
A "Format value" action assigns a value that is determined by the format string to a named field.
So e.g. to swap the date around in the field DATE, you have to create the action for that field (DATE).
Enter the format string that supplies the correct data, e.g. the one that you have seen that is working.
So an example would be:
Format value
Field: DATE
Format string: $regexp(%date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)


Apparently I'm not explaining clearly what I'm trying to do and what I would like to happen.

I have a date field in a particular MP3 file. In this case, it is RELEASETIME and the date is entered in that field as 08.24.1995. I wish to reformat that date to: 1995.08.24.

I have tried using the Action command in a few different ways to make that happen. The first attempt was creating an Action type of "Replace with regular expression". The two different methods I tried were:

$regexp(%date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)
and
$regexp(%releasetime%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

I have now also tried an Action type of "Format value" as per your last reply. The two different methods I have tried for this are:

$regexp(%date%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)
and
$regexp(%releasetime%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

All of the above did nothing to change the actual format of the date shown in the RELEASETIME field.

And now I'm getting a bit confused myself. I had originally been trying to use the DATE field, but earlier you said it's limited to 4 digits (even though the version I'm using of MP3TAG allows me to enter the full date of month, day and year and I have 8 digits in my dates: 2 for month, 2 for day and 4 for year. However, in your replies you refer to DATE. So now I'm not sure if I'm supposed to be using DATE or RELEASETIME.

I hope I have explained more clearly now. I just wish there would be something that will actually work to change the formats in the date fields of these files from mm.dd.yyyy to yyyy.mm.dd.

Thank you!

Ken

This post has been edited by Ken17: Mar 27 2017, 17:27
Go to the top of the page
 
+Quote Post
poster
post Mar 27 2017, 17:48
Post #8


Member


Group: Full Members
Posts: 1430
Joined: 22-March 09
Member No.: 9241
Mp3tag Version: 2.85



ZITAT(Ken17 @ Mar 27 2017, 18:13) *
$regexp(%releasetime%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)

All of the above did nothing to change the actual format of the date shown in the RELEASETIME field.

I just tested ít and this format-string in an action of the type "Format Value" did exactly what you want to achieve.
Go to the top of the page
 
+Quote Post
ohrenkino
post Mar 27 2017, 18:30
Post #9


Member


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



RELEASETIME in its full beauty has the format yyyy.mm.ddTHH:MM:SS

A DATE field really has only four digits like 3112 for the last day in a year.
If you say that
ZITAT
2 for month, 2 for day and 4 for year

you leave out the dots which makes up for 10 characters in all. But perhaps you meant that.

If you use an action of the type "Replace with regular expression" then you can't use a format string but you have to enter a regular expression. The function $regexp() is a scripting function that emulates the action. So you had an evaluated regular expression in an action to replace with a regular expression. This will never lead to a reasonable result. I wonder where you entered the $regexp() in that action.


Please show us the contents and name of the field that you want to manipulate,
show us the exact action that you use with all its parameters.


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
Ken17
post Mar 28 2017, 03:57
Post #10


Member


Group: Full Members
Posts: 5
Joined: 27-March 17
Member No.: 23229
Mp3tag Version: 2.81



QUOTE (ohrenkino @ Mar 28 2017, 01:30) *
RELEASETIME in its full beauty has the format yyyy.mm.ddTHH:MM:SS

A DATE field really has only four digits like 3112 for the last day in a year.
If you say that

you leave out the dots which makes up for 10 characters in all. But perhaps you meant that.

If you use an action of the type "Replace with regular expression" then you can't use a format string but you have to enter a regular expression. The function $regexp() is a scripting function that emulates the action. So you had an evaluated regular expression in an action to replace with a regular expression. This will never lead to a reasonable result. I wonder where you entered the $regexp() in that action.


Please show us the contents and name of the field that you want to manipulate,
show us the exact action that you use with all its parameters.


I have started from zero in hopes I could get something to work. Created a new folder and added a few mp3 files that I wish to have the date reformatted.

Images have been created and linked in this post through each step I performed.

Initial date in RELEASETIME is: 08.24.1995




Next step was to create a new Action group. I call it ConvertDate.




Selected Format value as Action type




Within the Format value Action type, I chose RELEASETIME as the Field and for the Format string, entered:
$regexp(%releasetime%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)




The final action appears as:
Format value "RELEASETIME": $regexp(%releasetime%,(\d\d)\.(\d\d)\.(\d\d\d\d),$3.$1.$2)




After using that particular Action, a window appears stating:
Formatted tags in 1 of 1 files.
0 of 1 files renamed.




The end result is the RELEASETIME date which remains at: 08.24.1995. So, I don't know what tag the program is referring to when it states that 1 of 1 tags has been formatted because the only tag I am interested in being formatted stays exactly the same.

This post has been edited by Ken17: Mar 28 2017, 05:36
Go to the top of the page
 
+Quote Post
DetlevD
post Mar 28 2017, 05:50
Post #11


Member


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



QUOTE (Ken17 @ Mar 27 2017, 11:35) *
... the broadcast date is part of the filename. I would like include this date in the DATE field of the ID3v2.3 tag. The dates are all in in different positions of the filename - some are at the beginning, some in the end and others in the middle of the name. Is it possible to extrapolate those dates and copy them to the DATE field? ...

You can interactively check out how a formatstring works by applying the converter "Tag-Tag".

Field: TEST

Formatstring: $regexp(%_filename%,'^.*(\d{1,2})\.(\d{1,2})\.(\d{4}).*$','$3.$1.$2')
... when the given MDY date string is part of the filename.

Formatstring: $regexp(%RELEASETIME%,'^.*(\d{1,2})\.(\d{1,2})\.(\d{4}).*$','$3.$1.$2')
... when the given MDY date string is part of the tagfield RELEASETIME.

DD.20170328.0651.CEST

This post has been edited by DetlevD: Mar 28 2017, 05:51


--------------------
* 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
ohrenkino
post Mar 28 2017, 06:15
Post #12


Member


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



ZITAT(Ken17 @ Mar 28 2017, 04:57) *
... So, I don't know what tag the program is referring to when it states that 1 of 1 tags has been formatted because the only tag I am interested in being formatted stays exactly the same.

Have you checked the extended tags dialogue afterwards to check if another field has been created?

Also: what kind of tag versions are in the files? Only V1 and/or V2 or also APE?
What are your settings in respect to APE? These tags should get deleted and read but never be saved.

This post has been edited by ohrenkino: Mar 28 2017, 06:16


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
DetlevD
post Apr 21 2017, 12:55
Post #13


Member


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



QUOTE (ohrenkino @ Mar 27 2017, 19:30) *
RELEASETIME in its full beauty has the format yyyy.mm.ddTHH:MM:SS ...

Note: According to ISO 8601 international standard format ...
The datetime string in the tag field RELEASETIME can have the format ...
YYYY-MM-DDTHH:MM:SS

See also ...
https://en.wikipedia.org/wiki/ISO_8601
https://de.wikipedia.org/wiki/ISO_8601

DD.20170421.1355.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

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: 19th November 2017 - 20:41