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

Allow video scrapers/NFO files/library import to add any artwork type… #12612

Merged
merged 1 commit into from Jan 10, 2018

Conversation

rmrector
Copy link
Contributor

@rmrector rmrector commented Aug 2, 2017

… for items

Description

Scrapers (along with friends NFO files and library importing from single file XML export) can set any type of artwork (clearlogo, landscape, etc) for items in the video library.

This is such a simple loop change that doesn't disturb the beast that is scrapers, I so very much wish I had found it a couple of years ago when I first went looking for it.

Motivation and Context

The video library has long supported freely named artwork for items in most other places, now scrapers can set this artwork from the beginning.

How Has This Been Tested?

By hand, I modified the new demo Python scrapers and a classic scraper to set some extra artwork, and modified a couple of NFO files to match, then ensuring the results are what I expect. I also refreshed a few items with a regular scraper and ensured they still set their expected artwork.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the Code guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my change
  • All new and existing tests passed

@rmrector
Copy link
Contributor Author

rmrector commented Aug 3, 2017

The build failure for Win-64 looks like it was caused by something else.

@hudokkow
Copy link
Member

hudokkow commented Aug 3, 2017

Sorry, this is not my territory.
jenkins failure indeed seems unrelated. How the hell do I remove my name from review request list?

EDIT: Silly me. Removed myself from reviewers.

@hudokkow hudokkow removed their request for review August 3, 2017 09:59
@rmrector
Copy link
Contributor Author

Anyone have any thoughts on this? This is kind of important, a lot of folks like extended artwork and this has been a big hole in artwork support for awhile now (relying on an add-on seems unnecessary, scrapers can add some artwork so they should be able to add all of it).

One hole is left, Kodi doesn't import extended artwork from image files next to media. I've got Python code that identifies these images just fine, but for some reason I just cannot translate it to Kodi core (C++ noob, gah!).

@zag2me
Copy link
Contributor

zag2me commented Aug 17, 2017

@DaveTBlake was looking at imports and exports recently

@DaveTBlake
Copy link
Member

For music, scraping of video is different, but I am interested in how we can handle art better in core rather than leave it to addons. There is also #11755, which could be of interest.

@rmrector
Copy link
Contributor Author

rmrector commented Sep 4, 2017

@phate89 You've been hard at work on bigger parts of the scrapers, what do you think of this? This code sits up a level higher, as a filter on the data from the scraper before it makes it into the database, and is still useful to your open PR #12661.

@MartijnKaijser With all your work on Artwork Downloader, what do you think of scrapers being able to add more artwork?

@@ -1397,6 +1378,18 @@ namespace VIDEO
art.insert(std::make_pair("fanart", fanart));
}

// add online art
std::vector<CScraperUrl::SUrlEntry>& scraperArt = pItem->GetVideoInfoTag()->m_strPictureURL.m_url;
for (auto i = scraperArt.begin(); i != scraperArt.end(); ++i)

This comment was marked as spam.

@phate89
Copy link
Contributor

phate89 commented Sep 5, 2017

I'm not an expert of artwork code but it seems fine and also simpler. Why did you move the loop after fanart gathering?

@rmrector
Copy link
Contributor Author

rmrector commented Sep 6, 2017

I moved the loop because it can also provide a "fanart" image, but the original fanart section still offers an extra feature, the rarely-used fanart colors for skins, so they should take priority.

I just added a bit that covers what the original art.empty() check did for XML scrapers: it considers artwork with an empty aspect to be "thumb", which is a reasonable assumption and matches scraper behavior for episodes, or "poster" for music videos, which is a quick hack to support the XML music video scrapers that share scraper bits with music album scrapers.

@zag2me
Copy link
Contributor

zag2me commented Sep 6, 2017

Does this work for music scrapers also?

@phate89
Copy link
Contributor

phate89 commented Sep 6, 2017

