Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discogs: Fetch a few more metadata fields #465

Closed
downinthings opened this issue Dec 2, 2013 · 14 comments
Closed

discogs: Fetch a few more metadata fields #465

downinthings opened this issue Dec 2, 2013 · 14 comments
Labels
feature features we would like to implement

Comments

@downinthings
Copy link

Hey Guys,

I've recently begun using the Discogs plugin for beets. I am wondering if the information obtained by the plugin could be extended? I am looking to get the following information for each release I tag:

Discogs URL
Release Date (YYYY-MM-DD)
Genre
Style
Country

I tried playing with the plugin to get this information, but I am not well-versed in python.

Having the ability to specify what tag fields this information is applied to would also be amazing.

Thanks guys!

@sampsyo
Copy link
Member

sampsyo commented Dec 2, 2013

Thanks for this idea! We do already appear to be fetching the country and release year, but the full date and genre/style would be cool to add. We also get the URL (as data_url) for display purposes but autotag.apply_metadata should probably store this in a flexattr.

@downinthings
Copy link
Author

I've tried doing this myself, but I am unsure if what I have done is correct. Here is the code I changed / updated in the discogs.py file

def get_album_info(self, result):
        """Returns an AlbumInfo object for a discogs Release object.
        """
        album = re.sub(r' +', ' ', result.title)
        album_id = result.data['id']
        artist, artist_id = self.get_artist(result.data['artists'])
        # Use `.data` to access the tracklist directly instead of the convenient
        # `.tracklist` property, which will strip out useful artist information
        # and leave us with skeleton `Artist` objects that will each make an API
        # call just to get the same data back.
        tracks = self.get_tracks(result.data['tracklist'])
        albumtype = ', '.join(
            result.data['formats'][0].get('descriptions', [])) or None
        va = result.data['artists'][0]['name'].lower() == 'various'
        year = result.data['year']
        releasedate = result.data['released']
        genre = result.data['genres']
        style = result.data['styles']
        label = result.data['labels'][0]['name']
        mediums = len(set(t.medium for t in tracks))
        catalogno = result.data['labels'][0]['catno']
        if catalogno == 'none':
            catalogno = None
        country = result.data.get('country')
        media = result.data['formats'][0]['name']
        data_url = result.data['uri']
        return AlbumInfo(album, album_id, artist, artist_id, tracks, asin=None,
                         albumtype=albumtype, va=va, year=year, month=None,
                         day=None, label=label, mediums=mediums,
                         artist_sort=None, releasegroup_id=None,
                         catalognum=catalogno, script=None, language=None,
                         country=country, albumstatus=None, media=media,
                         albumdisambig=None, artist_credit=None,
                         original_year=None, original_month=None,
                         original_day=None, data_source='Discogs',
                         data_url=data_url, releasedate=releasedate, genre=genre, 
                         style=style)

I'm not sure how to apply this newly obtained data to tag fields... Also i'd love to be able to get the image from discogs as well. How would I go about doing that?

@sampsyo
Copy link
Member

sampsyo commented Dec 10, 2013

Looks cool! Would you mind opening a Pull Request for easy reviewing/merging?

Images will require a bit more effort, and probably collaboration with the fetchart plugin (see #429).

@downinthings
Copy link
Author

I have no idea what I am doing with this so I'm not sure it's worth me opening a pull request. I don't know if what I wrote up there is correct or if it will break the plugin. I was hoping someone else would take the lead on this and I could pitch in some help if needed.

@sampsyo
Copy link
Member

sampsyo commented Dec 19, 2013

Well, opening a PR is free, and it's probably the best way to collaborate on this (we can run tests, add commits, etc. to iterate toward a final solution). This seems like a perfect start!

@gwern
Copy link
Contributor

gwern commented Sep 11, 2014

This looks interesting. How does the discogs genre metadata compare with the genre metadata being extracted from last.fm by lastgenre?

@sampsyo
Copy link
Member

sampsyo commented Sep 11, 2014

Good question, @gwern! It would be interesting to see a comparison between Last.fm data and Discogs data for a few representative examples.

@simonbcn
Copy link

simonbcn commented Mar 8, 2016

Last.fm is useful for obtain genres with popular artist/albums. In other case, it's useless.
For example: https://www.discogs.com/es/S%C3%ADlvia-Comes-L%C3%ADdia-Pujol-Al-Entierro-De-Una-Hoja-Seca-Van-Dos-Caracoles/release/3705782 and http://www.last.fm/es/music/S%C3%ADlvia+Comes+&+L%C3%ADdia+Pujol/Al+Entierro+de+una+Hoja+Seca+Van+Dos+Caracoles
There is the album in Last.fm but without genres.

@SpaceAgeHero
Copy link

It would be good to fetch Discogs Release ID as well. It could be useful in case an "update tags" feature is planned.

@dbogdanov
Copy link
Contributor

+1 on the idea to store Release ID. These identifiers are stable, so they are definitely worth storing, just like MBIDs.

@thedevilisinthedetails
Copy link

Is this still something that is pending development? Would love to also have the styles from discogs.

@dbogdanov
Copy link
Contributor

I guess it is, but someone needs to help and add this functionality. Also, Discogs now provides composition identifiers that would be nice to add too, for example https://www.discogs.com/composition/0ad990be-3414-479f-8c9b-73ed43619781-The-Nine

@thedevilisinthedetails
Copy link

K, started looking into this and started some development. As I am new to python it may take some time.

@thedevilisinthedetails
Copy link

Will start working on this to retrieve and store additional discogs values for the attributes listed above.

@sampsyo sampsyo closed this as completed in ca4b101 Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature features we would like to implement
Projects
None yet
Development

No branches or pull requests

7 participants