# Semi-solved the box set problem

**URL:** <https://discourse.beets.io/t/semi-solved-the-box-set-problem/2246>\
**Category:** Development\
**Created:** [January 23, 2023, 3:48am UTC](https://discourse.beets.io/t/semi-solved-the-box-set-problem/2246 "2023-01-23T03:48:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RollingStar](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rollingstar/32/728_2.png) [@RollingStar](https://discourse.beets.io/u/RollingStar)\
**Post date:** [January 23, 2023, 3:48am UTC](https://discourse.beets.io/t/semi-solved-the-box-set-problem/2246/1 "2023-01-23T03:48:36Z")

</div>

If you’ve ever imported a box set or multi disc/record release, you might have had this problem: beets not being able to find the release for you. If you import in --flat mode and send the ID manually, you can probably get it in. But we can automate it more. There doesn’t seem to be a way to query by medium title (ex. CD1 title = “Please Please Me”). Maybe MB can add that if we ask? Until then, you can search by medium _count_:

[https://musicbrainz.org/search?query=mediums%3A13+AND+beatles&type=release&limit=25&method=advanced](https://musicbrainz.org/search?query=mediums%3A13+AND+beatles&type=release&limit=25&method=advanced)

```auto
mediums = num_folders
query = artist + ' AND ' + 'mediums:' + mediums

```

Could try throwing the parent folder name in there too.

Looks like this is the code for detecting a multidisc album:

> <https://github.com/beetbox/beets/blob/e584b043be0acec39b9b214415970c5316cc9282/beets/importer.py#L1685>

What if we did something like:

```auto
# we find a CD 1 and CD 2 folder, except they're named weird so the existing heuristic doesn't pick it up
# (very easy in box sets where people often tag them by the album they represent)
mediums = num_subfolders
name_from_tags = Quadrophenia
name_from_parent_folder = Quadrophenia 2010 Master
names = [name_from_tags, name_from_parent_folder]
old_score = 0
for name in names:
    query = artist + ' AND ' + 'mediums:' + mediums
    score = get_distance_score
    old_score = max(old_score, score)

```
