Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * handleTelevision
- * attempt to find television data via the following (in order)
- * 1- By inetref with subtitle
- * 2- By inetref with season and episode
- * 3- By inetref with season
- * 4- By inetref
- * 5- By title and subtitle
- * 6- By title
- */
- MetadataLookupList MetadataDownload::handleTelevision(MetadataLookup *lookup)
- {
- MetadataLookupList list;
- MetaGrabberScript grabber =
- MetaGrabberScript::GetGrabber(kGrabberTelevision, lookup);
- // initial search mode
- if (!lookup->GetInetref().isEmpty() && lookup->GetInetref() != "00000000" &&
- (lookup->GetStep() == kLookupSearch || lookup->GetStep() == kLookupData))
- {
- // with inetref
- lookup->SetStep(kLookupData);
- if (!lookup->GetSubtitle().isEmpty())
- {
- list = grabber.SearchSubtitle(lookup->GetInetref(),
- lookup->GetTitle() /* unused */,
- lookup->GetSubtitle(), lookup, false);
- }
- if (list.isEmpty() && lookup->GetSeason() && lookup->GetEpisode())
- {
- list = grabber.LookupData(lookup->GetInetref(), lookup->GetSeason(),
- lookup->GetEpisode(), lookup);
- }
- if (list.isEmpty() && lookup->GetSeasons())
- {
- list = grabber.LookupData(lookup->GetInetref(),
- lookup->GetSeason(),
- lookup);
- }
- if (list.isEmpty() && !lookup->GetCollectionref().isEmpty())
- {
- list = grabber.LookupCollection(lookup->GetCollectionref(), lookup);
- }
- }
- else if (lookup->GetStep() == kLookupSearch)
- {
- if (lookup->GetTitle().isEmpty())
- {
- // no point searching on nothing...
- return list;
- }
- if (!lookup->GetSubtitle().isEmpty())
- {
- list = grabber.SearchSubtitle(lookup->GetTitle(),
- lookup->GetSubtitle(), lookup, false);
- }
- if (list.isEmpty())
- {
- list = grabber.Search(lookup->GetTitle(), lookup);
- }
- }
- else if (lookup->GetStep() == kLookupCollection)
- {
- list = grabber.LookupCollection(lookup->GetCollectionref(), lookup);
- }
- // Collection Fallback
- // If the lookup allows generic metadata, and the specific
- // season and episode are not available, try for series metadata.
- if (list.isEmpty() && !lookup->GetCollectionref().isEmpty() &&
- lookup->GetAllowGeneric() &&
- lookup->GetStep() == kLookupData)
- {
- lookup->SetStep(kLookupCollection);
- list = grabber.LookupCollection(lookup->GetCollectionref(), lookup);
- }
- return list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement