Format Value query


#1

I am tagging TV shows in mp4.

The files I have are tagged for iTunes and I want them tagged for use with WinAmp.

The TV Season field is just a number to tag the season:

E.G - TV SHOW: 3 (for Season 3)

I would like to create an action to change the album field (required by winamp) to Season 3.

So any ideas on how I move the 3 over (which I have done with other tags as a format value) but also to add the word "season" to each tag.

I hope this is clear.


#2

Use the following.
Action type: Format value
Field: ALBUM
Formatstring: Season %tvseason%

%tvseason% is whichever field you are storing the '3' as in your example.


#3

Yes! That worked perfectly. Many thanks.

How about this?

Filename for TV shows is: Modern.Family.S03E08.After.The.Fire
Title is: After the Fire

I want to convert tag to filename and

I want the outcome to be (in the filename field):
038 - After The Fire

iTunes season is 3, iTunes episode is 8.

Too much to ask?


#4

use this:
Name of action group: &Script Test

Action #1:
Action type: Replace with regular expression
Field: _FILENAME
Regular expression: ^([^\d]+)(\d+)(\w)(\d+)(.+)(.\w{3,4})$
Replace matches with: $2x$4 -$5$6

[ ] case-sensitive comparison

Action #2:
Action type: Replace with regular expression
Field: _FILENAME
Regular expression: ([^.])(.)([^.])
Replace matches with: $1 $3

[ ] case-sensitive comparison

Action #3:
Action type: Replace with regular expression
Field: _FILENAME
Regular expression: (\s+)(\w+)$
Replace matches with: .$2

[ ] case-sensitive comparison

1st action places all the things you want in the right order.
2nd action replaces 'words.like.this.mp4' to 'words like this mp4'
3rd action fixes the ' mp4' back to '.mp4'

script is uploaded for you. place in %appdata%\mp3tag\data\actions folder.

_Script_Test.mta (214 Bytes)


#5

Woooah! That is so cool.

I was doubtful that it could be done but that works perfectly.

Great support and great software.

Many, many thanks.


#6

... and sorry one more thing. if the tag says:

Modern.Family.S03E08.768kbps.After.The.Fire.[videoseed.com]

and I want to change it to:

038 - After The Fire

How would I do that?


#7

From:
Modern.Family.S03E08.768kbps.After.The.Fire.[videoseed.com]
To:
038 - After The Fire

Filter:

"$replace(%_filename%,'.',' ')" MATCHES "^.+?\sS(\d+)E(\d+)\s\d+kbps\s(.+)\s\[.+\]$"

Action: Format value
Field: _FILENAME
Formatstring:

$regexp($replace(%_filename%,'.',' '),'^.+?\sS(\d+)E(\d+)\s\d+kbps\s(.+)\s\[.+\]$','$1x$2 - $3')

From:
Modern.Family.S03E08.After.The.Fire
To:
038 - After The Fire

Filter:

"$replace(%_filename%,'.',' ')" MATCHES "^.+?\sS(\d+)E(\d+)\s(.+)$"

Action: Format value
Field: _FILENAME
Formatstring:

$regexp($replace(%_filename%,'.',' '),'^.+?\sS(\d+)E(\d+)\s(.+)$','$1x$2 - $3')

DD.20111121.0920.CET


#8

Yes sir - that worked perfectly.

Many thanks.


#9

Actually, I am afraid to report that it didn't after all.

Only around half of the conversions work it seems.


#10

Hmm ... it seems that you have to adapt the filter string and the format string to match the other remaining cases.
Do have a closer look to the structure of the filenames, which were not touched by the last run.
Where are the differences in structure or used characters?
Also ... when the filter is set, the status line tells you how many files from the entire loaded list of files are currently displayed.

DD.20111125.1408.CET


#11

try this for 'Modern.Family.S03E08.768kbps.After.The.Fire.[videoseed.com]'

Name of action group: &Script Test

Action #1:
Action type: Replace with regular expression
Field: _FILENAME
Regular expression: \d+kbps
Replace matches with:

[ ] case-sensitive comparison

Action #2:
Action type: Replace with regular expression
Field: _FILENAME
Regular expression: [.+.com]
Replace matches with:

[ ] case-sensitive comparison

Action #3:
Action type: Format value
Field: _FILENAME
Formatstring: $regexp($replace(%_filename%,'.',' '),'^.+?\sS(\d+)E(\d+)\s(.+)$','$1x$2 - $3')

'' represents BLANK

  1. replaces '768kbps' to '' (this could be '444kbps' and it would still replace it with nothing).
  2. replaces '[videoseed.com]' to '' (this actually replaces anything in this format '[this.com]' to ''.
  3. same as 'DetlevD' posted.

between stage 2 and 3 you can add more regexp or even the simple replace action to get rid of anything which doesn't match the format you wish to have. e.g.

Modern.Family.S03E08.768kbps.After.The.Fire.[videoseed.com]
TO
Modern.Family.S03E08.After.The.Fire

_Script_Test.mta (216 Bytes)

_Script_Test.mta (216 Bytes)


#12

Thank you.

I will try this out for a while and let you know how things work out.


#13

So I've just seen 1 small issue.

The filename appears with 2 spaces the '-' and 'After...'

I can't seem to show it on this post but it should read 038 - After the Fire
rather than 038 - __ After the Fire (with the underscores meaning spaces)


#14

Yes, the two spaces might have been left over from 'replace dot with space' in the first step.
You can add an action, which can replace two space characters with one space character.

DD.20111126.1828.CET


#15

To get rid of unwanted spaces add this as action no. 4 (just make sure its the last action in the action group)

Action #4:
Action type: Replace with regular expression
Field: FILENAME
Regular expression: \s{2,}
Replace matches with: (_ represents one whitespace)

[ ] case-sensitive comparison

\s Represents whitespace
{2,} Is a quantifier for the whitespace. (this means greater than 2 whitespaces until infinity).


#16

I have rather unsuccessfully tried this. I now still have 2 spaces at the beginning and another space has appeared at the end of the the last word (of the filename) and .mp4

I tried to save the .mtg file and then upload it to show you but it it is saying I don't have authority to upload this type of file.

Any chance you could upload the .mta file as before?

EDIT: Just so you know I did have a go here is what I added -
Replace with regular expression
Field: _FILENAME
Regular Expression: \s{2,}
Replace Matches With: (tabbed one space and then clicked OK)
Case-sensitive comparison (blank)


#17

_Script_Test.mta (218 Bytes)
This one is same as before.

Script_Test__1.mta (100 Bytes)
This one removes leading, trailing and unneeded whitespaces in the filename and tag information, just run this once your done with the files.

A LITTLE TIP
Just name it '&Clean-Up#Necessary Leading, Trailing, White space' so it looks like the attched jpeg

The '&' symbol beside the C makes it that you can hit alt>A>C to get to that 'Clean-Up' section. The # is the important one, it groups them under the one section.


Script_Test__1.mta (100 Bytes)

_Script_Test.mta (218 Bytes)


#18

Just one thing now although not a biggie.

There is still a gap between the last letter of the word in the filename and the .mp4.

The second script doesn't seem to change anything.

I am afraid I didn't quite get this.


#19

actions.zip (655 Bytes)
See how this works, unzip and place them in your folder. You will notice how the file is named affects the way it appears in the program.

I've also fixed the problem with the 'trailing space .mp4'

So you only need to run the action 'Script Test#slov92 Problem.mta' once to do the job.

actions.zip (655 Bytes)


#20

I've tried that with one file and it seems to work perfectly.

Will test some more tomorrow.

Once again all your work is much appreciated. :slight_smile: