# Freedb discid translation

**URL:** https://community.metabrainz.org/t/freedb-discid-translation/413508
**Category:** Development
**Tags:** freedb, discid, musicbrainz
**Created:** [January 17, 2019, 3:13am UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508 "2019-01-17T03:13:24Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![PoQStacker](https://community.metabrainz.org/user_avatar/community.metabrainz.org/poqstacker/32/18201_2.png) [@PoQStacker](https://community.metabrainz.org/u/PoQStacker)
#### Post date: [January 17, 2019, 3:13am UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/1 "2019-01-17T03:13:24Z")

</div>

Hi all,

Does know how to translate a freedb discid to the equivalent MB resource?

Thanks in advance

---

<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: [January 17, 2019, 7:20am UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/2 "2019-01-17T07:20:52Z")

</div>

If you mean how to convert from a freedb disc ID to a MusicBainz disc ID, that’s not totally possible. The MusicBrainz disc ID contains the the lead-out track offset (end of last track), and the freedb one doesn’t.

Compare e.g. the following equivalent disc IDs:

[https://musicbrainz.org/cdtoc/lSOVc5h6IXSuzcamJS1Gp4\_tRuA-](https://musicbrainz.org/cdtoc/lSOVc5h6IXSuzcamJS1Gp4_tRuA-)  
[http://www.freedb.org/freedb/rock/b40c9e0b](http://www.freedb.org/freedb/rock/b40c9e0b)

The lead out sector is 242457, but this info is not present in the freedb entry. Hence you cannot convert the freedb reliable into a MB disc ID. But you can do it the other way around, MB disc IDs can be converted to their freedb counterpart.

---

<div class="post-metadata">

### Author: ![PoQStacker](https://community.metabrainz.org/user_avatar/community.metabrainz.org/poqstacker/32/18201_2.png) [@PoQStacker](https://community.metabrainz.org/u/PoQStacker)
#### Post date: [January 19, 2019, 3:11am UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/3 "2019-01-19T03:11:39Z")

</div>

Thank you for your reply @outsidecontext.

I have ripped several hundred CD’s with the help of freedb. What I am trying to do is refresh the metadata, mainly genre, from MB.

When I ripped these CDs I also captured the DiscId. So, as well as the album, artist, and titles, I have the total number of tracks, track lengths and the Disc ID.

My thinking now is - if I can reconstruct the TOC (programmatically) from the info above, construct a query to MB, then filter the reply by correlation of existing data…

---

<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: [January 19, 2019, 8:35am UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/4 "2019-01-19T08:35:15Z")

</div>

In this case you probably will get some good results by doing a fuzzy TOC lookup, see [MusicBrainz API - MusicBrainz](https://musicbrainz.org/doc/XMLWebService%23Looking_up_a_Specific_Artist#Non-MBID_Lookups)

You just have to calculate the lead out track sector from the disc length. Since freedb only has the length in seconds this will not give exact sector, but probably with all the other exact sectors this will be enough for a fuzzy lookup.

---

<div class="post-metadata">

### Author: ![IvanDobsky](https://community.metabrainz.org/user_avatar/community.metabrainz.org/ivandobsky/32/11785_2.png) [@IvanDobsky](https://community.metabrainz.org/u/IvanDobsky)
#### Post date: [January 19, 2019, 12:07pm UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/5 "2019-01-19T12:07:23Z")

</div>

What did you rip with? EAC logs can be copy\pasted into this page and a discID lookup then can be done at MB.

[http://eac-log-lookup.blogspot.com/](http://eac-log-lookup.blogspot.com/)

I assume it handles a few other log variations.

That page will take something as simple as this (chopped from an EAC log):

```auto

TOC of the extracted CD

     Track | Start | Length | Start sector | End sector 
    ---------------------------------------------------------
        1 | 0:00.00 | 1:08.26 | 0 | 5125   
        2 | 1:08.26 | 2:48.54 | 5126 | 17779   
        3 | 3:57.05 | 3:50.45 | 17780 | 35074   
        4 | 7:47.50 | 6:49.45 | 35075 | 65794   
        5 | 14:37.20 | 4:44.10 | 65795 | 87104   
        6 | 19:21.30 | 6:22.56 | 87105 | 115810   
        7 | 25:44.11 | 7:49.64 | 115811 | 151049   
        8 | 33:34.00 | 3:26.16 | 151050 | 166515   
        9 | 37:00.16 | 3:46.70 | 166516 | 183535   
       10 | 40:47.11 | 2:11.41 | 183536 | 193401   

```

This has been very handy for me. Especially when I can’t be bothered to get the disk back from the shelf…

---

<div class="post-metadata">

### Author: ![Llama\_lover](https://community.metabrainz.org/user_avatar/community.metabrainz.org/llama_lover/32/12639_2.png) [@Llama\_lover](https://community.metabrainz.org/u/Llama_lover)
#### Post date: [January 19, 2019, 7:54pm UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/6 "2019-01-19T19:54:16Z")

</div>

Thanks @IvanDobsky ! I just tried it out. So cool, so easy. 🙆‍♂️

---

<div class="post-metadata">

### Author: ![IvanDobsky](https://community.metabrainz.org/user_avatar/community.metabrainz.org/ivandobsky/32/11785_2.png) [@IvanDobsky](https://community.metabrainz.org/u/IvanDobsky)
#### Post date: [January 19, 2019, 8:16pm UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/7 "2019-01-19T20:16:52Z")

</div>

A thread where I found it links to other details about it.

> [@Adding CD with TOC but without physical CD](https://community.metabrainz.org/t/adding-cd-with-toc-but-without-physical-cd/210836/):
>
> I have TOCs of CDs and Cover of front- and back-Cover. Can I add a release and/or search a CD with this information without having the physical CD. I think, can I do it like Picard but only without the CD? Thanks.

I find it works great with EAC logs. Saves getting the CD off of the shelf.

---

<div class="post-metadata">

### Author: ![PoQStacker](https://community.metabrainz.org/user_avatar/community.metabrainz.org/poqstacker/32/18201_2.png) [@PoQStacker](https://community.metabrainz.org/u/PoQStacker)
#### Post date: [January 20, 2019, 3:23am UTC](https://community.metabrainz.org/t/freedb-discid-translation/413508/8 "2019-01-20T03:23:00Z")

</div>

Thanks again @outsidecontext for your reply. I am away from my development computer for a little while - a few different algorithms are coming to mind. I will post back here which works best…

PS: I have used several different ripping software packages over the years. I don’t recall using EAC. I used the package that came with Creative Sound Blaster for a while (it was the fastest by far - early versions used freedb, later versions used Gracenote). I have used my own software (PoQStacker) in recent years - which I am transitioning from freedb to MB.
