» Welcome Guest
[ Log In :: Register ]

 

[ Track this topic :: Email this topic :: Print this topic ]

Topic: Need help rearranging data< Next Oldest | Next Newest >
noddy
Board Veteran



Group: Members
Posts: 97
Joined: Feb. 2004
Posted: Sep. 17 2004,03:25

Hi all,
I have a bunch of promos that I'm backing up (I work in radio).
They each have a tag in the 'comment' field which follows this syntax:

pr-a-b-c-d

where 'pr' is short for 'promo',
'a' is a variable length description of the subject,
'b' is either 2 or 4 letters for the voiceover talent,
'c' is the date in 8 digit form (yyyymmdd)
and 'd' is the track number in 2 digit format (01, 02 etc).

What I want to do is to change the comment string to:

c-pr-a-b-d

I'm sure MP3TS can do this, but I can't seem to figure it out right now. ANy help would be appreciated.

--------------
Cheers,
Bruce.
www.audio2u.com
The home of quality podcasts
Back to top
Profile PM 
devNull
Board Newbie



Group: Members
Posts: 4
Joined: Aug. 2004
Posted: Sep. 17 2004,09:12

You can to this by first exporting the comments into a file
and then using the "Tag/rename from file list" with this
template:

<Comment-2[|-]>-<Comment-3[|-]>-<Comment-4[|-]>-<Comment-1[|-]>-<Comment-5[|]>


devNull
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Sep. 17 2004,11:01

Yep, that's right, thanks devNull. :)

And also remember that you can always create a macro of multi-step operations like this (or for single step operations too of course), to have them available at the click of a single button!

--------------
Software author and website owner
Back to top
Profile PM WEB 
noddy
Board Veteran



Group: Members
Posts: 97
Joined: Feb. 2004
Posted: Sep. 17 2004,11:46

Thanks heaps Devnull!
It's Friday night downunder and I'm at home now, but I'll follow it up first thing Monday morning.

--------------
Cheers,
Bruce.
www.audio2u.com
The home of quality podcasts
Back to top
Profile PM 
noddy
Board Veteran



Group: Members
Posts: 97
Joined: Feb. 2004
Posted: Sep. 20 2004,01:19

Devnull,
It worked like a treat!
Thanks heaps.
And Magnus, yeah, love those macros!! They rock my world.
Even though I've read the help file a squillion times, I'm really struggling to get my head round the whole multipart concept, and that pipe character.
You may recall Magnus, I even posted a topic on this ages ago. I'm sorry to say that I still don't get it.
I will continue re-reading the help file, and hopefully one day, it'll all become clear.
If anyone else is reading this, and thinks that they might be able to describe it in an altenate fashion, please come forth!
Again Magnus, awesome program!
Every time I'm on a forum somewhere and people start talking about ID3 taggers, I ALWAYS promote your program.

--------------
Cheers,
Bruce.
www.audio2u.com
The home of quality podcasts
Back to top
Profile PM 
noddy
Board Veteran



Group: Members
Posts: 97
Joined: Feb. 2004
Posted: Sep. 20 2004,01:21

...actually, on that note (about the multipart arguments, and their construction), Devnull, would you mind explaining what each part of that template (that you posted) actually did (one step at a time)?
That might help me to understand what is going on.

--------------
Cheers,
Bruce.
www.audio2u.com
The home of quality podcasts
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Sep. 20 2004,13:20

Thanks for recommending Mp3/Tag Studio to other people noddy.

Let me take a shot at the multi-part field explanation:

First off, let's ignore the [|] part of the fields, and only see what the numbers do, like this:

<Comment-2>-<Comment-3>-<Comment-4>-<Comment-1>-<Comment-5>

These fields work just like normal fields, data is parsed out to them according to the given separators.

Ok, the first difference is then that the data is put together in the used field (in this case the comment field) in another order than it is originally found in the source (in this case the source is the lines in your generated list file), and this is what those numbers mean. The field with number 1 will be first, then 2, then 3 and so on, so the target field (i.e. the comment in this case) will be put together like this:

<Comment-1><Comment-2><Comment-3><Comment-4><Comment-5>

Ok, now for the final quirk. As you can see, the fields are just appended to each other to create the target field, and maybe you will also like to have them separated by something (like e.g. dashes in your example, i.e. "-"). This is what the [|] part is for!

The thing before the pipe character (i.e. "|") will be put before the contents of the field when it is appended with the other ones to create the target data, and the contents after the pipe character will be put after the contents of the field when it is appended. If you don't need any such things, you simply leave it empty, like [|].

So, as an example, if you have the following source data (e.g. a line in the source list or a source filename):

Code Sample
in the comment - This will be


and the following template:

Code Sample
<Comment-2[|]> - <Comment-1[|]>


the resulting comment field would be the following:

This will bein the comment

As you can see, there is no space between "be" and "in", because there were no such thing in the source data, so we can add it by using any of the following two templates instead:

