Separator for Multiple Values and Swapping Fields

Main discussion forum
Post Reply
guptaas
Newbie
Newbie
Posts: 21
Joined: Thu May 31, 2012 7:06 pm

Separator for Multiple Values and Swapping Fields

Post by guptaas »

Thank you for bringing the greatest tagger of all time back. Couple of problems I can't solve without some skill at scripts:

--Are multiple values supported for most fields?
--How do I substitute a semi-colon for a comma to separate multiple values in fields like Genres, Tones, Styles etc?
--How can I direct results of the AMG script from one field to another e.g. "Tones" to "Mood" or "Themes" to "Situation"
--Can I merge two fields? I'd like to combine AMG results of "Genre" and "Styles" into "Styles"
--A way to translate an "AMG Pick" into a rating of "5" for MP3's and "100" for FLAC's would be great

Any help appreciated. Even directing to a source where I can teach myself some scripting or a list of commands might work. Thanks

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Separator for Multiple Values and Swapping Fields

Post by jtclipper »

Multiple values is generally data separated with chr(0) , tgf at the moment does not read past the chr(0) part but since you brought this up I'll add support for reading/saving multiple values in the next beta, hopefully soon enough.

Almost everything else you posted is possible with scripting, I will post some commands which you can place directly before the 'finally' command in the script, so just let the script do its work and then add a few lines to get your desired result.

Code: Select all

//How do I substitute a semi-colon for a comma to separate multiple values in fields like Genres, Tones, Styles etc?
    on_setGenre( AnsiReplaceStr(on_getGenre, ',', ';' ))
    on_setTones( AnsiReplaceStr(on_getTones, ',', ';' ))
    on_setStyles( AnsiReplaceStr(on_getStyles, ',', ';' ))

//Can I merge two fields? I'd like to combine AMG results of "Genre" and "Styles" into "Styles"
   on_setStyles( on_getGenre + ';' + on_getStyles )
--A way to translate an "AMG Pick" into a rating of "5" for MP3's and "100" for FLAC's would be great
Not directly supported sorry

--How can I direct results of the AMG script from one field to another e.g. "Tones" to "Mood" or "Themes" to "Situation"
For this you will need another script to execute, this is not a grabber script it's an online script available on the right part of the UI (above the album info), its an .scl file.
When you execute this you are done with renaming & updating automatically.
Also themes are saved in situation so you don't have to do anything.

Code: Select all

program swapfields;
var
 i: integer;
begin
  // apply update and rename the files automatically
  on_Apply;
  on_Update;
  on_Rename;
  for i := 1 to on_getGrdRowCount do begin
      on_setGrdRow( i );

      on_LoadFile;
      gTag.Mood := gTag.Tones;
      gTag.Tones := '';

      gTag.SaveToFile( 0, false, '', false );
  end;
  on_Refresh;
  on_setGrdRow( 1 );
end.
Try to test everything on a copy of your files first.

guptaas
Newbie
Newbie
Posts: 21
Joined: Thu May 31, 2012 7:06 pm

Handling different file formats

Post by guptaas »

Thank you so much. That is working beautifully. I can hopefully do further tweaking myself.
Here is another issue: I haven't come across any way to handle the differences between ID3v2 and VorbisComment during an Online update. Is their a way to map fields between formats? Alternatively, is their a way to insert file format differences into an scl file: For example, AMG "Album Moods" > The Godfather "TONES" > "MOOD" for a FLAC/"TMOO" for an MP3.

Thanks again for the fantastic work.

Wurlitzer
Newbie
Newbie
Posts: 38
Joined: Mon Sep 13, 2010 11:09 am

Re: Separator for Multiple Values and Swapping Fields

Post by Wurlitzer »

@jtclipper

Maybe I'm too stupid, but although your code examples are very helpful, I can't find a way to substitute "/" with "," in the composer field. The new AMG script works fine, but I want to have the composer "comma-separated" as it was realized in the AMG script before relaunch.

Concerning multiple values: please take into account that separators for multiple values can be used in flexible way as there are established quasi-standards in the most popular music programs (for example multiple genres are separated with ";" in many programs).

AMG pick: is it possible to grab it using a TXXX-frame with value "X" for all picked songs?

Bye Byte and Happy Coding
Wurlitzer

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Handling different file formats

Post by jtclipper »

guptaas wrote: Here is another issue: I haven't come across any way to handle the differences between ID3v2 and VorbisComment during an Online update. Is their a way to map fields between formats? Alternatively, is their a way to insert file format differences into an scl file: For example, AMG "Album Moods" > The Godfather "TONES" > "MOOD" for a FLAC/"TMOO" for an MP3.
MOOD is used for flac files but for mp3's a user defined fields MOOD is used TMOO is an ID3 2.4 version frame and tgf does not save as 2.4 for various reasons.

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Separator for Multiple Values and Swapping Fields

Post by jtclipper »

Wurlitzer wrote:@jtclipper
Maybe I'm too stupid, but although your code examples are very helpful, I can't find a way to substitute "/" with "," in the composer field. The new AMG script works fine, but I want to have the composer "comma-separated" as it was realized in the AMG script before relaunch.
Check for the 'sComposer := ' in line 67 directly after that you can do this

Code: Select all

sComposer := AnsiReplaceStr( sComposer, '/', ';' );
Also remember when modifying scripts that their filename starts with an # (system scripts) always use save as.. and work with your own copy.

Wurlitzer
Newbie
Newbie
Posts: 38
Joined: Mon Sep 13, 2010 11:09 am

Re: Separator for Multiple Values and Swapping Fields

Post by Wurlitzer »

Thank you jtclipper,
you've made my day!

guptaas
Newbie
Newbie
Posts: 21
Joined: Thu May 31, 2012 7:06 pm

Re: Separator for Multiple Values and Swapping Fields

Post by guptaas »

Thank you so much. I needed the composer separator as well.

Post Reply