# Script to update "compilation" tag?

**URL:** <https://community.mp3tag.de/t/script-to-update-compilation-tag/63146>\
**Category:** Support\
**Created:** [December 19, 2023, 1:46pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146 "2023-12-19T13:46:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 1:46pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/1 "2023-12-19T13:46:55Z")

</div>

Hi,  
I have a music library with around 40K tracks.  
The Album and artist names are pretty well organized (thanks to mp3tag)  
I use foobar to listen to my collection (pretty much all classical) and never had any problem with the way albums are listed. I can easily find the piece that I'm looking for etc.That's on PC.  
I recently started using an android phone for playing my music, and went for foobar's player for convenience.  
The collection is a real mess, because foobar android is throwing every "artist" that happens to be in the same album under a separate cover. So I end up having the same cover repeated many times. I couldn't make foobar android treat album name as the only criteria for listing albums.  
(maybe there is a way?)  
I understand the logic behind it, and i am not disputing the way the foobar is behaving and that's why compilation tag is for.  
But it will be a monumental task to pick each album that has more than one artist and add a compilation tag.  
So my question, after this long intro 🙂  
Is there a way to drop my entire collection mp3tag, and have the program automatically identify individual albums with various artists and add a compilation tag to them?

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [December 19, 2023, 1:49pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/2 "2023-12-19T13:49:47Z")

</div>

> [@rond056](#):
>
> have the program automatically identify albums with various artists and add a compilation tag to them

You can filter for all ALBUMARTIST tags containing "Various Artists".  
Then you select all this songs and set the compilation tag.

Do you know which tag exactly should get this compilation flag for the foobar android player?  
If not, you could set one of this flags on your phone and then (back on your PC with Mp3tag) check which tag got this flag.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [December 19, 2023, 1:51pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/3 "2023-12-19T13:51:59Z")

</div>

> [@rond056](#):
>
> Is there a way to drop my entire collection mp3tag, and have the program automatically identify individual albums with various artists and add a compilation tag to them?

MP3tag does not compare the contents of 2 different files.  
You would have to find a criterion within the data of a file to rate it as compilation track.

The easiest way would be to compare the ALBUMARTIST and ARTIST.  
Where they differ, it is most likely that this is a compilation album.  
If you have not filled ALBUMARTIST, then your problems could arise from this fact.

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 1:56pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/4 "2023-12-19T13:56:06Z")

</div>

Thank you [LyricsLover](https://community.mp3tag.de/u/LyricsLover) and [ohrenkino](https://community.mp3tag.de/u/ohrenkino) for your quick replies.  
I'm afraid, I only use artist and album names and no other tags.  
So I assume, no luck?

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [December 19, 2023, 1:56pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/5 "2023-12-19T13:56:54Z")

</div>

Do you have organized your files per album in one album folder?  
Or do you have 40k tracks in one single directory?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [December 19, 2023, 1:57pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/6 "2023-12-19T13:57:45Z")

</div>

> [@rond056](#):
>
> So I assume, no luck?

As I said: no comparison between files.  
And the foobar problem definitely comes from the missing ALBUMARTIST. So fill that and you would not need the compilation field.

Do you have an indicator for the albumartist somewhere in the folder names?

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 1:58pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/7 "2023-12-19T13:58:18Z")

</div>

They all are separated based on the composer

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [December 19, 2023, 2:01pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/8 "2023-12-19T14:01:31Z")

</div>

You have 10k "Beethoven" in 1 folder, then 10k "Bach" in 1 folder and so on?

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 2:01pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/9 "2023-12-19T14:01:51Z")

</div>

> [@ohrenkino](#):
>
> no comparison between files.

well I was hoping a way that would bypass file name and just take the tags into account.  
Example  
Album X has 10 tracks. If it has 1 "artist" disregard.  
If it has artist \>1, compilation is set to 1

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [December 19, 2023, 2:04pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/10 "2023-12-19T14:04:56Z")

</div>

> [@rond056](#):
>
> well I was hoping a way that would bypass file name and just take the tags into account.

Oh, MP3tag is much more flexible. It can look at the tag data and also at technical and file system properties.  
What it does not: look which data can be found in file a and how that compares to the data in file b.  
So you need to find criteria, that are visible from file a and file b, like e.g. folder names.

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 2:05pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/11 "2023-12-19T14:05:17Z")

</div>

no all beethovens are under beethoven but based on type of piece they go to separate subfolders etc.  
I think picking them file by file is much more work.  
I can throw all my collection in mp3tag and list by album names and pick the ones with more than one artist.  
But this is also a lot of work.

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [December 19, 2023, 2:08pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/12 "2023-12-19T14:08:08Z")

</div>

I'm not sure if I understand your situation:  
The ALBUMARTIST for all your Beethoven tracks is "Ludwig van Beethoven", right?  
How can they be different from ALBUM to ALBUM?

Or do you use some other oganization system where - for example - the conductor ("Leonard Bernstein") is used for Album A and some other conductor for Album B?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [December 19, 2023, 2:11pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/13 "2023-12-19T14:11:22Z")

</div>

> [@rond056](#):
>
> I can throw all my collection in mp3tag and list by album names and pick the ones with more than one artist.

You could filter for all the files with track number 1,  
Use that ARTIST and add it to the folder name.  
Now filter for all files where the ALBUM is part of the folder name but the ARTIST cannot be found.  
This would list all the files with where the ARTIST different from the first ARTIST.  
Set the ALBUMARTIST to "Various" for these files.  
Then filter for all then no. 2 tracks, remove the ARTIST from the folder name, rename the folder so that it contains "Various", filter for files without ALBUMARTIST and "Various" in the folder name and set the ALBUMARTIST to Various.  
And for all the other missing ALBUMARTIST fields, you can copy ARTIST to ALBUMARTIST.

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 2:28pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/14 "2023-12-19T14:28:39Z")

</div>

I apologize for the confusion and thanks for trying to help.  
Here is my tagging structure:  
Artist:Beethoven  
The interpreters go under "comments" no albumartist, no composer no nothing  
the album name has its own naming logic too.  
Actually the task is not as bad as it sounds...  
I was able to isolate 6000 tracks already thanks to the album naming technique that i use 🙂 I appreciate the help!

---

<div class="post-metadata">

**Author:** ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)\
**Post date:** [December 19, 2023, 2:49pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/15 "2023-12-19T14:49:18Z")

</div>

> [@rond056](#):
>
> The collection is a real mess, because foobar android is throwing every "artist" that happens to be in the same album under a separate cover. So I end up having the same cover repeated many times. I couldn't make foobar android treat album name as the only criteria for listing albums.  
> (maybe there is a way?)

The mess isn't due any issues with the player. Foobar Mobile for Android (and iOS) makes use of the Albumartist tag to ensure similar Albums are separated as you are seeking. Same goes for just about every other reliable music player app on either platform.

> [@rond056](#):
>
> The interpreters go under "comments" no albumartist, no composer no nothing

There have already been mulitple replies in this thread, and this is the only reliable solution. So it seems like you are on your way to do some updates for the metadata in your files. Fortunately mp3tag is very capable and should help get you there quickly using the methods suggested already.

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 3:12pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/16 "2023-12-19T15:12:59Z")

</div>

> [@MotleyG](#):
>
> The mess isn't due any issues with the player.

never thought of blaming foobar-android. actually i thought i was rather clear about that in my original post. 🙂  
Anyhow...  
I have a well serving library and folder structure that works for my needs, and the naming of the albums is based on strict rules as well, and the foobar for PC works perfectly for my needs.  
Ideally I would have loved to see an UI mimicking PC, but I understand the difficulty of that (small screen etc)  
Absolutely no complaints 🙂 I love foobar.  
Now, though, I am facing a difficulty.  
I selected all albums with multiple "artist" at once and switched the compilation status to 1.  
Didn't work.  
But I see that one can actually specify what the compilation is based on?  
I selected album names for the fields below?  
I did a quick test and this seems to be working?  
Am I missing anything please?  
I am about to apply this rule to 40K files. Any help is appreciated:

 ![Untitfdled](https://community.mp3tag.de/uploads/default/original/2X/8/88c979220c954c7b618b26d8df250d8e8e9d178b.png)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [December 19, 2023, 3:19pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/17 "2023-12-19T15:19:38Z")

</div>

The field definition in the file list will definitely lead to trouble.  
You display the contents (value) of COMPILATION and then you write that to the field ALBUM - this should overwrite the contents of the current name in ALBUM.  
So the files in your test should have an empty field for COMPILATION (actually, no field COMPILATION) as you did not write anything to the field COMPILATION and a "1" as ALBUM.  
Is that what you wanted?

If you want to read and write a field in the file list, value and field have to be the same.

> [@rond056](#):
>
> But I see that one can actually specify what the compilation is based on?

What do you mean by that?  
Really, believe me: any data update that relies on the comparison of the data of several files may work manually but never automatically.

> [@rond056](#):
>
> I did a quick test and this seems to be working?

And? Could you describe what you did for that test and what the result was?

> [@rond056](#):
>
> Am I missing anything please?

I am pretty sure you are.  
Try it only on copies of files or you will loose valuable data.

---

<div class="post-metadata">

**Author:** ![rond056](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@rond056](https://community.mp3tag.de/u/rond056)\
**Post date:** [December 19, 2023, 3:25pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/19 "2023-12-19T15:25:58Z")

</div>

> [@ohrenkino](#):
>
> You display the contents (value) of COMPILATION and then you write that to the field ALBUM - this should overwrite the contents of the current name in ALBUM.

thanks for the warning. ouch! but i just checked and the album names are what they used to be?  
And foobar android grouped them correctly?  
Ok, thanks to you all.  
I will not do any changes before I am clear. But 5 test albums seemed ok to me?

---

<div class="post-metadata">

**Author:** ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)\
**Post date:** [December 19, 2023, 3:27pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/20 "2023-12-19T15:27:52Z")

</div>

> [@rond056](#):
>
> I selected all albums with multiple "artist" at once and switched the compilation status to 1.  
> Didn't work.

This tag is essentially used by iTunes and a very few others. It does help for quickly filtering in mp3tag though! It is not used in Foobar to the best of my knowledge.

Preferably what you will want to do is filter for all files that are now set with this flag to "1" and add the Albumartist field with a common name such as "Various Artists" or similar. You may find you have a few albums where you may want a different Albumartist name to be used if that applies in your case.

Using the Albumartist tag has another significant benefit as well. For any Album where the title is common to other Artists, it will separate those as well. For example the albums "Faith" by both "Faith Hill" and "George Michael" will show up separately. Without the Albumartist tag most apps will combine these under a single album. Essentially it is the combination of both the Album+Albumartist tags that creates the unique identifier. Of course there are exceptions to this too, but this is basically the concept.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [December 19, 2023, 3:29pm UTC](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146/21 "2023-12-19T15:29:40Z")

</div>

> [@rond056](#):
>
> but i just checked ...

Where did you check? the only good place to check is the extended tags dialogue Alt-T  
How did you set the data for compilation?  
In the tag panel for all the selected files, or for each file in the file list in a column with the definition shown in the screenshot?

[Next page](https://community.mp3tag.de/t/script-to-update-compilation-tag/63146.md?page=2)
