I am working with a SageTV developer trying to get a functioning scraper for SageTV recorded shows. SageTV has an add-on that provides the necessary JSON response to scrape show information into XBMC. Currently we are having issues parsing the results of the webpage.
Below are the results given from the webpage:
Below is the currently simple scraper code for testing:
Currently the URL is hard-coded into the scraper. That will change later. What appears to be happening is the JSON responses can not be parsed correctly. The XBMC log states:
Below are the results given from the webpage:
Code:
{"MediaFile":{"Airing":{"Channel":{"ChannelLogoCount":2,"IsChannelViewable":true,"StationID":35714,"ChannelNetwork":"PBS Affiliate","IsChannelObject":true,"ChannelDescription":"WKOPDT (WKOP-DT) Knoxville","ChannelNumber":"20-1","ChannelName":"WKOPDT"},"IsShowFirstRun":false,"ParentalRating":"TVY","RealWatchedStartTime":0,"AiringID":2546814,"AiringChannelNumber":"20-1","ScheduleDuration":1800000,"AiringChannelName":"WKOPDT","TrackNumber":0,"ScheduleEndTime":1343737800000,"AiringRatings":["TVY"],"IsNotManualOrFavorite":false,"RealWatchedEndTime":0,"IsAiringHDTV":true,"WatchedEndTime":0,"IsWatched":false,"ExtraAiringDetails":"Closed Captioned, Stereo, HDTV","AiringDuration":1800000,"IsWatchedCompletely":false,"ScheduleStartTime":1343736000000,"LatestWatchedTime":1343736000000,"IsFavorite":true,"RecordingName":"","IsAiringObject":true,"IsManualRecord":false,"Show":{"PeopleListInShow":["William H. Macy","Frank Welker"],"ShowCategoriesList":["Children","Educational","Science","Animated"],"ShowSubCategory":"Educational","ShowRated":"","ShowExternalID":"EP8466780129","ShowCategory":"Children","ShowSeasonNumber":0,"IsShowObject":true,"ShowTitle":"Curious George","ShowCategoriesString":"Children / Educational / Science / Animated","ShowYear":"","ShowEpisode":"Hamster Cam; The Great Monkey Detective","IsShowEPGDataUnique":true,"ShowEpisodeNumber":0,"ShowExpandedRatings":"","OriginalAiringDate":1315440000000,"ShowDuration":0,"PeopleAndCharacterListInShow":["William H. Macy","Frank Welker as George"],"ShowParentalRating":"","ShowLanguage":"","RolesInShow":["Narrator","Actor"],"ShowMisc":"","ShowDescription":"Steve's pet hamster takes off in the city; chef Pisghetti's cookbook vanishes.","PeopleInShow":"William H. Macy, Frank Welker"},"WatchedStartTime":0,"AiringTotalParts":1,"ScheduleRecordingRecurrence":"","AiringEndTime":1343737800000,"AiringPartNumber":1,"RecordingQuality":"","WatchedDuration":0,"IsDontLike":false,"AiringStartTime":1343736000000,"AiringPremiereFinaleInfo":"","AiringTitle":"Curious George","IsShowReRun":true,"AiringAttributeList":["HDTV","Stereo","CC"]},"FileEndTime":1343737800000,"IsPictureFile":false,"MediaFileRelativePath":"","ParentDirectory":"E:\\Recorded TV","IsShowFirstRun":false,"MediaFileFormatDescription":"MPEG2-PS[MPEG2-Video 16:9 1080i@29.97fps, Dolby Digital/192Kbps@48kHz Stereo eng]","MediaFileEncoding":"AverMedia M780 PCIe Digital Video Capture 2 WKOPDT","IsVideoFile":true,"NumberOfSegments":1,"IsMusicFile":false,"IsTVFile":true,"IsThumbnailLoaded":false,"FileDuration":1799999,"IsLibraryFile":false,"Size":2009589135,"IsBluRay":false,"IsLocalFile":true,"IsCompleteRecording":true,"SegmentFiles":["E:\\Recorded TV\\CuriousGeorge-HamsterCamTheGreatMonkeyDetective-2546814-0.mpg"],"MediaFileID":2583924,"GetMediaFileMetadataProperties":{"Item":"Frank Welker"},"IsDVDDrive":false,"IsMediaFileObject":true,"IsFileCurrentlyRecording":false,"IsDVD":false,"IsShowReRun":true,"FileStartTime":1343736000001,"MediaTitle":"Curious George"}}
Below is the currently simple scraper code for testing:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<scraper name="SageTV-BMT" content="tvshows" thumb="icon.png" framework="1.1">
<CreateSearchUrl dest="3">
<RegExp input="$$1" output="<url>http://192.168.0.4:8080/sagex/api?c=plex:GetMediaFileForName&1=\1&encoder=json</url>" dest="3">
<expression noclean="1" clear="yes" />
</RegExp>
</CreateSearchUrl>
<GetSearchResults dest="8">
<RegExp input="$$3" output="<results>\1</results>" dest="8">
<RegExp input="$$1" output="<entity><title>\4</title><url>http://192.168.04:8080/sagex/api?c=plex:GetMediaFileForName&1=\1&encoder=json</url></entity>" dest="3">
<expression repeat="yes">"MediaTitle":"(.+)"</expression>
</RegExp>
</RegExp>
</GetSearchResults>
<GetDetails dest="3">
<RegExp input="$$5" output="<details>\1</details>" dest="3">
<RegExp input="$$1" output="\1" dest="9">
<expression fixchars="1">"MediaTitle":"([^"]*)</expression>
</RegExp>
</RegExp>
</GetDetails>
</scraper>
Currently the URL is hard-coded into the scraper. That will change later. What appears to be happening is the JSON responses can not be parsed correctly. The XBMC log states:
Code:
00:17:11 T:4436 DEBUG: VideoInfoScanner: No NFO file found. Using title search for 'smb://PVR/Media/Recorded TV/AmericanPickers-S01E09-KnowWhentoFold-2581802-0.mpg'
00:17:11 T:4436 DEBUG: ADDON::CScraper::FindMovie: Searching for 'AmericanPickers-S01E09-KnowWhentoFold-2581802-0' using SageTV scraper (path: 'D:\HTPC\Xbmc\portable_data\addons\metadata.sagetv.com', content: 'tvshows', version: '0.0.1')
00:17:11 T:4436 DEBUG: scraper: CreateSearchUrl returned <url>http://192.168.0.4:8080/sagex/api?c=plex:GetMediaFileForName&1=americanpickers-s01e09-knowwhentofold-2581802-0&encoder=json</url>
00:17:11 T:4436 DEBUG: CurlFile::Open(097CE0D8) http://192.168.0.4:8080/sagex/api?c=plex:GetMediaFileForName&1=americanpickers-s01e09-knowwhentofold-2581802-0&encoder=json
00:17:11 T:4436 INFO: XCURL::DllLibCurlGlobal::easy_aquire - Created session to http://192.168.0.4
00:17:11 T:4436 ERROR: ADDON::CScraper::Run: Unable to parse web site