SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Multiple values to single value

I want to change my mult-ivalue tag fields to single values split with a ;

Artist A
Artist B
Genre 1
Genre 2

Becomes

Artist A;ArtistB
Genre 1;Genre2

I was hoping that find and replace would do the job. Selecting Contains ;;; and Replace ;

But no files are changed

Is that using AutoEdit:Find and Replace , i think the issue is although we display multi values as ;;; in Manual Edit, they are not really separated by three semicolons so Find and Replace doesn’t find them, maybe I should change that.

But it does work in Manual Edit and to apply to multiple folders in one go you you can do in Scripter as it also treats ;;; specially, in fact there is already a script called Make Composer Single Value that you could make use of it contains

function makeSingleValue(singleValue, multiValue)
{
  var tmpSingleValue='';
  if(multiValue.length>1)
  {
     for (var index = 0; index < multiValue.length; index++) 
     {
        tmpSingleValue+=multiValue[index] + '; ';
     } 
     if(tmpSingleValue.length>0)
     {
        tmpSingleValue=tmpSingleValue.substring(0, tmpSingleValue.length-2);
     }
     return tmpSingleValue;
   }
   return singleValue;
}
composer=makeSingleValue(composer,composer_index);
composersort=makeSingleValue(composersort,composersort_index);

so you could clone it and change it to

function makeSingleValue(singleValue, multiValue)
{
  var tmpSingleValue='';
  if(multiValue.length>1)
  {
     for (var index = 0; index < multiValue.length; index++) 
     {
        tmpSingleValue+=multiValue[index] + '; ';
     } 
     if(tmpSingleValue.length>0)
     {
        tmpSingleValue=tmpSingleValue.substring(0, tmpSingleValue.length-2);
     }
     return tmpSingleValue;
   }
   return singleValue;
}
artist=makeSingleValue(artist,artist_index);
genre=makeSingleValue(genre,genre_index);

Thanks Paul. Just what I needed.

1 Like