remove custom tags

Use this forum for everything concerning script usage
Post Reply
Rack Kendorim
Newbie
Newbie
Posts: 7
Joined: Tue Mar 10, 2015 7:59 pm

remove custom tags

Post by Rack Kendorim »

Hello,
I am looking for a way to remove some custom tag.
I use MusicBrainz Picard. And it makes me a ton of useless info I'd like to veer right. It is the tag in the "user & sorting".
Two choices because I do not know yet what I want. Remove any tag customize and we only keep the comune basis or otherwise delete specific tag. Basically a kind of delete tag.customtag1 and deletes (not just clear this) the row of that tag.
TY

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

Re: remove custom tags

Post by jtclipper »

This will remove all of the user fields you see in that list.

Code: Select all

Program RemoveUser;

var
  i: integer;
begin

  if not tg_init then exit;

  i := 1;
  sys_SetStatusText( 2, IntToStr( tg_GetRowCount ) );

  repeat
    tg_loadFile;

    sys_SetStatusText( 1, IntToStr( i ) );
    sys_SetStatusText( 3, gTag.Filename );

    gTag.ExtraFieldsRemove;

    gTag.SavetoFile( 0, false );

    i := i + 1;
  until not tg_skip;

end.
If you want to remove specific user fields then replace

Code: Select all

    gTag.ExtraFieldsRemove; 
with

Code: Select all

    gTag.ExtraFieldSet( 'FIELD1', '' );
    gTag.ExtraFieldSet( 'FIELD2', '' );
    ...
    gTag.ExtraFieldSet( 'FIELDn', '' );

Rack Kendorim
Newbie
Newbie
Posts: 7
Joined: Tue Mar 10, 2015 7:59 pm

Re: remove custom tags

Post by Rack Kendorim »

ty i test this later.
There is a doc somewhere to make script ?

Rack Kendorim
Newbie
Newbie
Posts: 7
Joined: Tue Mar 10, 2015 7:59 pm

Re: remove custom tags

Post by Rack Kendorim »

hum i have test he clear the row with script as example

Code: Select all

gTag.ExtraFieldSet( 'SCRIPT', '' ); 
but i wan't completely delete the row it's more clean.

Rack Kendorim
Newbie
Newbie
Posts: 7
Joined: Tue Mar 10, 2015 7:59 pm

Re: remove custom tags

Post by Rack Kendorim »

It's not possible ?
so maybe if we save on variable custom field we wan't keep we delete all and next we add the saved field ?

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

Re: remove custom tags

Post by jtclipper »

List the custom tags that you want to delete and I will provide a script

Rack Kendorim
Newbie
Newbie
Posts: 7
Joined: Tue Mar 10, 2015 7:59 pm

Re: remove custom tags

Post by Rack Kendorim »

At the moment i have but it just empty values without deleting the line

Code: Select all

Program RemoveUser;

var
  i: integer;
begin

  if not tg_init then exit;

  i := 1;
  sys_SetStatusText( 2, IntToStr( tg_GetRowCount ) );

  repeat
    tg_loadFile;

    sys_SetStatusText( 1, IntToStr( i ) );
    sys_SetStatusText( 3, gTag.Filename );

    gTag.ExtraFieldSet( 'SCRIPT', '' );
    gTag.ExtraFieldSet( 'MUSICBRAINZ ALBUM TYPE', '' );
    gTag.ExtraFieldSet( 'BARCODE', '' );
    gTag.ExtraFieldSet( 'CATALOGNUMBER', '' );
    gTag.ExtraFieldSet( 'WRITER', '' );
    gTag.ExtraFieldSet( 'ASIN', '' );
    gTag.ExtraFieldSet( 'MUSICBRAINZ ALBUM STATUS', '' );
    gTag.ExtraFieldSet( 'MUSICBRAINZ ALBUM RELEASE COUNTRY', '' );

    gTag.SavetoFile( 0, false );

    i := i + 1;
  until not tg_skip;

end.
I want keep

ACOUSTID ID
MUSICBRAINZ ARTIST ID
MUSICBRAINZ ALBUM ARTIST ID
MUSICBRAINZ RELEASE GROUP ID
MUSICBRAINZ ALBUM ID
MUSICBRAINZ WORK ID

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

Re: remove custom tags

Post by jtclipper »

Try the following script on a couple of files to see if it works as you described

Code: Select all

Program RemoveUser;

var
  i: integer;
  ACOUSTID_ID,
  MUSICBRAINZ_ARTIST_ID,
  MUSICBRAINZ_ALBUM_ARTIST_ID,
  MUSICBRAINZ_RELEASE_GROUP_ID,
  MUSICBRAINZ_ALBUM_ID,
  MUSICBRAINZ_WORK_ID : string;
begin

  if not tg_init then exit;

  i := 1;
  sys_SetStatusText( 2, IntToStr( tg_GetRowCount ) );

  repeat
    tg_loadFile;

    sys_SetStatusText( 1, IntToStr( i ) );
    sys_SetStatusText( 3, gTag.Filename );

    ACOUSTID_ID                  := gTag.ExtraFieldGet( 'ACOUSTID ID' );
    MUSICBRAINZ_ARTIST_ID        := gTag.ExtraFieldGet( 'MUSICBRAINZ ARTIST ID' );
    MUSICBRAINZ_ALBUM_ARTIST_ID  := gTag.ExtraFieldGet( 'MUSICBRAINZ ALBUM_ARTIST ID' );
    MUSICBRAINZ_RELEASE_GROUP_ID := gTag.ExtraFieldGet( 'MUSICBRAINZ RELEASE GROUP ID' );
    MUSICBRAINZ_ALBUM_ID         := gTag.ExtraFieldGet( 'MUSICBRAINZ_ALBUM ID' );
    MUSICBRAINZ_WORK_ID          := gTag.ExtraFieldGet( 'MUSICBRAINZ WORK ID' );

    gTag.ExtraFieldsRemove;

    if ACOUSTID_ID <> '' then gTag.ExtraFieldSet( 'ACOUSTID ID', ACOUSTID_ID );
    if MUSICBRAINZ_ARTIST_ID <> '' then gTag.ExtraFieldSet( 'MUSICBRAINZ ARTIST ID', MUSICBRAINZ_ARTIST_ID );
    if MUSICBRAINZ_ALBUM_ARTIST_ID <> '' then gTag.ExtraFieldSet( 'MUSICBRAINZ ALBUM_ARTIST ID', MUSICBRAINZ_ALBUM_ARTIST_ID );
    if MUSICBRAINZ_RELEASE_GROUP_ID <> '' then gTag.ExtraFieldSet( 'MUSICBRAINZ RELEASE GROUP ID', MUSICBRAINZ_RELEASE_GROUP_ID );
    if MUSICBRAINZ_ALBUM_ID <> '' then gTag.ExtraFieldSet( 'MUSICBRAINZ_ALBUM ID', MUSICBRAINZ_ALBUM_ID );
    if MUSICBRAINZ_WORK_ID <> '' then gTag.ExtraFieldSet( 'MUSICBRAINZ WORK ID', MUSICBRAINZ_WORK_ID );


    gTag.SavetoFile( 0, false );

    i := i + 1;
  until not tg_skip;

end.

Rack Kendorim
Newbie
Newbie
Posts: 7
Joined: Tue Mar 10, 2015 7:59 pm

Re: remove custom tags

Post by Rack Kendorim »

Great (just two _ aren't on extra id.) i have change this it works perfectly. Ty guys
Ps : And good if no extra he don't add blank row.

Post Reply