beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.8k stars 1.82k forks source link

iTunes as metadata source #2915

Open ghost opened 6 years ago

ghost commented 6 years ago

Feature

iTunes plugin for tags. You can use iTunes for album art right now, but what would be great is if you could use iTunes for other tags (e.g. ITUNESADVISORY, genre, etc.) that might not be on MusicBrainz or Discogs.

Someone has done this for Mp3Tag (here) so that might be a helpful starting point for anyone wanting to make this.

sampsyo commented 6 years ago

Sounds reasonable!

nathdwek commented 6 years ago

FYI, unless I am doing something wrong, here is the typical info you would get from the itunes store API:

{
    "wrapperType": "collection",
    "collectionType": "Album",
    "artistId": 487143,
    "collectionId": 1065975633,
    "amgArtistId": 76669,
    "artistName": "Pink Floyd",
    "collectionName": "The Wall",
    "collectionCensoredName": "The Wall",
    "artistViewUrl": "https://itunes.apple.com/us/artist/pink-floyd/487143?uo=4",
    "collectionViewUrl": "https://itunes.apple.com/us/album/the-wall/1065975633?uo=4",
    "artworkUrl60": "https://is4-ssl.mzstatic.com/image/thumb/Music7/v4/e5/9f/fb/e59ffb3b-1283-ee80-56a5-1b983df53ab2/source/60x60bb.jpg",
    "artworkUrl100": "https://is4-ssl.mzstatic.com/image/thumb/Music7/v4/e5/9f/fb/e59ffb3b-1283-ee80-56a5-1b983df53ab2/source/100x100bb.jpg",
    "collectionPrice": 16.99,
    "collectionExplicitness": "notExplicit",
    "trackCount": 27,
    "copyright": "℗ 2016 The copyright in this sound recording is owned by Pink Floyd Music Ltd., marketed and distributed by Sony Music Entertainment",
    "country": "USA",
    "currency": "USD",
    "releaseDate": "1979-11-30T08:00:00Z",
    "primaryGenreName": "Rock"
}

At a glance, useful tags are album artist, album title, release date, track count, country and genre.

You could query for tracks instead of albums (while being careful for rate-limiting!):

{
    "wrapperType": "track",
    "kind": "song",
    "artistId": 487143,
    "collectionId": 1065975633,
    "trackId": 1065975638,
    "artistName": "Pink Floyd",
    "collectionName": "The Wall",
    "trackName": "Another Brick In the Wall, Pt. 2",
    "collectionCensoredName": "The Wall",
    "trackCensoredName": "Another Brick In the Wall, Pt. 2",
    "artistViewUrl": "https://itunes.apple.com/us/artist/pink-floyd/487143?uo=4",
    "collectionViewUrl": "https://itunes.apple.com/us/album/another-brick-in-the-wall-pt-2/1065975633?i=1065975638&uo=4",
    "trackViewUrl": "https://itunes.apple.com/us/album/another-brick-in-the-wall-pt-2/1065975633?i=1065975638&uo=4",
    "previewUrl": "https://audio-ssl.itunes.apple.com/apple-assets-us-std-000001/Music7/v4/c3/11/ae/c311aef0-be7b-35de-193a-b55629d2cb14/mzaf_538320974834743269.plus.aac.p.m4a",
    "artworkUrl30": "https://is4-ssl.mzstatic.com/image/thumb/Music7/v4/e5/9f/fb/e59ffb3b-1283-ee80-56a5-1b983df53ab2/source/30x30bb.jpg",
    "artworkUrl60": "https://is4-ssl.mzstatic.com/image/thumb/Music7/v4/e5/9f/fb/e59ffb3b-1283-ee80-56a5-1b983df53ab2/source/60x60bb.jpg",
    "artworkUrl100": "https://is4-ssl.mzstatic.com/image/thumb/Music7/v4/e5/9f/fb/e59ffb3b-1283-ee80-56a5-1b983df53ab2/source/100x100bb.jpg",
    "collectionPrice": 16.99,
    "trackPrice": 1.29,
    "releaseDate": "1979-11-23T08:00:00Z",
    "collectionExplicitness": "notExplicit",
    "trackExplicitness": "notExplicit",
    "discCount": 2,
    "discNumber": 1,
    "trackCount": 13,
    "trackNumber": 5,
    "trackTimeMillis": 238747,
    "country": "USA",
    "currency": "USD",
    "primaryGenreName": "Rock",
    "isStreamable": true
}

You then get track artist, track length, disc and track number, track genre.

Are there tags that you are especially interested amongst those? Because otherwise you would have to resort to scraping through a non supported API, which would make this less straightforward.

ghost commented 6 years ago

yeh all i would want is the artwork, explicit, and genre

nathdwek commented 6 years ago

iTunes Store has just been re-enabled as a fetchart source, see #2718 , so that should be good news! The explicit tag could be added from itunes easily enough. For the genre, are you not happy with the current providers? On what basis should it be decided where to get the genre from?

ghost commented 6 years ago

Currently, the only option I know of is Last.FM and the last time I scraped from there, it gave me stupid genres like "Collection" and "10/10". There is probably a way to fix this but i like the limited genres of itunes

sampsyo commented 6 years ago

@toadsucks You might want to try the (default) whitelist in the lastgenre plugin, which helps filter out non-genre tags.

nathdwek commented 6 years ago

(Sorry I am not super aware about how beets deals with genres). The problem I see is that if there is currently only on genre provider, the infrastructure to deal with merging genre suggestions from several providers is probably not in place (priorities, which genres strings are equal (cases, plurals, symbols, etc), etc etc).

This makes this issue a bit more complex than just probing and parsing the iTunes Store, but I'd need to take a bit more of a look at the code base before getting started.

Also, I have a hard time believing that musicbrainz does not provide genres out of the box?

sampsyo commented 6 years ago

Yeah, it’s a little funky. I would recommend not focusing on genres for v1.0 of this functionality—it’s always possible to come back around and address that later.

It is true that MB does not have genres. I think they see it as too messy and subjective; they just want to stick to the hard facts.