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
> Filename to releasetime - a little help?
earbox
post Jan 9 2018, 18:53
Post #1


Member


Group: Members
Posts: 4
Joined: 1-July 13
Member No.: 18104
Mp3tag Version: 2.56



Hi, folks--forgive me my naivete, since I barely speak regex.

I have a lot of files--NPR stories, to be specific--where the filename begins with a 8-character string that is the release date in YYYYMMDD form. I'd like to create an action to insert this string into the releasetime field as MM/DD/YYYY so that I don't have to adjust each day's worth of files manually.

The filenames all look like this: 20171201_atc_the_disaster_artist_is_the_best_movie_about_a_bad_movie

Is this something that can be done? Thanks.
Go to the top of the page
 
+Quote Post
stevehero
post Jan 9 2018, 18:59
Post #2


Member


Group: Full Members
Posts: 855
Joined: 3-December 10
From: Ireland
Member No.: 13334
Mp3tag Version: 2.85k



Try
(Format action)
Format : RELEASETIME
$regexp(%_filename%,^([19|20]\d{2})(\d{2})(\d{2}).*,$2/$3/$1)

Or you could add this to a new column for easy sorting using (in the sort part of the new column ui)
$regexp(%_filename%,^([19|20]\d{2})(\d{2})(\d{2}).*,$2/$3/$1)

This post has been edited by stevehero: Jan 9 2018, 19:19


--------------------
Go to the top of the page
 
+Quote Post
ohrenkino
post Jan 9 2018, 19:07
Post #3


Member


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



ZITAT(earbox @ Jan 9 2018, 18:53) *
Hi, folks--forgive me my naivete, since I barely speak regex.

I have a lot of files--NPR stories, to be specific--where the filename begins with a 8-character string that is the release date in YYYYMMDD form. I'd like to create an action to insert this string into the releasetime field as MM/DD/YYYY so that I don't have to adjust each day's worth of files manually.

The filenames all look like this: 20171201_atc_the_disaster_artist_is_the_best_movie_about_a_bad_movie

Is this something that can be done? Thanks.

Actually, the field RELEASETIME has the format
yyyy-mm-ddThh:mm:ssZ
So a transformation into MM/DD/YYYY would create an invalid releasetime.
If you want to get it right, then proceed as follows:
Create an action group with several actions as follows:

Format value for RELEASETIME
Format string: $regexp(%_filename%,^(\d+).*,$1)
This imports the leading number from the filename into RELEASETIME

Then insert the separators and a dummy time at the end:
Format value for RELEASETIME
Format string: $regexp(%releasetime%,(\d\d\d\d)(\d\d)(\d\d),$1-$2-$3T00:00:00Z)



--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
earbox
post Jan 10 2018, 17:05
Post #4


Member


Group: Members
Posts: 4
Joined: 1-July 13
Member No.: 18104
Mp3tag Version: 2.56



Thank you both--I'll give those a try!
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: 21st January 2018 - 15:39