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

Option to use iTunes Store API to retrieve artwork and/or metadata #1

Closed
mstrelan opened this issue Feb 17, 2013 · 11 comments
Closed

Comments

@mstrelan
Copy link
Contributor

I would love the option to download the artwork and/or show artwork from the iTunes store instead / as well as The TVDB. I will look in to writing a patch for this.

For reference see http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html and as an example https://itunes.apple.com/search?term=Breaking+Bad&attribute=tvSeasonTerm&entity=tvEpisode

@mstrelan
Copy link
Contributor Author

Hoping that this can make it easy - http://pypi.python.org/pypi/python-itunes/1.0

@mdhiggins
Copy link
Owner

This should be doable, I'll have to take some time to familiarize myself with what data iTunes provides but I imagine this wouldn't be hard to implement.

@mstrelan
Copy link
Contributor Author

I've had a further look at the iTunes API, and the Python script. The script doesn't deal with tv shows at all, but we can use the generic search function. The iTunes API doesn't seem to have an option to search for an individual episode. The smallest result set I could find is a list of all episodes in a season. Example URL below:

@mstrelan
Copy link
Contributor Author

I've had a further look at the iTunes API, and the Python script. The script doesn't deal with tv shows at all, but we can use the generic search function. The iTunes API doesn't seem to have an option to search for an individual episode. The smallest result set I could find is a list of all episodes in a season. Example URL below:
http://itunes.apple.com/search?term=Breaking+Bad+Season+5&media=tvShow&entity=tvEpisode&attribute=tvSeasonTerm&limit=200

@mdhiggins
Copy link
Owner

Using that iTunes API here is a quick query that seems to return some metadata. I don't know if iTunes metadata is much less complete than TVDB, as I don't see any other useful results in the XML file.

import itunes

show = "Futurama"
season = 1
episode = 1

q = show + ", Season " + str(season)

items = itunes.search(q, 'tvShow', 'tvEpisode', 'tvSeasonTerm')
for item in items:
    if item.get_disc_number() == episode:
        print item.get_name()
        print item.get_short_desc()
        print item.get_long_desc()
        print item.get_artwork_url()
        print item.get_release_date()

I had to fork that project and add some functionality to be able to pull down most of the TV show parameters that we'd be interested in.

Here is the fork:
https://github.com/mdhiggins/python-itunes

@mstrelan
Copy link
Contributor Author

Awesome, I'll have a bit of a look at this shortly. FYI on GitHub you can submit a "pull request" to the author of python-itunes to merge your changes back in to the original project. He might decline but I can't imagine why.

@mdhiggins
Copy link
Owner

That's a cool feature, once we've got queries for all the metadata that would be a good idea

@mstrelan
Copy link
Contributor Author

It seems pretty lame that the API only returns a 100x100 pixel image, eg http://a452.phobos.apple.com/us/r1000/032/Video/77/84/40/mzl.hdvcjrps.100x100-75
.jpg

If I go to https://itunes.apple.com/au/tv-season/futurama-season-2/id285627519 and get the image URL it is http://a3.mzstatic.com/us/r1000/020/Features/77/84/40/dj.gfrsozhq.170x170-75.jpg which is 170x170.

I can then strip the 170x170-75 from the URL to get the full image which is 1250x1253 px - http://a3.mzstatic.com/us/r1000/020/Features/77/84/40/dj.gfrsozhq.jpg

There doesn't seem to be a way to do that using the URL that the API returns. I suppose you could replace the domain name with http://a3.mzstatic.com/ and then strip the dimensions / quality but I'm not sure if that will work consistently or not.

@mstrelan
Copy link
Contributor Author

The CDN seems to work for a1-8, eg a1.mzstatic.com through a8.mzstatic.com. I tested it on a few different shows including Futurama, Breaking Bad, Arrested Development and New Girl.

I did also find another issue with iTunes API. Sometimes it returns another collection when you search for a season. Eg searching for Breaking Bad, Season 2 returns exactly that PLUS "Breaking Bad, Deluxe Edition: Seasons 1 & 2". I would imagine most of the time the first lot of results would be more accurate, so if we do use this we need to put in checks to ignore the other collections.

I'm starting to think the metadata from iTunes is pretty sucky, but I think I would still like to be able to get the artwork.

@mdhiggins
Copy link
Owner

I think it might be more reliable to just put an option to pull the artwork from iTunes and leave the rest of the metadata from theTVDB. I already implemented better tagging for iTunes (which let me know if those are working better for you cause I don't use iTunes). A lot of the info is missing from the iTunes source anyway.

@viearical
Copy link
Contributor

Does anybody know how or what Subler (https://bitbucket.org/galad87/subler) uses to pull meta data from the iTunes store? That app seems to bee pretty reliably querying all the meta data and full size art work for shows and movies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants