# Separate albums with duplicates

**URL:** <https://community.metabrainz.org/t/separate-albums-with-duplicates/74024>\
**Category:** MusicBrainz Picard\
**Tags:** filenaming, duplicates, taggerscript\
**Created:** [June 16, 2016, 3:43pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024 "2016-06-16T15:43:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![matrafisco](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/m/258eb7/32.png) [@matrafisco](https://community.metabrainz.org/u/matrafisco)\
**Post date:** [June 16, 2016, 3:43pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/1 "2016-06-16T15:43:53Z")

</div>

Hi,

I’ trying to figure out how to move my albums with duplicates to a separate folder, but somehow this doesn’t work:

```taggerscript
$if($gt($matchedtracks( ),%_totalalbumtracks%),DuPS/)

```

So, i have something like:  
 ![](https://community.metabrainz.org/uploads/default/original/2X/7/786837b6ddf88bc979a8c7e72de88a8ca3a5b417.png)

How do i get the number of files i have in a disc? (In this case; the 16?)  
Is there a doc where we can find all functions and variables available for scripting?

Thank you

---

<div class="post-metadata">

**Author:** ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)\
**Post date:** [June 17, 2016, 11:17am UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/2 "2016-06-17T11:17:29Z")

</div>

Actually not sure how what you want can be done. `$matchedtracks()` will AFAIK match the number of tracks, not files, that have at least one file matched, so in your case it will be 11. What you actually want is to know whether a) all files have matches, `$eq($matchedtracks(),%_totalalbumtracks%)`, and b) whether there are more files matched to the release than there are tracks. I am not sure about an existing function that would allow you to do b), but it shouldn’t be hard to implement as a plugin.

> [@matrafisco](#):
>
> Is there a doc where we can find all functions and variables available for scripting?

Documentation is available on the Picard website for [scripting](http://picard.musicbrainz.org/docs/scripting/) and [variables](http://picard.musicbrainz.org/docs/tags/).

---

<div class="post-metadata">

**Author:** ![matrafisco](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/m/258eb7/32.png) [@matrafisco](https://community.metabrainz.org/u/matrafisco)\
**Post date:** [June 17, 2016, 12:15pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/3 "2016-06-17T12:15:02Z")

</div>

> [@outsidecontext](#):
>
> a) all files have matches, $eq($matchedtracks(),%\_totalalbumtracks%)

i found $is\_complete() on older musicbrainz forums, but it no longer works.  
i’m actually using a), with $neq() for incomplete releases.

> [@outsidecontext](#):
>
> Documentation is available on the Picard website for scripting and variables.

[View script variables](https://github.com/metabrainz/picard-plugins/tree/master/plugins/viewvariables) shows additional variables available for single files. Too bad it doesn’t work for the entire Album.

Thank you for your feedback.

---

<div class="post-metadata">

**Author:** ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)\
**Post date:** [June 17, 2016, 4:44pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/4 "2016-06-17T16:44:58Z")

</div>

> [@matrafisco](#):
>
> i found $is\_complete() on older musicbrainz forums, but it no longer works.i’m actually using a), with $neq() for incomplete releases.

As far as I remember `$is_complete()` was part of some plugin, but your solution is the proper solution for this with the current functionality available by default.

---

<div class="post-metadata">

**Author:** ![matrafisco](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/m/258eb7/32.png) [@matrafisco](https://community.metabrainz.org/u/matrafisco)\
**Post date:** [June 18, 2016, 9:45pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/5 "2016-06-18T21:45:55Z")

</div>

Just figured out that my solution, doesn’t work.

![](https://community.metabrainz.org/uploads/default/original/2X/0/0a4f195281ff1362c3679379ed303020a66c4158.png)

Releases with video/data tracks can be complete without $eq($matchedtracks(),%\_totalalbumtracks%) being true.  
I guess i’m stuck on this one.

---

<div class="post-metadata">

**Author:** ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)\
**Post date:** [June 18, 2016, 10:10pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/6 "2016-06-18T22:10:07Z")

</div>

> [@outsidecontext](#):
>
> As far as I remember $is\_complete() was part of some plugin, but your solution is the proper solution for this with the current functionality available by default.

Obviously my memory betrayed me a bit, $is\_complete was integrated into Picard, and it was me who actually did that 😂. Please try that function in latest Picard 1.4 development version available from the download page.

It should do what you want: Do not report a release as complete if there are duplicates and it can ignore certain track types ( pregap, video, silence and data tracks, you can choose which should be ignored in the options).

---

<div class="post-metadata">

**Author:** ![matrafisco](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/m/258eb7/32.png) [@matrafisco](https://community.metabrainz.org/u/matrafisco)\
**Post date:** [June 19, 2016, 9:28am UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/7 "2016-06-19T09:28:00Z")

</div>

🙂 great!

can you tell me the arguments for the function, or where to find it?

thank you so much.

---

<div class="post-metadata">

**Author:** ![matrafisco](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/m/258eb7/32.png) [@matrafisco](https://community.metabrainz.org/u/matrafisco)\
**Post date:** [June 19, 2016, 3:38pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/8 "2016-06-19T15:38:31Z")

</div>

just found your ticket on it! 😄 😉 😄  
[https://tickets.musicbrainz.org/browse/PICARD-514](https://tickets.musicbrainz.org/browse/PICARD-514)

following your links:

> <https://github.com/metabrainz/picard/pull/383/commits/26051ecf3ceaff4d848e85150d9c08ae9548d3a9>
>
> Works currently only for renaming scripts (similar to $matchedtracks). PICARD-51…4

going to give a look at your code now! (feel a bit lost…)

thank you so much! 🙂

---

<div class="post-metadata">

**Author:** ![matrafisco](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/m/258eb7/32.png) [@matrafisco](https://community.metabrainz.org/u/matrafisco)\
**Post date:** [June 19, 2016, 4:53pm UTC](https://community.metabrainz.org/t/separate-albums-with-duplicates/74024/9 "2016-06-19T16:53:28Z")

</div>

As i see it,

> ```
> def func_is_complete(parser):
> if parser.file:
> if parser.file.parent and parser.file.parent.album.is_complete():
> return "1"
> return "0"
> 
> ```

takes no args, and returns just true or false (0,1), right?

And if i undestood it right, this is what i need:

```taggerscript
$if($eq($is_complete(),0),
    $if($lt($matchedtracks( ),%_totalalbumtracks%), _inComplete/, _DuPs/)
)

```

moving duplicates to the \_DuPS folder, incomplete albums to the \_inComplete folder and complete ones on my destination root…

Thanks once again.