@rmrector I really don't know anything but I always tought that fanart was only in m_fanart..
We explicitely drop it from arTypes here https://github.com/rmrector/xbmc/blob/f489c22bd92aa374c17b0de62ccaef946c57236f/xbmc/video/VideoInfoScanner.cpp#L1338
But I think it make sense to be able to provide all artwork from one place.. maybe @xhaggi know better
@zag2me these are only video changes. No idea if the same could be done in music part

@rmrector
Copy link
Contributor Author

rmrector commented Sep 7, 2017

@zag2me The music library doesn't support the same wide selection of artwork as the video library in the first place, so it can't be extended this simply and is outside the scope of this PR.

@phate89 This new code doesn't use artTypes when processing scraper artwork (artTypes is what held back the original code), but accepts the first image of each art type/"aspect" the scraper provides, so if the scraper sets an image aspect to "fanart" in addAvailableThumb then it will show up here. I agree that all artwork should work the same, so I didn't want to add an exception to ignore "fanart" here, and I don't want to disturb XML scrapers, so I kept the existing m_fanart as well. If it weren't for that rarely-used feature of fanart, the colors (I like the idea, but I think they should be attached to the TV show and occasionally season rather than each fanart), I'd say Python scrapers shouldn't even have a setAvailableFanart. The only web service that has that info is TheTVDB, and their new v2 API (v1 will disappear soon) doesn't seem to provide the color anymore (nor their beta website), so maybe it should even go away anyway?

I've also push another change to handle season artwork, which is in another section of code. One thing about season artwork is that it doesn't work from Python scrapers in master (with notspiff's initial Python scraper), but does look to be addressed in your PR. I haven't given it a test yet, but I intend to soon; the scraper process has some goofiness with artwork, and I think the Python scraper interface can smooth some of it out.

Edit: And the WIN64 build failure looks unrelated, the rest compiled fine.

@jenkins4kodi jenkins4kodi added the Rebase needed PR that does not apply/merge cleanly to current base branch label Dec 20, 2017
@jenkins4kodi jenkins4kodi removed the Rebase needed PR that does not apply/merge cleanly to current base branch label Dec 20, 2017
Copy link
Contributor

@notspiff notspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the very minors and i will merge this. sorry for the long wait!

{
thumb = CScraperUrl::GetThumbURL(pItem->GetVideoInfoTag()->m_strPictureURL.GetFirstThumb(type));
if (!thumb.empty())
if (thumb.find("http://") == std::string::npos &&

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@rmrector
Copy link
Contributor Author

@notspiff ping.

@notspiff
Copy link
Contributor

jenkins build this please

@notspiff
Copy link
Contributor

@xhaggi i will do a follow up with the cosmetics, let's get this in now.

@notspiff notspiff merged commit f444a90 into xbmc:master Jan 10, 2018
@olympia
Copy link

olympia commented Jan 10, 2018

Cool!
Would someone explain to me (who is unable to read the code) what to change / how to use this in the scrapers?

@notspiff
Copy link
Contributor

you have an 'aspect' tag on the entry that can be "poster", "thumb", etc.

@Rechi Rechi added Type: Improvement non-breaking change which improves existing functionality Component: Video v18 Leia labels Jan 10, 2018
@Rechi Rechi added this to the L 18.0-alpha1 milestone Jan 10, 2018
@rmrector rmrector deleted the the_art_of_scrape branch February 20, 2018 00:51
rmrector added a commit to rmrector/xbmc that referenced this pull request Feb 22, 2019
Small adjustment to xbmc#12612 to keep backward-compatibility with
NFOs exported from Kodi 11 Eden scrapers.
rmrector added a commit to rmrector/xbmc that referenced this pull request Feb 24, 2019
Small adjustment to xbmc#12612 to keep backward-compatibility with
NFOs exported from Kodi 11 Eden scrapers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Video Type: Improvement non-breaking change which improves existing functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants