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
> Removing text, remove part of file name that isn't consistent
RayH
post Sep 8 2011, 06:56
Post #1


Member


Group: Members
Posts: 2
Joined: 29-July 11
Member No.: 14969
Mp3tag Version: 2.49



I want to remove a part of the file name per the below example:

file name is "anita baker - rapture.mp3" or "john legend - ordinary people.mp3"

I want a script to remove everything up to and including the "-" in all file names so all the file names just have a space before the artist name (inserting track number with another macro).

I can't find out to do this because there are no certain number of characters. I could do replace for each artist, but I have to type in each artist's name. Is there an easier way?

Please email response to "raybharrell@gmail.com"
Go to the top of the page
 
+Quote Post
stevehero
post Sep 8 2011, 07:31
Post #2


Member


Group: Full Members
Posts: 416
Joined: 3-December 10
From: Ireland
Member No.: 13334
Mp3tag Version: 2.55a



QUOTE (RayH @ Sep 8 2011, 06:56) *
Please email response to "raybharrell@gmail.com"

I don't think you should put this in any future posts. This is a forum after all and other people may need this info.

To change
anita baker - rapture.mp3
To
rapture.mp3

Action type: Replace with regular expression
Field: _FILENAME
Regular expression: ^(.+-\s)(.+)
Replace matches with: $2
[ ] case-sensitive comparison

How it works
I've attached a screen shot of the regexp. On the top half you'll see "^" which anchors it to the very start of the text and "()" with stuff inbetween those. Basically they capture whatevers inside them. So the return is $2 which in-cases what you need. But for example you COULD say $1 which would return "anita baker - " instead of "rapture.mp3"
Attached thumbnail(s)
Attached Image
 


--------------------
I singing Dubstep ♪♫WOOB WOOB WOOB WOOB UBB OHMOMOMO DROP WOOOOOOB WOOB WOOB WOOB WUB WUB WUB WUB WUB WUB WUB WUB MOMOMO WOOB WOOB♫♪
Go to the top of the page
 
+Quote Post
JJ Johnson
post Sep 8 2011, 21:31
Post #3


Member


Group: Full Members
Posts: 775
Joined: 18-April 05
Member No.: 1742
Mp3tag Version: 2.55a



QUOTE (RayH @ Sep 7 2011, 23:56) *
I want to remove a part of the file name per the below example:

file name is "anita baker - rapture.mp3" or "john legend - ordinary people.mp3"

I want a script to remove everything up to and including the "-" in all file names so all the file names just have a space before the artist name (inserting track number with another macro).


I take it the second part is the song title? If you already have the title in the TITLE field, then all you need to do is rename the file using that field.

Action type: Format value
Field: _FILENAME
Format string: %title%

To include the track number, use

Action type: Format value
Field: _FILENAME
Format string: $num(%track%,2) %title%
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 9 2011, 07:15
Post #4


Member


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



QUOTE (RayH @ Sep 8 2011, 07:56) *
I want to remove a part of the file name per the below example:
file name is "anita baker - rapture.mp3" or "john legend - ordinary people.mp3"
I want a script to remove everything up to and including the "-" in all file names so all the file names just have a space before the artist name (inserting track number with another macro).
I can't find out to do this because there are no certain number of characters. I could do replace for each artist, but I have to type in each artist's name. Is there an easier way? ...

1.
Be aware of, that a file name, which starts with a space character, might be not allowed by the underlying filesystem.
For example, Windows Explorer automatically removes leading space characters from the filename, when trying to rename a file to get leading space characters.

2.
Action: Format value
Field: _FILENAME
Formatstring: %TRACK% $right(%_filename%,$strstr($reverse(%_filename%),'- '))

From:
TRACK = 1
FILENAME = john legend - ordinary people
To:
FILENAME = 1 - ordinary people

... or ...

Action: Format value
Field: _FILENAME
Formatstring: %TRACK%$right(%_filename%,$strstr($reverse(%_filename%),' - '))

From:
TRACK = 1
FILENAME = john legend - ordinary people
To:
FILENAME = 1 ordinary people

DD.20110909.0817.CEST
Edit.20120621.1705.CEST

This post has been edited by DetlevD: Jun 21 2012, 16:05


--------------------
* 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: 25th May 2013 - 16:34