Code Sample
<Comment-2[ |]> - <Comment-1[|]>


Code Sample
<Comment-2[|]> - <Comment-1[| ]>


which would result in the desired comment field:

This will be in the comment


In the example with your template, dashes were added between all the fields by using this exact technique. Now take a look at your template again and see if you don't understand it a bit better. :)

--------------
Software author and website owner
Back to top
Profile PM WEB 
devNull
Board Newbie



Group: Members
Posts: 4
Joined: Aug. 2004
Posted: Sep. 20 2004,14:14

I can try.

First, we exported all the comment fields into a text file.

This file looks like this:

pr-a-b-c-d
pr-a-b-c-d
pr-a-b-c-d
...
and so on.


To move around parts of the input we first need to tell mp3ts
that the input is actually made up of several parts. We do
this using the <TAG:n> notation, where TAG is the name of the
tag ("Comment" in our case) and n is a number. Now let's see
what this number does on an example. The input string is


A-B-C


and let's first use the template


<Comment:1>-<Title>-<Comment:2>


 With this template we are telling mp3ts that the input line
is split into three parts delimited by a hyphen. The first
part of this input line ("A") is also the first part of the
comment field (denoted by :1), the second part of the input
("B") is the title and the third part of the input ("C") is
the second part of the comment (denoted by :2). As a result we
get:


Title: B
Comment: AC


If we were to use the template:


<Comment:1>-<Comment:2>-<Comment:3>


we would receive a comment tag with the value "ABC".


And what would happen if we used this template


<Comment:3>-<Comment:2>-<Comment:1>

?

What we are telling mp3ts here is that the first part of the
input text will be the third part of the comment tag
(denoted by :3), the second part of the input text will be
the second part of the comment tag (:2) and the third
part of the input text will be the first part of the
comment tag (:1). So the resulting comment will be "CBA".


So in our case specific case the input text is:


pr-a-b-c-d


and we want to achieve


a-b-c-pr-d


If we number each hyphen-delimited part of the line
we get this:


1-2-3-4-5


What you want to achieve is:


2-3-4-1-5


So now it's easy to write the needed template:


<Comment:2>-<Comment:3>-<Comment:4>-<Comment:1>-<Comment:5>


We're almost there. If we were to use the above template
exactly we'd get the following value for comment:


abcprd


As you can see, there are no hyphens. The reason for this is
that we used the hyphens for parsing. The template


<Comment:1>-<Comment:2>


tells mp3ts "Find everything up to the first hyphen and
consider that to be the first part of the comment tag, then
whatever follows the hyphen is to be considered the second
part of the comment". The hyphen is not captured into these
fields because it is used as an anchor. So we need to put the
hyphen back in somehow before we glue the comment tag
together. This is what the [|] notations is for.
Let's look at an example. Input string:


A-B-C


Template:


<Comment-1[|]>-<Comment-2[|]>-<Comment-3[|]>


This is exactly equivalent to:


<Comment:1>-<Comment:2>-<Comment:3>


because we haven't put any values into [|]. Now, think of the
| character as the string that is captured into the present
element and it will become clear how this works.
<Comment-1[|]> captures the first part of the input string, so
we'll imagine that | is "A". In other words [|] is [A]. We
want the hyphen to be in the output comment tag right after
the A so we have to place one after "A", in other words
we want [A-]. Now let's go back to the proper notation [|-].
In other words, what <Comment-1[|-]> tells mp3ts is "Place a
hyphen after whatever you parsed into the first part of the
comment tag". The same exact logic applies to the reverse
situation in which we want to place something before
what is parsed by the element. So if we wanted the A to be
"*A", for example, we would use [*|]. And we can combine
prefixes and suffixes, so to change the A into "*A-" we'd use
[*|-].


I hope this clears it up for you. If you still don't get
something, please feel free to ask.


devNull
Back to top
Profile PM 
noddy
Board Veteran



Group: Members
Posts: 97
Joined: Feb. 2004
Posted: Sep. 22 2004,02:51

Magnus and Devnull,
Thank you very much for your expanded explanations of the multipart argument.
I've been playing with it, and I think I've got it now. I will be doing some more tests later today which will really show me whether or not I understand it properly.

--------------
Cheers,
Bruce.
www.audio2u.com
The home of quality podcasts
Back to top
Profile PM 
noddy
Board Veteran



Group: Members
Posts: 97
Joined: Feb. 2004
Posted: Sep. 24 2004,12:06

Magnus and Devnull,
Yep, now I got it!!
You guys rock.
Magnus, I can't say it enough... what a truly awesome program. I hope you make a shitload of money out of it someday. You deserve it.

--------------
Cheers,
Bruce.
www.audio2u.com
The home of quality podcasts
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Sep. 24 2004,20:04

Hehe, thanks, I hope that day will come too.  :p

--------------
Software author and website owner
Back to top
Profile PM WEB 
10 replies since Sep. 17 2004,03:25 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]