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
> Rename file only if extension matches (.Mp3, .Flac, etc)
LaurenBacall
post May 31 2012, 09:35
Post #1


Member


Group: Full Members
Posts: 13
Joined: 31-May 12
Member No.: 16524
Mp3tag Version: 2.51



I am in the process of setting up an Action for renaming recorded podcasts. Each podcast has two files: one lossless (FLAC) and one lossy (MP3).

I wish to rename the FLAC files differently than the MP3 files, so it's easier to differentiate between the lossless and lossy versions.

I found some RegEx on the forum that renames the files based on their creation date, but for the FLAC files I wanted to append the string '[original]' after the RegEx.

I don't personally have a knowledge of RegEx, but I do know that you can include conditional operators ('if'). Does anyone have an answer?

Eg:

MP3:
2012.05.31.mp3

FLAC:
2012.05.31 [original].flac



This post has been edited by LaurenBacall: May 31 2012, 09:37
Go to the top of the page
 
+Quote Post
DetlevD
post May 31 2012, 11:19
Post #2


Member


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



QUOTE (LaurenBacall @ May 31 2012, 10:35) *
I am in the process of setting up an Action for renaming recorded podcasts. Each podcast has two files: one lossless (FLAC) and one lossy (MP3). I wish to rename the FLAC files differently than the MP3 files ... for the FLAC files I wanted to append the string '[original]' after the RegEx.
Eg:
MP3:
2012.05.31.mp3
FLAC:
2012.05.31 [original].flac

You did not show the specific Regular Expression, you did talk about, so I assume there is no RegExp involved, but only basic Mp3tag scripting features.

If you want to apply an action to append some data to an existing tag-field content, then the following proposals may help.

1. Set Filter
"%_extension%" IS "FLAC"

2. Use Action
Action: Format value
Field: _FILENAME
Formatstring: %_filename%' [original]'

... or ...

1. Use Action
Action: Format value
Field: _FILENAME
Formatstring: $if($eql($lower(%_extension%),'flac'),%_filename%' [original]',%_filename%)
Because %_extension% returns always lower cased names this should work too ...
Formatstring: $if($eql(%_extension%,'flac'),%_filename%' [original]',%_filename%)

See also:
http://forums.mp3tag.de/index.php?showtopi...post&p=4109

DD.20120531.1218.CEST

This post has been edited by DetlevD: Jun 5 2012, 07:24


--------------------
* 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
LaurenBacall
post May 31 2012, 11:34
Post #3


Member


Group: Full Members
Posts: 13
Joined: 31-May 12
Member No.: 16524
Mp3tag Version: 2.51



QUOTE (DetlevD @ May 31 2012, 20:19) *
1. Use Action
Action: Format value
Field: _FILENAME
Formatstring: $if($eql($lower(%_extension%),'flac'),%_filename%' [original]',%_filename%)



Thanks so much, works a treat.

As for the Regular Expression, for anyone interested, this is what I'm using:

Action: Format value

Field:
_FILENAME

Format string:
$regexp(%_file_create_date%,(..)/(..)/(....),$3.$2.$1)


Edit: the above format string fails when the Day is a single digit, the following code works instead:

$regexp(%_file_create_date%,(\d\d?)/(\d\d?)/(\d\d\d\d),$3.$2.$1)

I'm working on a better solution, as using the File Creation Date timestamp is unreliable, it changes when the file is copied to a different location.

This post has been edited by LaurenBacall: Jun 1 2012, 07:50
Go to the top of the page
 
+Quote Post
DetlevD
post May 31 2012, 11:52
Post #4


Member


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



QUOTE (LaurenBacall @ May 31 2012, 12:34) *
Thanks so much, works a treat.
As for the Regular Expression, for anyone interested, this is what I'm using:
Action: Format value
Field: _FILENAME
Format string: $regexp(%_file_create_date%,(..)/(..)/(....),$3.$2.$1)

See also:
http://forums.mp3tag.de/index.php?showtopi...ost&p=50621

If you set your system's date time display according to ISO 8601, then you do not need to convert the file's creation date tíme, that means %_file_create_date% will return immediately '2012-05-31'.

DD.20120531.1252.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 September 2014 - 02:47