diff options
17 files changed, 1282 insertions, 337 deletions
diff --git a/addons/metadata.common.imdb.com/addon.xml b/addons/metadata.common.imdb.com/addon.xml index a1ac72594b..c12395421b 100644 --- a/addons/metadata.common.imdb.com/addon.xml +++ b/addons/metadata.common.imdb.com/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="metadata.common.imdb.com" name="IMDB Scraper Library" - version="2.8.8" + version="2.9.1" provider-name="Team Kodi"> <requires> <import addon="xbmc.metadata" version="2.1.0"/> diff --git a/addons/metadata.common.imdb.com/changelog.txt b/addons/metadata.common.imdb.com/changelog.txt index 479fc31191..cca5af3b74 100644 --- a/addons/metadata.common.imdb.com/changelog.txt +++ b/addons/metadata.common.imdb.com/changelog.txt @@ -1,3 +1,10 @@ +[B]2.9.1[/B] +- changed: improved USA rating detection + +[B]2.9.0[/B] +- added: multiple ratings and uniqueid support (requires Kodi v17) +- fixed: another attempt to fix IMDb outline + [B]2.8.8[/B] - fixed: potential issue with IMDb outline (thanks scudlee) diff --git a/addons/metadata.common.imdb.com/imdb.xml b/addons/metadata.common.imdb.com/imdb.xml index a5ee72bb99..16bde91989 100644 --- a/addons/metadata.common.imdb.com/imdb.xml +++ b/addons/metadata.common.imdb.com/imdb.xml @@ -14,7 +14,7 @@ </RegExp> </ParseIMDBGenres> - <GetIMDBRatingById dest="5"> + <GetIMDBRatingById dest="5"> <!-- Compatibility function for Pre-Krypton versions--> <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseIMDBRating">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> <expression noclean="1" /> </RegExp> @@ -28,6 +28,34 @@ </RegExp> </ParseIMDBRating> + <GetIMDBRatingsById dest="5"> + <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseIMDBRatings">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> + <expression noclean="1" /> + </RegExp> + </GetIMDBRatingsById> + <ParseIMDBRatings dest="5"> + <RegExp input="$$2" output="<details>\1</details>" dest="5"> + <RegExp input="$$1" output="<ratings><rating name="imdb" ><value>\1</value><votes>\2</votes></rating></ratings>" dest="2"> + <expression><span\sitemprop="ratingValue">([0-9.]+).*?ratingCount">([0-9,]+)<</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseIMDBRatings> + + <GetIMDBRatingsByIdAsDef dest="5"> + <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseIMDBRatingsAsDef">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> + <expression noclean="1" /> + </RegExp> + </GetIMDBRatingsByIdAsDef> + <ParseIMDBRatingsAsDef dest="5"> + <RegExp input="$$2" output="<details>\1</details>" dest="5"> + <RegExp input="$$1" output="<ratings><rating name="imdb" default="true"><value>\1</value><votes>\2</votes></rating></ratings>" dest="2"> + <expression><span\sitemprop="ratingValue">([0-9.]+).*?ratingCount">([0-9,]+)<</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseIMDBRatingsAsDef> + <GetIMDBTOP250ById dest="5"> <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseIMDBTOP250">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> <expression noclean="1" /> @@ -73,7 +101,7 @@ </RegExp> </ParseIMDBCountry> - <GetMetaCriticRatingById dest="5"> + <GetMetaCriticRatingById dest="5"> <!-- Compatibility function for Pre-Krypton versions--> <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseMetaCriticRating">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> <expression noclean="1" /> </RegExp> @@ -87,6 +115,34 @@ </RegExp> </ParseMetaCriticRating> + <GetMetaCriticRatingsById dest="5"> + <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseMetaCriticRatings">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> + <expression noclean="1" /> + </RegExp> + </GetMetaCriticRatingsById> + <ParseMetaCriticRatings dest="5"> + <RegExp input="$$2" output="<details>\1</details>" dest="5"> + <RegExp input="$$1" output="<ratings><rating name="metacritic" ><value>\1.\2</value></rating></ratings>" dest="2"> + <expression><div\sclass="metacriticScore\sscore_[^\s]+\stitleReviewBarSubItem">.*?<span>(\d*)(\d)</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseMetaCriticRatings> + + <GetMetaCriticRatingsByIdAsDef dest="5"> + <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseMetaCriticRatingsAsDef">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> + <expression noclean="1" /> + </RegExp> + </GetMetaCriticRatingsByIdAsDef> + <ParseMetaCriticRatingsAsDef dest="5"> + <RegExp input="$$2" output="<details>\1</details>" dest="5"> + <RegExp input="$$1" output="<ratings><rating name="metacritic" default="true"><value>\1.\2</value></rating></ratings>" dest="2"> + <expression><div\sclass="metacriticScore\sscore_[^\s]+\stitleReviewBarSubItem">.*?<span>(\d*)(\d)</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseMetaCriticRatingsAsDef> + <GetIMDBPlotById dest="5"> <RegExp input="$$1" output="<details><url cache="$$1-main.html" function="ParseIMDBPlot">http://akas.imdb.com/title/$$1/|accept-language=en-us</url></details>" dest="5"> <expression noclean="1" /> @@ -125,6 +181,9 @@ <RegExp input="$$1" output="<outline>\1</outline>" dest="2"> <expression fixchars="1" trim="1">itemprop="description">(.+?)</div></expression> </RegExp> + <RegExp input="$$1" output="<outline>\1</outline>" dest="2"> + <expression fixchars="1" trim="1">itemprop="description">(.+?)See\sfull\ssummary</expression> + </RegExp> <expression noclean="1" /> </RegExp> </ParseIMDBOutline> @@ -278,7 +337,10 @@ </GetIMDBUSACert> <ParseIMDBUSACert dest="5"> <RegExp input="$$1" output="<details><mpaa>$INFO[certprefix]\1</mpaa></details>" dest="5"> - <expression>MPAA</a>:</h5><div\sclass="info-content">Rated\s([^<]*)</expression> + <expression>>\s*USA:(P?G|PG-13|R|NC-17)</a></expression> + </RegExp> + <RegExp input="$$1" output="<details><mpaa>$INFO[certprefix]\1</mpaa></details>" dest="5"> + <expression>MPAA</a>:</h5><div\sclass="info-content">Rated\s(P?G|PG-13|R|NC-17)</expression> </RegExp> </ParseIMDBUSACert> @@ -286,6 +348,12 @@ <RegExp input="$$1" output="<details><url cache="$$1-combined.html" function="ParseIMDBCountryCert">http://akas.imdb.com/title/$$1/combined|accept-language=en-us</url></details>" dest="5"> <expression noclean="1" /> </RegExp> + <RegExp input="$INFO[imdbcertcountry]" output="$$5" dest="5"> + <RegExp input="$$1" output="<details><url cache="$$1-combined.html" function="ParseIMDBUSACert">http://akas.imdb.com/title/$$1/combined|accept-language=en-us</url></details>" dest="5"> + <expression noclean="1"/> + </RegExp> + <expression>USA</expression> + </RegExp> </GetIMDBCountryCert> <ParseIMDBCountryCert dest="5"> <RegExp input="$$1" output="<details><mpaa>$INFO[certprefix]\1</mpaa></details>" dest="5"> @@ -406,4 +474,4 @@ </RegExp> </ParseIMDBAKATitles> -</scraperfunctions> +</scraperfunctions>
\ No newline at end of file diff --git a/addons/metadata.common.themoviedb.org/addon.xml b/addons/metadata.common.themoviedb.org/addon.xml index ed7cefa721..2d2734bcb3 100644 --- a/addons/metadata.common.themoviedb.org/addon.xml +++ b/addons/metadata.common.themoviedb.org/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="metadata.common.themoviedb.org" name="The Movie Database Scraper Library" - version="2.16.0" + version="2.17.2" provider-name="Team Kodi"> <requires> <import addon="xbmc.metadata" version="2.1.0"/> diff --git a/addons/metadata.common.themoviedb.org/tmdb.xml b/addons/metadata.common.themoviedb.org/tmdb.xml index 8d7f19cabf..9d9ae03ca7 100644 --- a/addons/metadata.common.themoviedb.org/tmdb.xml +++ b/addons/metadata.common.themoviedb.org/tmdb.xml @@ -3,7 +3,7 @@ <GetTMDBCertificationsByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBCertifications" cache="tmdb-cert-\1.json">http://api.tmdb.org/3/movie/\1/releases?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbcertcountry]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBCertifications" cache="tmdb-cert-\1.json">https://api.tmdb.org/3/movie/\1/releases?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbcertcountry]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -20,7 +20,7 @@ <GetTMDBTitleByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBTitle" cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBTitle" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -28,10 +28,16 @@ </GetTMDBTitleByIdChain> <GetTMDBLangTitleByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBTitle" cache="tmdb-$INFO[tmdbtitlelanguage]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtitlelanguage]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBTitle" cache="tmdb-$INFO[tmdbtitlelanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtitlelanguage]</url>" dest="5"> <expression /> </RegExp> - <expression noclean="1" /> + <RegExp input="$INFO[tmdbtitlelanguage]" output="$$5" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBTitle" cache="tmdb-$INFO[tmdbsearchlanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbsearchlanguage]</url>" dest="5"> + <expression/> + </RegExp> + <expression>Keep Original</expression> + </RegExp> + <expression noclean="1"/> </RegExp> </GetTMDBLangTitleByIdChain> <ParseTMDBTitle dest="5"> @@ -39,6 +45,12 @@ <RegExp input="$$1" output="<title>\1</title>" dest="2"> <expression fixchars="1">"title":"([^"]*)</expression> </RegExp> + <RegExp input="$INFO[tmdbtitlelanguage]" output="$$2" dest="2"> + <RegExp input="$$1" output="<title>\1</title>" dest="2"> + <expression fixchars="1">"original_title":"([^"]*)</expression> + </RegExp> + <expression>Keep Original</expression> + </RegExp> <expression noclean="1" /> </RegExp> </ParseTMDBTitle> @@ -48,7 +60,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBPlot" cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBPlot" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -59,7 +71,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBPlot" cache="tmdb-$INFO[tmdbplotlanguage]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbplotlanguage]</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBPlot" cache="tmdb-$INFO[tmdbplotlanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbplotlanguage]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -70,7 +82,7 @@ <RegExp input="$$1" output="\1" dest="9"> <expression clear="yes" fixchars="1">"overview":"(.*?)","</expression> </RegExp> - <RegExp input="$$9" output="<url function="ParseFallbackTMDBPlot" cache="tmdb-en-$$8.json">http://api.tmdb.org/3/movie/$$8?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> + <RegExp input="$$9" output="<url function="ParseFallbackTMDBPlot" cache="tmdb-en-$$8.json">https://api.tmdb.org/3/movie/$$8?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> <expression>^$</expression> </RegExp> <RegExp input="$$9" output="<plot>\1</plot>" dest="2"> @@ -93,7 +105,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBTagline" cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBTagline" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -104,7 +116,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBTagline" cache="tmdb-$INFO[tmdbtaglinelanguage]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtaglinelanguage]</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBTagline" cache="tmdb-$INFO[tmdbtaglinelanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtaglinelanguage]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -115,7 +127,7 @@ <RegExp input="$$1" output="\1" dest="9"> <expression clear="yes" fixchars="1">"tagline":"([^"]*)</expression> </RegExp> - <RegExp input="$$9" output="<url function="ParseFallbackTMDBTagline" cache="tmdb-en-$$8.json">http://api.tmdb.org/3/movie/$$8?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> + <RegExp input="$$9" output="<url function="ParseFallbackTMDBTagline" cache="tmdb-en-$$8.json">https://api.tmdb.org/3/movie/$$8?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> <expression>^$</expression> </RegExp> <RegExp input="$$9" output="<tagline>\1</tagline>" dest="2"> @@ -138,7 +150,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBTags" >http://api.tmdb.org/3/movie/\1/keywords?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBTags" >https://api.tmdb.org/3/movie/\1/keywords?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -158,7 +170,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBSet" cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBSet" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -169,7 +181,7 @@ <RegExp input="$$1" output="\1" dest="8"> <expression clear="yes" noclean="1" /> </RegExp> - <RegExp input="$$8" output="<url function="ParseTMDBSet" cache="tmdb-$INFO[tmdbsetlanguage]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbsetlanguage]</url>" dest="5"> + <RegExp input="$$8" output="<url function="ParseTMDBSet" cache="tmdb-$INFO[tmdbsetlanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbsetlanguage]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -180,7 +192,7 @@ <RegExp input="$$1" output="\1" dest="9"> <expression clear="yes" noclean="1">"belongs_to_collection":\{"id":[0-9]+,"name":"([^"]*)</expression> </RegExp> - <RegExp input="$$9" output="<url function="ParseFallbackTMDBSet" cache="tmdb-en-$$8.json">http://api.tmdb.org/3/movie/$$8?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> + <RegExp input="$$9" output="<url function="ParseFallbackTMDBSet" cache="tmdb-en-$$8.json">https://api.tmdb.org/3/movie/$$8?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> <expression>^$</expression> </RegExp> <RegExp input="$$9" output="<set>\1</set>" dest="2"> @@ -200,10 +212,10 @@ <GetTMDBCastByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">http://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">https://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> - <RegExp input="$$1" output="<url function="ParseTMDBCast" cache="tmdb-cast-\1.json">http://api.tmdb.org/3/movie/\1/casts?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5+"> + <RegExp input="$$1" output="<url function="ParseTMDBCast" cache="tmdb-cast-\1.json">https://api.tmdb.org/3/movie/\1/casts?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5+"> <expression /> </RegExp> <expression noclean="1" /> @@ -226,7 +238,7 @@ <GetTMDBDirectorsByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBDirectors" cache="tmdb-cast-\1.json">http://api.tmdb.org/3/movie/\1/casts?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBDirectors" cache="tmdb-cast-\1.json">https://api.tmdb.org/3/movie/\1/casts?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -246,7 +258,7 @@ <GetTMDBWitersByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBWriters" cache="tmdb-cast-\1.json">http://api.tmdb.org/3/movie/\1/casts?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBWriters" cache="tmdb-cast-\1.json">https://api.tmdb.org/3/movie/\1/casts?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -266,7 +278,7 @@ <GetTMDBGenresByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBGenres" cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBGenres" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -274,7 +286,7 @@ </GetTMDBGenresByIdChain> <GetTMDBLangGenresByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBGenres" cache="tmdb-$INFO[tmdbgenreslanguage]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbgenreslanguage]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBGenres" cache="tmdb-$INFO[tmdbgenreslanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbgenreslanguage]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -292,9 +304,9 @@ </RegExp> </ParseTMDBGenres> - <GetTMDBRatingByIdChain dest="4"> + <GetTMDBRatingByIdChain dest="4"> <!-- Compatibility function for Pre-Krypton versions--> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBRating" cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBRating" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -312,9 +324,49 @@ </RegExp> </ParseTMDBRating> + <GetTMDBRatingsByIdChain dest="4"> + <RegExp input="$$5" output="<details>\1</details>" dest="4"> + <RegExp input="$$1" output="<url function="ParseTMDBRatings" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <expression /> + </RegExp> + <expression noclean="1" /> + </RegExp> + </GetTMDBRatingsByIdChain> + <ParseTMDBRatings dest="5"> + <RegExp input="$$2" output="<details><ratings><rating name="themoviedb">\1</rating></ratings></details>" dest="5"> + <RegExp input="$$1" output="<value>\1</value>" dest="2"> + <expression noclean="1">"vote_average":([^,]*),"</expression> + </RegExp> + <RegExp input="$$1" output="<votes>\1</votes>" dest="2+"> + <expression noclean="1">"vote_count":([0-9]+)</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseTMDBRatings> + + <GetTMDBRatingsByIdAsDefChain dest="4"> + <RegExp input="$$5" output="<details>\1</details>" dest="4"> + <RegExp input="$$1" output="<url function="ParseTMDBRatingsAsDef" cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <expression /> + </RegExp> + <expression noclean="1" /> + </RegExp> + </GetTMDBRatingsByIdAsDefChain> + <ParseTMDBRatingsAsDef dest="5"> + <RegExp input="$$2" output="<details><ratings><rating name="themoviedb" default="true">\1</rating></ratings></details>" dest="5"> + <RegExp input="$$1" output="<value>\1</value>" dest="2"> + <expression noclean="1">"vote_average":([^,]*),"</expression> + </RegExp> + <RegExp input="$$1" output="<votes>\1</votes>" dest="2+"> + <expression noclean="1">"vote_count":([0-9]+)</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseTMDBRatingsAsDef> + <GetTMDBStudioByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBStudio" cache="tmdb-en-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBStudio" cache="tmdb-en-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -334,7 +386,7 @@ <GetTMDBCountryByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBCountry" cache="tmdb-en-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBCountry" cache="tmdb-en-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -354,7 +406,7 @@ <GetTMDBTrailerByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBTrailer" cache="tmdb-trailer-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1/trailers?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBTrailer" cache="tmdb-trailer-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1/trailers?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -362,7 +414,7 @@ </GetTMDBTrailerByIdChain> <GetTMDBLangTrailerByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBTrailer" cache="tmdb-trailer-$INFO[tmdbtrailerlanguage]-\1.json">http://api.tmdb.org/3/movie/\1/trailers?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtrailerlanguage]</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBTrailer" cache="tmdb-trailer-$INFO[tmdbtrailerlanguage]-\1.json">https://api.tmdb.org/3/movie/\1/trailers?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtrailerlanguage]</url>" dest="5"> <expression /> </RegExp> <expression noclean="1" /> @@ -379,7 +431,7 @@ <RegExp input="$$7" output="<trailer>plugin://plugin.video.youtube/?action=play_video&amp;videoid=\1</trailer>" dest="9"> <expression noclean="1">"source":"([^"]*)</expression> </RegExp> - <RegExp input="$$9" output="<url function="ParseTMDBEnTrailer" cache="tmdb-trailer-en-$$8.json">http://api.tmdb.org/3/movie/$$8/trailers?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> + <RegExp input="$$9" output="<url function="ParseTMDBEnTrailer" cache="tmdb-trailer-en-$$8.json">https://api.tmdb.org/3/movie/$$8/trailers?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2"> <expression>^$</expression> </RegExp> <RegExp input="$$9" output="$$9" dest="2"> @@ -399,7 +451,7 @@ <RegExp input="$$7" output="<trailer>plugin://plugin.video.youtube/?action=play_video&amp;videoid=\1</trailer>" dest="9"> <expression noclean="1">"source":"([^"]*)</expression> </RegExp> - <RegExp input="$$9" output="<url function="ParseTMDBAllTrailer" cache="tmdb-trailer-$$8.json">http://api.tmdb.org/3/movie/$$8/trailers?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$9" output="<url function="ParseTMDBAllTrailer" cache="tmdb-trailer-$$8.json">https://api.tmdb.org/3/movie/$$8/trailers?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression>^$</expression> </RegExp> <RegExp input="$$9" output="$$9" dest="2"> @@ -422,10 +474,10 @@ <GetTMDBFanartByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">http://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">https://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> - <RegExp input="$$1" output="<url function="ParseTMDBFanart" cache="tmdb-images-\1.json">http://api.tmdb.org/3/movie/\1/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5+"> + <RegExp input="$$1" output="<url function="ParseTMDBFanart" cache="tmdb-images-\1.json">https://api.tmdb.org/3/movie/\1/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5+"> <expression /> </RegExp> <expression noclean="1" /> @@ -445,10 +497,10 @@ <GetTMDBThumbsByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">http://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">https://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> - <RegExp input="$$1" output="<url function="ParseTMDBThumbs" cache="tmdb-images-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5+"> + <RegExp input="$$1" output="<url function="ParseTMDBThumbs" cache="tmdb-images-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url>" dest="5+"> <expression /> </RegExp> <expression noclean="1" /> @@ -456,10 +508,10 @@ </GetTMDBThumbsByIdChain> <GetTMDBLangThumbsByIdChain dest="4"> <RegExp input="$$5" output="<details>\1</details>" dest="4"> - <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">http://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> + <RegExp input="$$1" output="<url function="ParseTMDBBaseImageURL" cache="tmdb-config.json">https://api.tmdb.org/3/configuration?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="5"> <expression /> </RegExp> - <RegExp input="$$1" output="<url function="ParseTMDBLangThumbs" cache="tmdb-images-$INFO[tmdbthumblanguage]-\1.json">http://api.tmdb.org/3/movie/\1/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbthumblanguage]</url>" dest="5+"> + <RegExp input="$$1" output="<url function="ParseTMDBLangThumbs" cache="tmdb-images-$INFO[tmdbthumblanguage]-\1.json">https://api.tmdb.org/3/movie/\1/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbthumblanguage]</url>" dest="5+"> <expression /> </RegExp> <expression noclean="1" /> @@ -480,12 +532,12 @@ <expression clear="yes">(.+)</expression> </RegExp> <RegExp input="$$9" output="$$12" dest="2+"> - <RegExp input="$INFO[language]" output="<url function="ParseTMDBAllThumbs" cache="tmdb-images-$$8.json">http://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="12"> + <RegExp input="$INFO[language]" output="<url function="ParseTMDBAllThumbs" cache="tmdb-images-$$8.json">https://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="12"> <expression>en</expression> </RegExp> <expression>^$</expression> </RegExp> - <RegExp input="$INFO[language]" output="<url function="ParseTMDBEnThumbs" cache="tmdb-images-en-$$8.json">http://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2+"> + <RegExp input="$INFO[language]" output="<url function="ParseTMDBEnThumbs" cache="tmdb-images-en-$$8.json">https://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2+"> <expression>^((?!en).)*$</expression> </RegExp> <expression noclean="1">(.+)</expression> @@ -506,12 +558,12 @@ <expression clear="yes">(.+)</expression> </RegExp> <RegExp input="$$9" output="$$12" dest="2+"> - <RegExp input="$INFO[tmdbthumblanguage]" output="<url function="ParseTMDBAllThumbs" cache="tmdb-images-$$8.json">http://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="12"> + <RegExp input="$INFO[tmdbthumblanguage]" output="<url function="ParseTMDBAllThumbs" cache="tmdb-images-$$8.json">https://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="12"> <expression>en</expression> </RegExp> <expression>^$</expression> </RegExp> - <RegExp input="$INFO[tmdbthumblanguage]" output="<url function="ParseTMDBEnThumbs" cache="tmdb-images-en-$$8.json">http://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2+"> + <RegExp input="$INFO[tmdbthumblanguage]" output="<url function="ParseTMDBEnThumbs" cache="tmdb-images-en-$$8.json">https://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="2+"> <expression>^((?!en).)*$</expression> </RegExp> <expression noclean="1">(.+)</expression> @@ -531,7 +583,7 @@ <RegExp input="$$9" output="$$9" dest="2"> <expression clear="yes">(.+)</expression> </RegExp> - <RegExp input="$$9" output="<url function="ParseTMDBAllThumbs" cache="tmdb-images-$$8.json">http://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="2"> + <RegExp input="$$9" output="<url function="ParseTMDBAllThumbs" cache="tmdb-images-$$8.json">https://api.tmdb.org/3/movie/$$8/images?api_key=6889f6089877fd092454d00edb44a84d</url>" dest="2"> <expression>^$</expression> </RegExp> <expression noclean="1">(.+)</expression> @@ -558,4 +610,21 @@ </RegExp> </ParseTMDBBaseImageURL> -</scraperfunctions> + <GetTMDBPremieredByIdChain dest="4"> + <RegExp input="$$5" output="<details>\1</details>" dest="4"> + <RegExp input="$$1" output="<url function="ParseTMDBPremiered" cache="tmdb-$INFO[tmdbtitlelanguage]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[tmdbtitlelanguage]</url>" dest="5"> + <expression /> + </RegExp> + <expression noclean="1" /> + </RegExp> + </GetTMDBPremieredByIdChain> + <ParseTMDBPremiered dest="5"> + <RegExp input="$$2" output="<details>\1</details>" dest="5"> + <RegExp input="$$1" output="<premiered>\1</premiered>" dest="2"> + <expression noclean="1">"release_date":"([^"]*)</expression> + </RegExp> + <expression noclean="1" /> + </RegExp> + </ParseTMDBPremiered> + +</scraperfunctions>
\ No newline at end of file diff --git a/addons/metadata.themoviedb.org/addon.xml b/addons/metadata.themoviedb.org/addon.xml index b44bb32284..a45818e004 100644 --- a/addons/metadata.themoviedb.org/addon.xml +++ b/addons/metadata.themoviedb.org/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="metadata.themoviedb.org" name="The Movie Database" - version="3.9.5" + version="4.0.1" provider-name="Team Kodi"> <requires> <import addon="xbmc.metadata" version="2.1.0"/> diff --git a/addons/metadata.themoviedb.org/changelog.txt b/addons/metadata.themoviedb.org/changelog.txt index a179fae878..6e9b28ec22 100644 --- a/addons/metadata.themoviedb.org/changelog.txt +++ b/addons/metadata.themoviedb.org/changelog.txt @@ -1,3 +1,10 @@ +[B]4.0.1[/B] +-switched API queries to https + +[B]4.0.0[/B] +- added: multiple ratings and uniqueid support (requires Kodi v17) -thanks phate89 +- added: premiered date -thanks phate89 + [B]3.9.4[/B] - Fixed after API layout changes diff --git a/addons/metadata.themoviedb.org/resources/language/English (New Zealand)/strings.po b/addons/metadata.themoviedb.org/resources/language/English (New Zealand)/strings.po index 065c74f1a8..9cd97f6c36 100644 --- a/addons/metadata.themoviedb.org/resources/language/English (New Zealand)/strings.po +++ b/addons/metadata.themoviedb.org/resources/language/English (New Zealand)/strings.po @@ -9,37 +9,41 @@ msgstr "" "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Kodi Translation Team\n" -"Language-Team: English (New Zealand) (http://www.transifex.com/projects/p/xbmc-addons/language/en_NZ/)\n" +"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: en_NZ\n" +"Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgctxt "#30000" msgid "Enable Fanart" -msgstr "Enable Fanart" +msgstr "" msgctxt "#30001" msgid "Prefer Trailer from HD-Trailers.net" -msgstr "Prefer Trailer from HD-Trailers.net" +msgstr "" msgctxt "#30002" msgid "Preferred Language" -msgstr "Preferred Language" +msgstr "" msgctxt "#30003" -msgid "Get Rating from" -msgstr "Get Rating from" +msgid "Default Rating from" +msgstr "" msgctxt "#30004" msgid "Enable Trailer (YouTube)" -msgstr "Enable Trailer (YouTube)" +msgstr "" msgctxt "#30005" msgid "Keep Original Title" -msgstr "Keep Original Title" +msgstr "" msgctxt "#30006" msgid "Preferred Certification Country" -msgstr "Preferred Certification Country" +msgstr "" + +msgctxt "#30007" +msgid "Add also IMDb ratings" +msgstr "" diff --git a/addons/metadata.themoviedb.org/resources/language/English (US)/strings.po b/addons/metadata.themoviedb.org/resources/language/English (US)/strings.po index d6cd284953..9cd97f6c36 100644 --- a/addons/metadata.themoviedb.org/resources/language/English (US)/strings.po +++ b/addons/metadata.themoviedb.org/resources/language/English (US)/strings.po @@ -9,33 +9,41 @@ msgstr "" "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Kodi Translation Team\n" -"Language-Team: English (US) (http://www.transifex.com/projects/p/xbmc-addons/language/en_US/)\n" +"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: en_US\n" +"Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgctxt "#30000" msgid "Enable Fanart" -msgstr "Enable Fanart" +msgstr "" + +msgctxt "#30001" +msgid "Prefer Trailer from HD-Trailers.net" +msgstr "" msgctxt "#30002" msgid "Preferred Language" -msgstr "Preferred Language" +msgstr "" msgctxt "#30003" -msgid "Get Rating from" -msgstr "Get Rating from" +msgid "Default Rating from" +msgstr "" msgctxt "#30004" msgid "Enable Trailer (YouTube)" -msgstr "Enable Trailer (YouTube)" +msgstr "" msgctxt "#30005" msgid "Keep Original Title" -msgstr "Keep Original Title" +msgstr "" msgctxt "#30006" msgid "Preferred Certification Country" -msgstr "Preferred Certification Country" +msgstr "" + +msgctxt "#30007" +msgid "Add also IMDb ratings" +msgstr "" diff --git a/addons/metadata.themoviedb.org/resources/language/English/strings.po b/addons/metadata.themoviedb.org/resources/language/English/strings.po index af7124469d..9cd97f6c36 100644 --- a/addons/metadata.themoviedb.org/resources/language/English/strings.po +++ b/addons/metadata.themoviedb.org/resources/language/English/strings.po @@ -29,7 +29,7 @@ msgid "Preferred Language" msgstr "" msgctxt "#30003" -msgid "Get Rating from" +msgid "Default Rating from" msgstr "" msgctxt "#30004" @@ -43,3 +43,7 @@ msgstr "" msgctxt "#30006" msgid "Preferred Certification Country" msgstr "" + +msgctxt "#30007" +msgid "Add also IMDb ratings" +msgstr "" diff --git a/addons/metadata.themoviedb.org/resources/settings.xml b/addons/metadata.themoviedb.org/resources/settings.xml index e59a57950d..2b67ec3725 100644 --- a/addons/metadata.themoviedb.org/resources/settings.xml +++ b/addons/metadata.themoviedb.org/resources/settings.xml @@ -6,5 +6,6 @@ <setting label="30002" type="select" values="bg|cs|da|de|el|en|es|fa|fa-ir|fi|fr|he|hr|hu|it|ja|ko|nb|nl|no|pl|pt|pt-br|ro|ru|sk|sl|sr|sv|th|tr|uk|zh" id="language" default="en"/> <setting label="30006" type="select" values="au|bg|cs|da|de|el|es|fi|fr|gb|he|hr|hu|it|ja|ko|nl|no|pl|pt|ru|sl|sv|th|tr|us|zh" id="tmdbcertcountry" default="us"/> <setting label="30003" type="labelenum" values="TMDb|IMDb" id="RatingS" default="TMDb"/> + <setting label="30007" type="bool" id="imdbanyway" visible="eq(-1,0)" default="false"/> <setting label="certprefix" type="text" id="certprefix" default="Rated " visible="false"/> </settings> diff --git a/addons/metadata.themoviedb.org/tmdb.xml b/addons/metadata.themoviedb.org/tmdb.xml index d01627671d..bb793ed31f 100644 --- a/addons/metadata.themoviedb.org/tmdb.xml +++ b/addons/metadata.themoviedb.org/tmdb.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <scraper framework="1.1" date="2012-01-16"> <CreateSearchUrl dest="3"> - <RegExp input="$$1" output="<url>http://api.tmdb.org/3/search/movie?api_key=6889f6089877fd092454d00edb44a84d&amp;query=\1&amp;year=$$4&amp;language=$INFO[language]</url>" dest="3"> + <RegExp input="$$1" output="<url>https://api.tmdb.org/3/search/movie?api_key=6889f6089877fd092454d00edb44a84d&amp;query=\1&amp;year=$$4&amp;language=$INFO[language]</url>" dest="3"> <RegExp input="$$2" output="\1" dest="4"> <expression clear="yes">(.+)</expression> </RegExp> @@ -9,34 +9,34 @@ </RegExp> </CreateSearchUrl> <NfoUrl dest="3"> - <RegExp input="$$1" output="<details><url>http://api.tmdb.org/3/movie/\2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url><id>\2</id></details>" dest="3"> + <RegExp input="$$1" output="<details><url>https://api.tmdb.org/3/movie/\2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url><id>\2</id></details>" dest="3"> <expression clear="yes" noclean="1">(themoviedb.org/movie/)([0-9]*)</expression> </RegExp> - <RegExp input="$$1" output="<details><url cache="tmdb-$INFO[language]-tt\1.json">http://api.tmdb.org/3/movie/tt\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url><id>tt\1</id></details>" dest="3"> + <RegExp input="$$1" output="<details><url cache="tmdb-$INFO[language]-tt\1.json">https://api.tmdb.org/3/movie/tt\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url><id>tt\1</id></details>" dest="3"> <expression>imdb....?/title/tt([0-9]+)</expression> </RegExp> - <RegExp input="$$1" output="<details><url cache="tmdb-$INFO[language]-tt\1.json">http://api.tmdb.org/3/movie/tt\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url><id>tt\1</id></details>" dest="3"> + <RegExp input="$$1" output="<details><url cache="tmdb-$INFO[language]-tt\1.json">https://api.tmdb.org/3/movie/tt\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url><id>tt\1</id></details>" dest="3"> <expression>imdb....?/Title\?t{0,2}([0-9]+)</expression> </RegExp> </NfoUrl> <GetSearchResults dest="8"> <RegExp input="$$3" output="<results>\1</results>" dest="8"> - <RegExp input="$$1" output="<entity><title>\3</title><id>\2</id><year>\1</year><url cache="tmdb-$INFO[language]-\2.json">http://api.tmdb.org/3/movie/\2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3"> + <RegExp input="$$1" output="<entity><title>\3</title><id>\2</id><year>\1</year><url cache="tmdb-$INFO[language]-\2.json">https://api.tmdb.org/3/movie/\2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3"> <expression repeat="yes">"release_date":"([0-9]+)-.*?"id":([0-9]*),"original_title":"[^"]*","original_language":"[^"]*","title":"([^"]*)"</expression> </RegExp> - <RegExp input="$$1" output="<entity><title>\3</title><id>\2</id><year>\1</year><url cache="tmdb-$INFO[language]-\2.json">http://api.tmdb.org/3/movie/\2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> + <RegExp input="$$1" output="<entity><title>\3</title><id>\2</id><year>\1</year><url cache="tmdb-$INFO[language]-\2.json">https://api.tmdb.org/3/movie/\2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> <expression repeat="yes">"release_date":"([0-9]+)-.*?"id":([0-9]*),"original_title":"([^"]*)","original_language":"[^"]*"</expression> </RegExp> - <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><url cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> + <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><url cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> <expression repeat="yes">"release_date":null.*?"id":([0-9]*),"original_title":"([^"]*)","original_language":"[^"]*"</expression> </RegExp> - <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><year>\3</year><url cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> + <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><year>\3</year><url cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> <expression repeat="yes">"id":([0-9]*).*?title":"[^"]*".*?original_title":"([^"]*)".*?"release_date":"([0-9]+)-</expression> </RegExp> - <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><year>\3</year><url cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> + <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><year>\3</year><url cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> <expression repeat="yes">"id":([0-9]*).*?title":"([^"]*)".*?original_title":"[^"]*".*?"release_date":"([0-9]+)-</expression> </RegExp> - <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><url cache="tmdb-$INFO[language]-\1.json">http://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> + <RegExp input="$$1" output="<entity><title>\2</title><id>\1</id><url cache="tmdb-$INFO[language]-\1.json">https://api.tmdb.org/3/movie/\1?api_key=6889f6089877fd092454d00edb44a84d&amp;language=$INFO[language]</url></entity>" dest="3+"> <expression repeat="yes">"id":([0-9]*).*?title":"([^"]*)".*?original_title":"[^"]*".*?"release_date":null</expression> </RegExp> <expression noclean="1" /> @@ -44,12 +44,15 @@ </GetSearchResults> <GetDetails dest="3"> <RegExp input="$$5" output="<details>\1</details>" dest="3"> - <RegExp input="$$1" output="<id>\1</id>" dest="5"> - <expression noclean="1">"id":([0-9]*),"imdb</expression> + <RegExp input="$$1" output="<uniqueid type="themoviedb" default="true">$$2</uniqueid>" dest="5"> + <expression/> </RegExp> - <RegExp input="$$1" output="<id>\1</id>" dest="5+"> + <RegExp input="$$1" output="\1" dest="11"> <expression clear="yes" noclean="1">"id":[0-9]*,"imdb_id":"([^"]*)</expression> </RegExp> + <RegExp input="$$11" output="<uniqueid type="imdb">\1</uniqueid>" dest="5+"> + <expression>(.+)</expression> + </RegExp> <RegExp input="$$1" output="\1" dest="9"> <expression fixchars="1">"original_title":"([^"]*)</expression> </RegExp> @@ -71,19 +74,25 @@ <RegExp input="$$1" output="\1" dest="10"> <expression clear="yes" noclean="1">"runtime":([0-9]+)</expression> </RegExp> - <RegExp input="$$10" output="<url function="ParseFallbackTMDBRuntime" cache="tmdb-en-$$2.json">http://api.tmdb.org/3/movie/$$2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="5+"> + <RegExp input="$$10" output="<url function="ParseFallbackTMDBRuntime" cache="tmdb-en-$$2.json">https://api.tmdb.org/3/movie/$$2?api_key=6889f6089877fd092454d00edb44a84d&amp;language=en</url>" dest="5+"> <expression>^$</expression> </RegExp> <RegExp input="$$10" output="<runtime>\1</runtime>" dest="5+"> <expression>(.+)</expression> </RegExp> - <RegExp input="$INFO[RatingS]" output="<chain function="GetIMDBRatingById">$$6</chain>" dest="5+"> - <RegExp input="$$1" output="\1" dest="6"> - <expression noclean="1">"id":[0-9]*,"imdb_id":"([^"]*)</expression> + <RegExp input="$INFO[RatingS]" output="$$6" dest="5+"> + <RegExp input="$$11" output="<chain function="GetIMDBRatingsByIdAsDef">\1</chain>" dest="6"> + <expression>(.+)</expression> + </RegExp> + <RegExp input="" output="<chain function="GetTMDBRatingsByIdChain">$$2</chain>" dest="6+"> + <expression/> </RegExp> <expression>IMDb</expression> </RegExp> - <RegExp input="$INFO[RatingS]" output="<chain function="GetTMDBRatingByIdChain">$$2</chain>" dest="5+"> + <RegExp input="$INFO[RatingS]" output="<chain function="GetTMDBRatingsByIdAsDefChain">$$2</chain>$$7" dest="5+"> + <RegExp input="$11" conditional="imdbanyway" output="<chain function="GetIMDBRatingsById">$$11</chain>" dest="7"> + <expression>(.+)</expression> + </RegExp> <expression>TMDb</expression> </RegExp> <RegExp input="$$2" output="<chain function="GetTMDBStudioByIdChain">$$2</chain>" dest="5+"> diff --git a/addons/metadata.tvdb.com/addon.xml b/addons/metadata.tvdb.com/addon.xml index b04f2a5ddc..90bf985f9b 100644 --- a/addons/metadata.tvdb.com/addon.xml +++ b/addons/metadata.tvdb.com/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="metadata.tvdb.com" name="The TVDB" - version="1.8.5" + version="2.0.4" provider-name="Team Kodi"> <requires> <import addon="xbmc.metadata" version="2.1.0"/> diff --git a/addons/metadata.tvdb.com/changelog.txt b/addons/metadata.tvdb.com/changelog.txt index d8698b406c..9cc6563131 100644 --- a/addons/metadata.tvdb.com/changelog.txt +++ b/addons/metadata.tvdb.com/changelog.txt @@ -1,3 +1,25 @@ +[B]2.0.4[/B] +- Fixed: Moved IMDb ratings to prevent clearing buffers before GetActors + +[B]2.0.3[/B] +- Fixed: IMDb series ratings +- Changed: Added the www back to the artwork URLs +- Changed: Turn fallback language on by default + +[B]2.0.2[/B] +- Fixed: Special episode placement +- Fixed: Episode thumbnails only when available +- Added: Use fallback language for artwork lookup + +[B]2.0.1[/B] +- Fixed: Backwards-compatibility code + +[B]2.0.0[/B] +- Updated: Complete rewrite for TVDB API 2.0 +- Added: Language fallback options +- Added: Merged DVD order split-episodes +- Added: Pseudo-absolute order for when not specified by TVDB + [B]1.8.4[/B] - Added: Runtime for tvshows - needs Krypton or newer diff --git a/addons/metadata.tvdb.com/resources/language/English/strings.po b/addons/metadata.tvdb.com/resources/language/English/strings.po index 56ce742847..9e3b25632d 100644 --- a/addons/metadata.tvdb.com/resources/language/English/strings.po +++ b/addons/metadata.tvdb.com/resources/language/English/strings.po @@ -43,3 +43,12 @@ msgstr "" msgctxt "#30006" msgid "Use TheTVDB Ratings in case IMDb is missing" msgstr "" + +msgctxt "#30007" +msgid "Use a fallback language for search and details" +msgstr "" + +msgctxt "#30008" +msgid "Fallback language" +msgstr "" + diff --git a/addons/metadata.tvdb.com/resources/settings.xml b/addons/metadata.tvdb.com/resources/settings.xml index cf7f034eab..a85487fd08 100644 --- a/addons/metadata.tvdb.com/resources/settings.xml +++ b/addons/metadata.tvdb.com/resources/settings.xml @@ -6,6 +6,8 @@ <setting label="30002" type="bool" id="fanart" default="true" /> <setting type="sep" /> <setting label="30004" type="select" id="language" values="cs|da|de|el|en|es|fi|fr|he|hr|hu|it|ja|ko|nl|no|pl|pt|ru|sl|sv|tr|zh" sort="yes" default="en" /> + <setting label="30007" type="bool" id="usefallbacklanguage1" subsetting="true" default="true"/> + <setting label="30008" type="select" id="fallbacklanguage" values="cs|da|de|el|en|es|fi|fr|he|hr|hu|it|ja|ko|nl|no|pl|pt|ru|sl|sv|tr|zh" subsetting="true" sort="yes" visible="eq(-1,true)" default="en" /> <setting label="30005" type="labelenum" values="TheTVDB|IMDb" id="RatingS" default="TheTVDB"/> <setting label="30006" type="bool" id="fallback" subsetting="true" visible="eq(-1,1)" default="true"/> </settings> diff --git a/addons/metadata.tvdb.com/tvdb.xml b/addons/metadata.tvdb.com/tvdb.xml index 48e482e336..589e1a1a5c 100644 --- a/addons/metadata.tvdb.com/tvdb.xml +++ b/addons/metadata.tvdb.com/tvdb.xml @@ -1,355 +1,1090 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- should be self-explanatory --> <scraper framework="1.1" date="2013-04-04"> - <NfoUrl dest="3"> - <RegExp input="$$1" output="<url cache="\1-$INFO[language].xml">http://thetvdb.com/api/439DFEBA9D3059C6/series/\1/all/$INFO[language].zip</url><id>\1</id>" dest="3"> - <expression>http://(?:www\.)?thetvdb.com/(?:index\.php)?\?tab=series&id=([0-9]+)</expression> + + <!-- input : $$1=nfo file --> + <!-- output: <url>*</url><id>*</id> --> + <NfoUrl dest="3" clearbuffers="no"> + <RegExp input="$$1" output="tt\1" dest="7"> + <expression clear="yes">imdb\....?/title/tt([0-9]*)</expression> + </RegExp> + <RegExp input="$$1" output="tt\1" dest="7"> + <expression>imdb\....?/title\?([0-9]*)</expression> + </RegExp> + <RegExp input="$$7" output="<details><url function="GetTVDBId" post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6"}|Content-Type=application/json</url></details>" dest="3"> + <expression>(?!^$)</expression> </RegExp> - <RegExp input="$$1" output="<details><url cache="tt\1.xml" function="GetTVDBId">http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=tt\1&amp;language=$INFO[language]</url></details>" dest="3+"> - <expression>imdb....?/title/tt([0-9]*)</expression> + <RegExp input="$$1" output="\1" dest="6"> + <expression clear="yes">https?://(?:www\.)?thetvdb.com/(?:index\.php)?\?tab=series&id=([0-9]+)</expression> </RegExp> - <RegExp input="$$1" output="<details><url cache="tt\1.xml" function="GetTVDBId">http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=tt\1&amp;language=$INFO[language]</url></details>" dest="3+"> - <expression>imdb....?/Title\?([0-9]*)</expression> + <RegExp input="$$6" output="<details><url function="NfoUrlAuth" post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6"}|Content-Type=application/json</url></details>" dest="3"> + <expression>(?!^$)</expression>> </RegExp> </NfoUrl> - - <GetTVDBId dest="3"> - <RegExp input="$$1" output="<details><url cache="\1-$INFO[language].xml">http://thetvdb.com/api/439DFEBA9D3059C6/series/\1/all/$INFO[language].zip</url><id>\1</id></details>" dest="3"> - <expression><seriesid>([0-9]*)</seriesid></expression> + <NfoUrlAuth dest="3" clearbuffers="no"> + <RegExp input="$$19" output="<details><url cache="$$6-$INFO[language].xml">https://api.thetvdb.com/series/$$6|Authorization=Bearer%20\1&Accept-Language=$INFO[language]</url><id>$$6</id></details>" dest="3"> + <RegExp input="$$1" output="\1" dest="19"> + <expression>"token": "(.*)"</expression> + </RegExp> + <expression noclean="1"/> </RegExp> - </GetTVDBId> - - <EpisodeGuideUrl dest="3"> - <RegExp input="$$1" output="\1" dest="3"> - <expression>(.*?http://www.thetvdb.com.*)</expression> + </NfoUrlAuth> + <GetTVDBId dest="3" clearbuffers="no"> + <RegExp input="$$19" output="<details><url function="GetTVDBIdAuth" cache="search-$$7-$INFO[language].json">https://api.thetvdb.com/search/series?imdbId=$$7|Authorization=Bearer%20\1&Accept-Language=$INFO[language]</url></details>" dest="3"> + <RegExp input="$$1" output="\1" dest="19"> + <expression>"token": "(.*)"</expression> + </RegExp> + <expression noclean="1"/> </RegExp> - <RegExp input="$$1" output="\1" dest="3"> - <expression>(.*?http://thetvdb.com.*)</expression> + </GetTVDBId> + <GetTVDBIdAuth dest="3" clearbuffers="no"> + <RegExp input="$$1" output="<details><url cache="\1-$INFO[language].xml">https://api.thetvdb.com/series/\1|Authorization=Bearer%20$$19&Accept-Language=$INFO[language]</url><id>\1</id></details>" dest="3"> + <expression>"id": (\d+),</expression> </RegExp> - </EpisodeGuideUrl> + </GetTVDBIdAuth> - <!-- input: $1=query string --> - <!-- returns: the url we should use to do the search --> - <CreateSearchUrl dest="3"> - <RegExp input="$$1" output="<url cache="cache-\1$$4-$INFO[language].xml">http://thetvdb.com/api/GetSeries.php?seriesname=\1$$4&amp;language=$INFO[language]</url>" dest="3"> - <RegExp input="$$2" output="%20(\1)" dest="4"> - <expression clear="yes">(.+)</expression> - </RegExp> + <!-- input : $$1=query string --> + <!-- output: <url>*</url> --> + <CreateSearchUrl dest="3" clearbuffers="no"> + <RegExp input="" output="<url post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6"}|Content-Type=application/json</url>" dest="3"> <expression/> </RegExp> + <RegExp input="$$1" output="\1" dest="5"> + <expression noclean="1"/> + </RegExp> </CreateSearchUrl> - - <!-- input: $1=html $2=search query --> - <!-- returns: results in xml format <results><movie><title>*</title><url>*</url>*#urls<extra>*</extra></movie>*</results> --> - <GetSearchResults dest="1"> - <RegExp input="$$4" output="<?xml version="1.0" encoding="utf-8" standalone="yes"?><results>\1</results>" dest="1"> - <RegExp input="$$1" output="<entity><title>\3</title><language>\2</language><url cache="\1-$INFO[language].xml">http://thetvdb.com/api/439DFEBA9D3059C6/series/\1/all/$INFO[language].zip</url><id>\1</id></entity>" dest="4"> - <expression repeat="yes"><seriesid>([0-9]*)</seriesid>[^<]*<language>([^<]*)</language>[^<]*<SeriesName>([^<]*)</SeriesName></expression> + <GetSearchResults dest="3" clearbuffers="no"> + <RegExp input="$$4" output="<results>\1</results>" dest="3"> + <RegExp input="$$1" output="\1" dest="19"> + <expression>"token": "(.*)"</expression> + </RegExp> + <RegExp input="$INFO[language]" output="\1" dest="16"> + <expression/> + </RegExp> + <RegExp input="" output="<url function="GetSearchResultsAuth" cache="search-$$5-$INFO[language].json">https://api.thetvdb.com/search/series?name=$$5|Authorization=Bearer%20$$19&Accept-Language=$INFO[language]</url>" dest="4"> + <expression noclean="1"/> + </RegExp> + <RegExp conditional="usefallbacklanguage1" input="$INFO[language]" output="<chain function="SwitchLanguage">$INFO[fallbacklanguage]</chain><url function="GetSearchResultsAuth" cache="search-$$5-$INFO[fallbacklanguage].json">https://api.thetvdb.com/search/series?name=$$5|Authorization=Bearer%20$$19&Accept-Language=$INFO[fallbacklanguage]</url>" dest="4+"> + <expression>^(?!\Q$INFO[fallbacklanguage]\E$)</expression> </RegExp> <expression noclean="1"/> </RegExp> </GetSearchResults> - <!-- input: $1..#urls=html --> - <!-- input: $(#urls+1): extra !--> - <!-- returns: results in xml format <details><plot>*</plot><director>*</director><premiered>*</premiered><episodeguide>*</episodeguide></details> --> - <GetDetails dest="7"> + <SwitchLanguage dest="3" clearbuffers="no"> + <RegExp input="" output="<details><!-- $$1 --></details>" dest="3"> + <RegExp input="$$1" output="\1" dest="16"> + <expression/> + </RegExp> + <expression noclean="1"/> + </RegExp> + </SwitchLanguage> + + <!-- input : $$1=search html --> + <!-- input : $$2=search url --> + <!-- output: <results><entity><title>*</title><year>*</year><language>*</language><url>*</url><id>*</id></entity>*</results> --> + <GetSearchResultsAuth dest="6" clearbuffers="no"> + <RegExp input="$$1" output="<series><id>\3</id><seriesName>\4</seriesName><aliases>\1</aliases><firstAired>\2</firstAired></series>" dest="4"> + <expression repeat="yes" fixchars="1,4">"aliases": \[([^]]*)\],\s+"banner": "[^"]*",\s+"firstAired": "([^"]*)",\s+"id": (\d+),\s+"network": "[^"]*",\s+"overview": (?:"[^}]*"|null),\s+"seriesName": "([^}]*)",</expression> + </RegExp> + <RegExp input="" output="" dest="6"> + <expression/> + </RegExp> + <XSLT input="<data>$$4</data>" output="\1" dest="6"> + <xsl:stylesheet version = "1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output encoding="UTF-8" indent="yes"/> + + <xsl:variable name="notAllowedId">313081</xsl:variable> + + <xsl:template match="data"> + <results> + <xsl:apply-templates select="series[id!=$notAllowedId]"/> + <xsl:apply-templates select="series[id!=$notAllowedId]" mode="alias"/> + </results> + </xsl:template> + + <xsl:template match="series"> + <xsl:call-template name="entity"> + <xsl:with-param name="title" select="normalize-space(seriesName)"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="series" mode="alias"> + <xsl:call-template name="split-aliases"> + <xsl:with-param name="title-list" select="concat(normalize-space(aliases),', ')"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="split-aliases"> + <xsl:param name="title-list"/> + <xsl:variable name="first" select="substring-after(substring-before($title-list, '", '), '"')" /> + <xsl:variable name="remaining" select="substring-after($title-list, '", ')" /> + <xsl:if test="$first!=''"> + <xsl:call-template name="entity"> + <xsl:with-param name="title" select="$first"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$remaining!=''"> + <xsl:call-template name="split-aliases"> + <xsl:with-param name="title-list" select="$remaining" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="entity"> + <xsl:param name="title"/> + <entity> + <title><xsl:value-of select="$title"/></title> + <year><xsl:value-of select="substring(firstAired,1,4)"/></year> + <language>$$16</language> + <url><xsl:attribute name="cache"><xsl:value-of select="id"/>-$INFO[language].json</xsl:attribute>https://api.thetvdb.com/series/<xsl:value-of select="id"/>|Authorization=Bearer%20$$19&Accept-Language=$INFO[language]</url> + <id><xsl:value-of select="id"/></id> + </entity> + </xsl:template> + + </xsl:stylesheet> + </XSLT> + </GetSearchResultsAuth> + + <!-- input : $$1=series html --> + <!-- input : $$2=id --> + <!-- input : $$3=series url --> + <!-- output: <details><title>*</title><plot>*</plot><id>*</id>...etc...<episodeguide>*</episodeguide></details> --> + <GetDetails dest="7" clearbuffers="no"> <RegExp input="$$4" output="<?xml version="1.0" encoding="utf-8" standalone="yes"?><details>\1</details>" dest="7"> - <RegExp input="$$1" output="\1" dest="5"> - <expression noclean="1"><Series>.*?<id>$$2</id>(.*)</expression> + <RegExp input="$$3" output="\1" dest="19"> + <expression>Authorization=Bearer%20(.+)&Accept-Language</expression> </RegExp> - <RegExp input="$$5" output="<plot>\1</plot>" dest="4"> - <expression noclean="1"><Overview>([^<]*)</Overview></expression> + <RegExp input="" output="" dest="14"> + <expression clear="yes"/> </RegExp> - <RegExp input="$$2" output="<id>\1</id>" dest="4+"> - <expression/> + <RegExp input="$$1" output="<id>\1</id>" dest="4"> + <expression clear="yes">"id": (\d+),</expression> </RegExp> - <RegExp input="$$1" output="<mpaa>\1</mpaa>" dest="4+"> - <expression><ContentRating>([^<]*)</ContentRating></expression> + <RegExp input="$$1" output="<title>\1</title>" dest="4+"> + <expression fixchars="1">"seriesName": "(.*)",\s+"aliases"</expression> </RegExp> - <RegExp input="$$5" output="<premiered>\1</premiered>" dest="4+"> - <expression><FirstAired>([^<]*)</FirstAired></expression> + <RegExp conditional="usefallbacklanguage1" input="$$1" output="missingtitle|" dest="14"> + <expression clear="yes">"seriesName": null,\s+"aliases"</expression> </RegExp> - <RegExp input="$$5" output="<runtime>\1</runtime>" dest="4+"> - <expression><Runtime>([^<]+)</Runtime></expression> + <RegExp input="$$1" output="<premiered>\1</premiered>" dest="4+"> + <expression>"firstAired": "([^"]*)",</expression> </RegExp> - <RegExp input="$INFO[RatingS]" output="$$12" dest="4+"> - <RegExp input="$$5" output="<rating>\1</rating>" dest="12+"> - <expression><Rating>([^<]+)</Rating></expression> - </RegExp> - <RegExp input="$$5" output="<votes>\1</votes>" dest="12+"> - <expression><RatingCount>([^<]+)</RatingCount></expression> - </RegExp> - <expression>TheTVDB</expression> + <RegExp input="$$1" output="<runtime>\1</runtime>" dest="4+"> + <expression>"runtime": "([^"]*)",</expression> </RegExp> - <RegExp input="$INFO[RatingS]" output="$$13" dest="4+"> - <RegExp input="$$5" output="\1" dest="11"> - <expression clear="yes"><IMDB_ID>([^<]+)</IMDB_ID></expression> - </RegExp> - <RegExp input="$$11" output="\1" dest="13"> - <RegExp conditional="fallback" input="$$5" output="<rating>\1</rating>" dest="13+"> - <expression><Rating>([^<]+)</Rating></expression> - </RegExp> - <RegExp conditional="fallback" input="$$5" output="<votes>\1</votes>" dest="13+"> - <expression><RatingCount>([^<]+)</RatingCount></expression> + <RegExp input="$$1" output="<studio>\1</studio>" dest="4+"> + <expression fixchars="1">"network": "([^"]*)",</expression> + </RegExp> + <RegExp input="$$7" output="<plot>\1</plot>" dest="4+"> + <RegExp input="$$6\r" output="\1\n" dest="7"> + <RegExp input="$$1" output="\1" dest="6"> + <expression clear="yes" noclean="1">"overview": "(.*)",\s+"lastUpdated"</expression> </RegExp> - <expression>^$</expression> - </RegExp> - <RegExp input="$$11" output="<chain function="GetIMDBRatingById">$$11</chain>" dest="13"> - <expression>(.+)</expression> + <expression clear="yes" repeat="yes" fixchars="1">(.*?)\\r</expression> </RegExp> - <expression>IMDb</expression> - </RegExp> - <RegExp input="$$5" output="<studio>\1</studio>" dest="4+"> - <expression><Network>([^<]*)</Network></expression> - </RegExp> - <RegExp input="$$5" output="<title>\1</title>" dest="4+"> - <expression><SeriesName>([^<]*)</SeriesName></expression> + <expression noclean="1">(?!^$)(.*)</expression> </RegExp> - <RegExp input="$$5" output="\1" dest="10"> - <expression noclean="1"><Genre>([^<]*)</Genre></expression> + <RegExp conditional="usefallbacklanguage1" input="$$1" output="missingplot|" dest="14+"> + <expression>"overview": null,\s+"lastUpdated"</expression> </RegExp> - <RegExp input="$$10" output="<genre>\1</genre>" dest="4+"> - <expression repeat="yes">([^\|]*)\|</expression> - </RegExp> - <RegExp input="$$10" output="<genre>\1</genre>" dest="4+"> - <expression repeat="yes">([^,]*),</expression> + <RegExp input="$$1" output="<mpaa>\1</mpaa>" dest="4+"> + <expression>"rating": "([^"]*)",</expression> </RegExp> - <RegExp input="$$10" output="<genre>\1</genre>" dest="4+"> - <expression>([^\|,]+)$</expression> + <RegExp input="$$5" output="<genre>\1</genre>" dest="4+"> + <RegExp input="$$1" output="\1" dest="5"> + <expression clear="yes">"genre": \[([^]]*)\]</expression> + </RegExp> + <expression noclean="1" repeat="yes">"([^"]+)"</expression> </RegExp> - <!-- actors with thumbs --> - <RegExp input="$$5" output="<actor><name>\2</name><role>\3</role><thumb>http://thetvdb.com/banners/\1</thumb></actor>" dest="4+"> - <expression repeat="yes" noclean="1,2,3"><Actor>.*?<Image>([^<]+)</Image>.*?<Name>([^<]*)</Name>.*?<Role>([^<]*)</expression> + <RegExp input="$INFO[language]" output="$$5" dest="4+"> + <RegExp input="$$14" output="<url function="GetFallbackDetails" cache="$$2-$INFO[fallbacklanguage].json">https://api.thetvdb.com/series/$$2|Authorization=Bearer%20$$19&Accept-Language=$INFO[fallbacklanguage]</url>" dest="5"> + <expression clear="yes">(?!^$)</expression> + </RegExp> + <expression>(?!^\Q$INFO[fallbacklanguage]\E$)</expression> </RegExp> - <!-- actors without thumbs --> - <RegExp input="$$5" output="<actor><name>\2</name><role>\3</role></actor>" dest="4+"> - <expression repeat="yes" noclean="1,2,3"><Actor>.*?<Image>([^<]*)</Image>.*?<Name>([^<]*)</Name>.*?<Role>([^<]*)</expression> + <RegExp input="$$1" output="<chain function="GetActors">\1</chain>" dest="4+"> + <expression noclean="1">"id": (\d+),</expression> </RegExp> - <RegExp input="$$2" output="<chain function="GetArt">\1</chain>" dest="4+"> - <expression/> + <RegExp input="$$1" output="<chain function="GetArt">\1</chain>" dest="4+"> + <expression noclean="1">"id": (\d+),</expression> </RegExp> - <RegExp input="$$3" output="\1" dest="6"> - <expression>.*/(.*).zip</expression> + <RegExp input="$$5" output="\1" dest="4+"> + <RegExp input="$$1" output="<rating>\1</rating>" dest="5"> + <expression clear="yes">"siteRating": (?:(\d+(?:\.\d)?)|null)</expression> + </RegExp> + <RegExp input="$$1" output="<votes>\1</votes>" dest="5+"> + <expression>"siteRatingCount": (?:(\d+)|null)\s+}</expression> + </RegExp> + <RegExp input="$INFO[RatingS]" output="$$6" dest="5"> + <RegExp input="$$7" output="<chain function="GetIMDBRatingById">$$7</chain>" dest="6"> + <RegExp input="$$1" output="\1" dest="7"> + <expression clear="yes">"imdbId": "(tt\d+)",</expression> + </RegExp> + <expression clear="yes">(?!^$)</expression> + </RegExp> + <RegExp conditional="fallback" input="$$7" output="$$5" dest="6"> + <expression>^$</expression> + </RegExp> + <expression>IMDb</expression> + </RegExp> + <expression noclean="1"/> </RegExp> - <RegExp input="$$3" output="<episodeguide><url cache="$$2-$$6.xml">\1</url></episodeguide>" dest="4+"> - <expression/> + <RegExp input="$$1" output="<episodeguide><url post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6","id":\1}|Content-Type=application/json</url></episodeguide>" dest="4+"> + <expression noclean="1">"id": (\d+),</expression> </RegExp> <expression noclean="1"/> </RegExp> </GetDetails> - - <GetArt dest="3"> + <GetFallbackDetails dest="3" clearbuffers="no"> <RegExp input="$$4" output="<details>\1</details>" dest="3"> - <RegExp input="$$1" output="<url function="ParseArt" cache="\1-$INFO[language].xml">http://thetvdb.com/api/439DFEBA9D3059C6/series/\1/banners.xml</url>" dest="4"> - <expression/> + <RegExp input="$$14" output="$$5" dest="4"> + <RegExp input="$$1" output="<title>\1</title>" dest="5"> + <expression clear="yes" fixchars="1">"seriesName": "(.*)",\s+"aliases"</expression> + </RegExp> + <expression clear="yes">missingtitle</expression> + </RegExp> + <RegExp input="$$14" output="$$5" dest="4+"> + <RegExp input="$$7" output="<plot>\1</plot>" dest="5"> + <RegExp input="$$6\r" output="\1\n" dest="7"> + <RegExp input="$$1" output="\1" dest="6"> + <expression clear="yes" noclean="1">"overview": "(.*)",\s+"lastUpdated"</expression> + </RegExp> + <expression repeat="yes" fixchars="1">(.*?)\\r</expression> + </RegExp> + <expression noclean="1"/> + </RegExp> + <expression>missingplot</expression> </RegExp> <expression noclean="1"/> </RegExp> - </GetArt> - <ParseArt dest="3"> - <RegExp input="$$4" output="<details>\1</details>" dest="3"> - <RegExp input="$$1" output="<thumb aspect="banner">http://thetvdb.com/banners/\1</thumb>" dest="4"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>series</BannerType>[^<]*<BannerType2>graphical</BannerType2>[^<]*<Language>$INFO[language]</Language></expression> + </GetFallbackDetails> + <GetActors dest="3" clearbuffers="no"> + <RegExp input="$$1" output="<details><url function="ParseActors" cache="\1-actors.json">https://api.thetvdb.com/series/\1/actors|Authorization=Bearer%20$$19</url></details>" dest="3"> + <expression noclean="1"/> + </RegExp> + </GetActors> + <ParseActors dest="4"> + <RegExp input="$$5" output="<details>\1</details>" dest="4"> + <RegExp input="$$1" output="<actor><name>\1</name><role>\2</role><order>\3</order><thumb>http://www.thetvdb.com/banners/\4</thumb></actor>" dest="5"> + <expression repeat="yes" fixchars="1,2">"name": "([^}]+)",\s+"role": "([^}]+)",\s+"sortOrder": (\d+),\s+"image": "([^"]+)",</expression> </RegExp> - <RegExp input="$$1" output="<thumb aspect="banner">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>series</BannerType>[^<]*<BannerType2>graphical</BannerType2>[^<]*<Language>((?!$INFO[language])[a-z])*</Language></expression> + <RegExp input="$$1" output="<actor><name>\1</name><role>\2</role><order>\3</order></actor>" dest="5+"> + <expression repeat="yes" fixchars="1,2">"name": "([^}]+)",\s+"role": "([^}]+)",\s+"sortOrder": (\d+),\s+"image": (?:""|null),</expression> </RegExp> - <RegExp input="$$1" output="<thumb aspect="banner">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>series</BannerType>[^<]*<BannerType2>text</BannerType2>[^<]*<Language>$INFO[language]</Language></expression> + <expression noclean="1"/> + </RegExp> + </ParseActors> + <GetArt dest="3" clearbuffers="no"> + <RegExp input="$$4" output="<details>\1</details>" dest="3"> + <RegExp input="$$1" output="<url function="GetArtAuth" post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6","id":\1}|Content-Type=application/json" dest="4"> + <expression/> </RegExp> - <RegExp input="$$1" output="<thumb aspect="banner">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>series</BannerType>[^<]*<BannerType2>text</BannerType2>[^<]*<Language>((?!$INFO[language])[a-z])*</Language></expression> + <RegExp input="$$1" output="\1" dest="18"> + <expression/> </RegExp> - <RegExp input="$$1" output="<thumb aspect="banner">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>series</BannerType>[^<]*<BannerType2>blank</BannerType2>[^<]*<Language></Language></expression> + <expression noclean="1"/> + </RegExp> + </GetArt> + <GetArtAuth dest="3" clearbuffers="no"> + <RegExp input="$$4" output="<details>\1</details>" dest="3"> + <RegExp input="$$1" output="\1" dest="19"> + <expression>"token": "(.*)"</expression> </RegExp> - <RegExp input="$$1" output="<thumb aspect="poster" type="season" season="\2">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>season</BannerType>[^<]*<BannerType2>season</BannerType2>[^<]*<Language>$INFO[language]</Language>[^<]*[^S]*Season>([0-9]+)</Season></expression> + <RegExp input="" output="" dest="10"> + <expression/> </RegExp> - <RegExp input="$$1" output="<thumb aspect="poster" type="season" season="\3">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>season</BannerType>[^<]*<BannerType2>season</BannerType2>[^<]*<Language>((?!$INFO[language])[a-z])*</Language>[^<]*[^S]*Season>([0-9]+)</Season></expression> + <RegExp input="" output="<url function="GetArtParams" cache="$$18-art-params.json">https://api.thetvdb.com/series/$$18/images/query/params|Authorization=Bearer%20$$19</url>" dest="4"> + <expression/> </RegExp> - <RegExp input="$$1" output="<thumb aspect="banner" type="season" season="\2">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>season</BannerType>[^<]*<BannerType2>seasonwide</BannerType2>[^<]*<Language>$INFO[language]</Language>[^<]*[^S]*Season>([0-9]+)</Season></expression> + <RegExp input="" output="<chain function="ParseArt"></chain>" dest="4+"> + <expression/> </RegExp> - <RegExp input="$$1" output="<thumb aspect="banner" type="season" season="\3">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>season</BannerType>[^<]*<BannerType2>seasonwide</BannerType2>[^<]*<Language>((?!$INFO[language])[a-z])*</Language>[^<]*[^S]*Season>([0-9]+)</Season></expression> + <expression noclean="1"/> + </RegExp> + </GetArtAuth> + <GetArtParams dest="3" clearbuffers="no"> + <RegExp input="$$4" output="<details>\1</details>" dest="3"> + <RegExp input="$INFO[language]" output="\1" dest="16"> + <expression/> </RegExp> - <RegExp input="$$1" output="<thumb aspect="poster">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>poster</BannerType></expression> + <RegExp input="$$1" output="<url function="LoadArt" cache="$$18-art-\1-$$16.json">https://api.thetvdb.com/series/$$18/images/query?keyType=\1|Authorization=Bearer%20$$19&Accept-Language=$$16</url>" dest="4"> + <expression clear="yes" repeat="yes">"keyType": "([^"]+)"</expression> </RegExp> - <RegExp input="$$1" output="<thumb aspect="poster" type="season" season="-1">http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>poster</BannerType></expression> + <RegExp conditional="usefallbacklanguage1" input="$INFO[fallbacklanguage]" output="$$5" dest="4+"> + <RegExp input="" output="<chain function="SwitchLanguage">$INFO[fallbacklanguage]</chain>" dest="5"> + <expression noclean="1"/> + </RegExp> + <RegExp input="$$1" output="<url function="LoadArt" cache="$$18-art-\1-$INFO[fallbacklanguage].json">https://api.thetvdb.com/series/$$18/images/query?keyType=\1|Authorization=Bearer%20$$19&Accept-Language=$INFO[fallbacklanguage]</url>" dest="5+"> + <expression repeat="yes">"keyType": "([^"]+)"</expression> + </RegExp> + <expression>^(?!\Q$$16\E$|en$)</expression> </RegExp> - <RegExp conditional="fanart" input="$$5" output="<fanart url="http://thetvdb.com/banners/">\1</fanart>" dest="4+"> - <RegExp input="$$1" output="<thumb dim="\2" colors="\3" preview="_cache/\1">\1</thumb>" dest="5"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>fanart</BannerType>[^<]*<BannerType2>([^<]*)</BannerType2>[^<]*<Colors>([^<]*)</Colors>[^<]*<Language>$INFO[language]</Language></expression> + <RegExp input="$$16" output="$$5" dest="4+"> + <RegExp input="" output="<chain function="SwitchLanguage">en</chain>" dest="5"> + <expression noclean="1"/> </RegExp> - <RegExp input="$$1" output="<thumb dim="\2" colors="\3" preview="_cache/\1">\1</thumb>" dest="5+"> - <expression repeat="yes"><BannerPath>([^<]*)</BannerPath>[^<]*<BannerType>fanart</BannerType>[^<]*<BannerType2>([^<]*)</BannerType2>[^<]*<Colors>([^<]*)</Colors>[^<]*<Language>((?!$INFO[language])[a-z])*</Language></expression> + <RegExp input="$$1" output="<url function="LoadArt" cache="$$18-art-\1-en.json">https://api.thetvdb.com/series/$$18/images/query?keyType=\1|Authorization=Bearer%20$$19&Accept-Language=en</url>" dest="5+"> + <expression repeat="yes">"keyType": "([^"]+)"</expression> </RegExp> - <expression noclean="1"/> + <expression>^(?!en)</expression> </RegExp> <expression noclean="1"/> </RegExp> + </GetArtParams> + <LoadArt dest="3" clearbuffers="no"> + <RegExp input="$$1" output="<details><!-- $$16 \1 loaded --></details>" dest="3"> + <RegExp input="$$1" output="<Banner><id>\1</id><keyType>\2</keyType><subKey>\3</subKey><fileName>\4</fileName><resolution>\5</resolution><average>\6</average><thumbnail>\7</thumbnail><language>$$16</language></Banner>" dest="10+"> + <expression repeat="yes">"id": (\d+),\s+"keyType": "([^"]+)",\s+"subKey": "([^"]*)",\s+"fileName": "([^"]+)",\s+"resolution": "([^"]*)",\s+"ratingsInfo": {\s+"average": (?:([\d\.]+)|null),\s+"count": \d+\s+},\s+"thumbnail": "([^"]+)"</expression> + </RegExp> + <expression noclean="1">"keyType": "([^"]+)",</expression> + </RegExp> + </LoadArt> + <ParseArt dest="4" clearbuffers="no"> + <RegExp input="" output="" dest="4"> + <expression/> + </RegExp> + <XSLT input="<Banners>$$10</Banners>" output="\1" dest="4"> + <xsl:stylesheet version = "1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output omit-xml-declaration="yes" indent="yes"/> + <xsl:strip-space elements="*"/> + <xsl:key name="BannersById" match="Banner" use="id"/> + + <xsl:template match="Banners"> + <details> + <fanart url="http://www.thetvdb.com/banners/"> + <xsl:apply-templates select="Banner[(keyType='fanart') and (generate-id()=generate-id(key('BannersById', id)[1]))]"> + <xsl:sort data-type="number" order="descending" select="average"/> + </xsl:apply-templates> + </fanart> + <xsl:apply-templates select="Banner[(keyType!='fanart') and (generate-id()=generate-id(key('BannersById', id)[1]))]"> + <xsl:sort data-type="number" order="ascending" select="(1 * number(keyType='poster')) + + (2 * number(keyType='series')) + + (3 * number(keyType='season')) + + (4 * number(keyType='seasonwide'))"/> + <xsl:sort data-type="number" order="ascending" select="(1 * number(subKey='graphical')) + + (2 * number(subKey='text')) + + (3 * number(subKey='blank')) + + (4 * number(subKey))"/> + <xsl:sort data-type="number" order="ascending" select="(1 * number(language='$INFO[language]')) + + (2 * number((language='$INFO[fallbacklanguage]') and ('$INFO[language]'!='$INFO[fallbacklanguage]'))) + + (3 * number((language!='$INFO[language]') and (language!='$INFO[fallbacklanguage]')))"/> + <xsl:sort data-type="number" order="descending" select="average"/> + </xsl:apply-templates> + <xsl:apply-templates select="Banner[((keyType='poster') or (keyType='series')) and (generate-id()=generate-id(key('BannersById', id)[1]))]" mode="allseasons"/> + </details> + </xsl:template> + + <xsl:template match="Banner[keyType='fanart']"> + <thumb> + <xsl:attribute name="dim"><xsl:value-of select="resolution"/></xsl:attribute> + <xsl:attribute name="preview"><xsl:value-of select="thumbnail"/></xsl:attribute> + <xsl:value-of select="fileName"/> + </thumb> + </xsl:template> + + <xsl:template match="Banner"> + <thumb> + <xsl:attribute name="aspect"> + <xsl:choose> + <xsl:when test="(keyType='poster') or (keyType='season')">poster</xsl:when> + <xsl:otherwise>banner</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:if test="(keyType='season') or (keyType='seasonwide')"> + <xsl:attribute name="type">season</xsl:attribute> + <xsl:attribute name="season"><xsl:value-of select="subKey"/></xsl:attribute> + </xsl:if> + <xsl:attribute name="language"><xsl:value-of select="language"/></xsl:attribute>http://www.thetvdb.com/banners/<xsl:value-of select="fileName"/> + </thumb> + </xsl:template> + + <xsl:template match="Banner" mode="allseasons"> + <thumb> + <xsl:attribute name="aspect"> + <xsl:choose> + <xsl:when test="(keyType='poster')">poster</xsl:when> + <xsl:otherwise>banner</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="type">season</xsl:attribute> + <xsl:attribute name="season">-1</xsl:attribute> + <xsl:attribute name="language"><xsl:value-of select="language"/></xsl:attribute>http://www.thetvdb.com/banners/<xsl:value-of select="fileName"/></thumb> + </xsl:template> + + </xsl:stylesheet> + </XSLT> </ParseArt> - <!-- input: $1=html !--> - <!-- input: $2=series url !--> - <!-- returns: results in xml format <episodeguide><episode><title>*</title><url>*</url><season>*</season><epnum>*</epnum><thumb>*</thumb><id>*</id><aired>*</aired></episode>*</episodeguide> !--> - <GetEpisodeList dest="3"> + <!-- input : $$1=episodeguide html --> + <!-- input : $$2=episodeguide url --> + <!-- output: <episodeguide><episode><title>*</title><url>*</url><season>*</season><epnum>*</epnum><thumb>*</thumb><id>*</id><aired>*</aired></episode>*</episodeguide> !--> + <GetEpisodeList dest="3" clearbuffers="no"> + <RegExp input="$$5" output="<episodeguide>\1</episodeguide>" dest="3"> + <RegExp input="$$1" output="\1" dest="19"> + <expression clear="yes">"token": "(.*)"</expression> + </RegExp> + <RegExp input="$$2" output="\1" dest="18"> + <expression>"id":(\d+)}</expression> + </RegExp> + <RegExp input="$$19" output="<url function="GetEpisodeListAuth" cache="episodes-$$18-1-$INFO[language].json">https://api.thetvdb.com/series/$$18/episodes|Authorization=Bearer%20$$19&Accept-Language=$INFO[language]</url>" dest="5"> + <expression clear="yes">(?!^$)</expression> + </RegExp> + + <!-- Backwards-compatibility code. Scraper will still fail if/when the old URLs 404 (or similar), as this function just won't be run. --> + <RegExp input="$$2" output="<url function="GetEpisodeList" post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6","id":\1}|Content-Type=application/json</url>" dest="5"> + <expression>http://(?:www\.)?thetvdb\.com/api/.+/series/(\d+)/all/</expression> + </RegExp> + <RegExp input="$$2" output="https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6","id":\1}|Content-Type=application/json" dest="2"> + <expression>http://(?:www\.)?thetvdb\.com/api/.+/series/(\d+)/all/</expression> + </RegExp> + <expression noclean="1"/> + </RegExp> + </GetEpisodeList> + <GetEpisodeListAuth dest="3" clearbuffers="no"> <RegExp input="$$4" output="<episodeguide>\1</episodeguide>" dest="3"> - <RegExp input="$$2" output="\2-\3" dest="10"> - <expression>http://(?:www\.)?thetvdb.com/api/(.+)/series/([0-9]*)/all/(.+).zip</expression> - </RegExp> - <RegExp conditional="!dvdorder"> - <!-- Regular episodes (Absolute order) --> - <RegExp conditional="absolutenumber" input="$$1" output="<episode><id>\1</id><title>\2</title><aired>\3</aired><epnum>\4</epnum><season>1</season><url cache="$$10.xml">$$2</url></episode>" dest="4+"> - <expression repeat="yes"><Episode>.*?<id>([0-9]*).*?<EpisodeName>([^<]*).*?<FirstAired>([^<]*).*?<absolute_number>([0-9]*).*?</Episode></expression> - </RegExp> - <!-- Specials (Absolute order) --> - <RegExp conditional="absolutenumber" input="$$1" output="<episode><id>\1</id><title>\2</title><aired>\4</aired><epnum>\3</epnum><season>0</season><url cache="$$10.xml">$$2</url></episode>" dest="4+"> - <expression repeat="yes"><Episode>.*?<id>([0-9]*).*?<EpisodeName>([^<]*).*?<EpisodeNumber>([0-9]*).*?<FirstAired>([^<]*).*?<SeasonNumber>0</SeasonNumber>.*?</Episode></expression> - </RegExp> - <!-- Normal episodes --> - <RegExp conditional="!absolutenumber" input="$$1" output="<episode><title>\2</title><url cache="$$10.xml">$$2</url><epnum>\3</epnum><season>\5</season><id>\1</id><aired>\4</aired></episode>" dest="4"> - <expression repeat="yes"><Episode>.*?<id>([0-9]+).*?<EpisodeName>([^<]*).*?<EpisodeNumber>([0-9]+)[^<]*.*?<FirstAired>([^<]*)</FirstAired>.*?<SeasonNumber>([0-9]+)[^<]*.*?</Episode></expression> - </RegExp> + <RegExp input="$$1" output="<Data><last>\1</last></Data>" dest="5"> + <expression>"last": (\d+),</expression> </RegExp> - <!-- DVD order --> - <RegExp conditional="dvdorder" input="$$1" output="<episode><title>\4</title><url cache="$$10.xml">$$2</url><epnum>\2</epnum><season>\3</season><id>\1</id><aired>\5</aired></episode>" dest="4"> - <expression repeat="yes"><Episode>.*?<id>([0-9]+).*?<Combined_episodenumber>([^<]*).*?<Combined_season>([^<]*).*?<EpisodeName>([^<]*).*?<FirstAired>([^<]*)</FirstAired>.*?</Episode></expression> + <RegExp input="" output="" dest="4"> + <expression/> + </RegExp> + <RegExp input="" output="" dest="11"> + <expression/> </RegExp> + <XSLT input="$$5" output="\1" dest="4"> + <xsl:stylesheet version = "1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output omit-xml-declaration="yes" indent="yes"/> + <xsl:strip-space elements="*"/> + <xsl:template match="Data"> + <xsl:call-template name="generatelinks"> + <xsl:with-param name="current" select="'1'"/> + <xsl:with-param name="last" select="last"/> + </xsl:call-template> + <chain function="ParseEpisodeList"></chain> + </xsl:template> + <xsl:template name="generatelinks"> + <xsl:param name="current"/> + <xsl:param name="last"/> + <xsl:if test="$last>=$current"> + <url><xsl:attribute name="function">LoadEpisodeList</xsl:attribute><xsl:attribute name="cache">episodes-$$18-<xsl:value-of select="$current"/>-$INFO[language].json</xsl:attribute>https://api.thetvdb.com/series/$$18/episodes?page=<xsl:value-of select="$current"/>|Authorization=Bearer%20$$19&Accept-Language=$INFO[language]</url> + <xsl:call-template name="generatelinks"> + <xsl:with-param name="current" select="$current+1"/> + <xsl:with-param name="last" select="last"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + </xsl:stylesheet> + </XSLT> <expression noclean="1"/> </RegExp> - </GetEpisodeList> + </GetEpisodeListAuth> + <LoadEpisodeList dest="4" clearbuffers="no"> + <RegExp input="" output="<episodeguide></episodeguide>" dest="4"> + <RegExp input="$$1" output="<Episode><absolute_number>\1</absolute_number><EpisodeNumber>\2</EpisodeNumber><SeasonNumber>\3</SeasonNumber><DVD_episodenumber>\4</DVD_episodenumber><DVD_season>\5</DVD_season><EpisodeName>\6</EpisodeName><FirstAired>\7</FirstAired><id>\8</id><Overview>\9</Overview><filename>episodes/$$18/\8.jpg</filename></Episode>" dest="11+"> + <expression fixchars="6,9" repeat="yes">"absoluteNumber": (?:(\d+)|null),\s+"airedEpisodeNumber": (\d+),\s+"airedSeason": (\d+),\s+"airedSeasonID": \d+,\s+"dvdEpisodeNumber": (?:([\d\.]+)|null),\s+"dvdSeason": (?:(\d+)|null),\s+"episodeName": (?:"([^}]*)"|null),\s+"firstAired": (?:"([^"]*)"|null),\s+"id": (\d+),\s+"language": {[^}]+},\s+"lastUpdated": \d+,\s+"overview": (?:"([^}]*)"|null)\s+}</expression> + </RegExp> + <RegExp input="$$11" output="yes" dest="20"> + <expression clear="yes">(?!^$)</expression> + </RegExp> + <expression/> + </RegExp> + </LoadEpisodeList> + + <ParseEpisodeList dest="4" clearbuffers="no"> + <RegExp input="" output="" dest="4"> + <expression clear="yes"/> + </RegExp> + <RegExp input="" output="" dest="12"> + <expression clear="yes"/> + </RegExp> + <XSLT input="<Data>$$11</Data>" output="\1" dest="12"> + <xsl:stylesheet version = "1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output omit-xml-declaration="yes" indent="yes"/> + <xsl:strip-space elements="*"/> + <xsl:key name="EpisodesBySeason" match="Episode" use="SeasonNumber"/> + <xsl:template match="Data"> + <xsl:if test="'$INFO[absolutenumber]'='true'"> + <xsl:variable name="season-list"> + <xsl:for-each select="//Episode[(SeasonNumber>0) and (generate-id() = generate-id(key('EpisodesBySeason', SeasonNumber)[1]))]"><xsl:sort select="SeasonNumber" data-type="number"/><xsl:value-of select="SeasonNumber"/>|</xsl:for-each> + </xsl:variable> + <xsl:call-template name="count-episodes"> + <xsl:with-param name="season-list" select="$season-list"/> + <xsl:with-param name="count-list" select="'|S1|0'"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="count-episodes"> + <xsl:param name="season-list"/> + <xsl:param name="count-list"/> + <xsl:variable name="first" select="substring-before($season-list,'|')"/> + <xsl:variable name="remaining" select="substring-after($season-list,'|')"/> + <xsl:variable name="currList" select="concat($count-list, '|S', string($first+1), '|', string(count(//Episode[SeasonNumber=$first])+substring-after($count-list,concat('|S',$first,'|'))))"/> + <xsl:choose> + <xsl:when test="substring-after($remaining,'|')!=''"> + <xsl:call-template name="count-episodes"> + <xsl:with-param name="season-list" select="$remaining"/> + <xsl:with-param name="count-list" select="$currList"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise><xsl:value-of select="$currList"/>|</xsl:otherwise> + </xsl:choose> + </xsl:template> + </xsl:stylesheet> + </XSLT> + <XSLT input="<Data>$$11</Data>" output="\1" dest="4"> + <xsl:stylesheet version = "1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output omit-xml-declaration="yes" indent="yes"/> + <xsl:strip-space elements="*"/> + <xsl:key name="EpisodesByDVDnumber" match="Episode" use="concat(DVD_season,',',substring-before(DVD_episodenumber,'.'))"/> + <xsl:key name="EpisodesBySeason" match="Episode" use="SeasonNumber"/> + <xsl:variable name="title-divider" select="' / '"/> + + <xsl:variable name="SeasonCounts"> + <xsl:if test="'$INFO[absolutenumber]'='true'">$$12</xsl:if> + </xsl:variable> + + <xsl:template match="Data"> + <episodeguide> + <xsl:comment> Episode order: <xsl:choose><xsl:when test="'$INFO[dvdorder]'='true'">DVD </xsl:when><xsl:when test="'$INFO[absolutenumber]'='true'">Absolute </xsl:when><xsl:otherwise>Aired </xsl:otherwise></xsl:choose></xsl:comment> + <xsl:apply-templates select="Episode"/> + <xsl:if test="'$INFO[dvdorder]'='true'"> + <xsl:apply-templates select="Episode[(substring-after(DVD_episodenumber,'.')>0) and (generate-id() = generate-id(key('EpisodesByDVDnumber', concat(DVD_season,',',substring-before(DVD_episodenumber,'.')))[1]))]" mode="dvdmergedep"/> + </xsl:if> + </episodeguide> + </xsl:template> + + <xsl:template match="Episode"> + <episode> + <id><xsl:value-of select="id"/></id> + <title><xsl:value-of select="EpisodeName"/></title> + <aired><xsl:value-of select="FirstAired"/></aired> + <xsl:choose> + <xsl:when test="'$INFO[dvdorder]'!='true'"> + <xsl:choose> + <xsl:when test="('$INFO[absolutenumber]'='true') and ((SeasonNumber>0) or (absolute_number!=''))"> + <epnum> + <xsl:choose> + <xsl:when test="absolute_number!=''"><xsl:value-of select="absolute_number"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-before(substring-after($SeasonCounts, concat('|S', SeasonNumber, '|')), '|') + EpisodeNumber"/></xsl:otherwise> + </xsl:choose> + </epnum> + <season>1</season> + </xsl:when> + <xsl:when test="('$INFO[absolutenumber]'='true') and (SeasonNumber=0)"><epnum><xsl:value-of select="EpisodeNumber"/></epnum><season>0</season></xsl:when> + <xsl:otherwise><epnum><xsl:value-of select="EpisodeNumber"/></epnum><season><xsl:value-of select="SeasonNumber"/></season></xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="(DVD_episodenumber!='') and (DVD_season!='')"> + <epnum><xsl:value-of select="DVD_episodenumber"/></epnum> + <season><xsl:value-of select="DVD_season"/></season> + </xsl:when> + <xsl:otherwise> + <epnum><xsl:value-of select="EpisodeNumber"/><xsl:if test="key('EpisodesByDVDnumber', concat(SeasonNumber,',',EpisodeNumber))">.<xsl:value-of select="count(key('EpisodesByDVDnumber', concat(SeasonNumber,',',EpisodeNumber))[(DVD_episodenumber!='') and (substring-after(DVD_episodenumber,'.')!='0')])+1"/></xsl:if></epnum> + <season><xsl:value-of select="SeasonNumber"/></season> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <url post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6","id":<xsl:value-of select="id"/>}|Content-Type=application/json&Accept-Language=$INFO[language]</url> + </episode> + </xsl:template> - <!-- input: $1=html --> - <!-- returns: results in xml format <details><writer>*</writer><director>*</director><cast>*</cast><rating>*</rating><rank>*</rank><plot>*</plot> --> - <GetEpisodeDetails dest="3"> - <RegExp input="$$4" output="<?xml version="1.0" encoding="utf-8" standalone="yes"?><details>\1</details>" dest="3"> - <RegExp input="$$1" output="\1" dest="8"> - <expression noclean="1"><Episode>.*?<id>$$2</id>(.*?)</Episode></expression> + <xsl:template match="Episode" mode="dvdmergedep"> + <xsl:variable name="mergedid"><xsl:for-each select="key('EpisodesByDVDnumber', concat(DVD_season,',',substring-before(DVD_episodenumber,'.')))"><xsl:sort select="substring-after(DVD_episodenumber,'.')" data-type="number"/><xsl:value-of select="id"/>|</xsl:for-each></xsl:variable> + <xsl:variable name="title"><xsl:for-each select="key('EpisodesByDVDnumber', concat(DVD_season,',',substring-before(DVD_episodenumber,'.')))"><xsl:sort select="substring-after(DVD_episodenumber,'.')" data-type="number"/><xsl:value-of select="concat(normalize-space(EpisodeName),$title-divider)"/></xsl:for-each></xsl:variable> + <xsl:variable name="mergedtitle"> + <xsl:call-template name="shrink-title"> + <xsl:with-param name="full-title" select="$title" /> + <xsl:with-param name="title-list" select="substring-after($title,$title-divider)" /> + <xsl:with-param name="test-title" select="substring(substring-before($title,$title-divider),1,string-length(substring-before($title,$title-divider))-4)" /> + </xsl:call-template> + </xsl:variable> + <episode> + <id><xsl:value-of select="substring($mergedid,1,string-length($mergedid)-1)"/></id> + <title><xsl:value-of select="$mergedtitle"/></title> + <aired><xsl:value-of select="FirstAired"/></aired> + <epnum><xsl:value-of select="substring-before(DVD_episodenumber,'.')"/></epnum> + <season><xsl:value-of select="DVD_season"/></season> + <url post="yes" cache="auth.json">https://api.thetvdb.com/login?{"apikey":"439DFEBA9D3059C6","id":<xsl:value-of select="$mergedid"/>}|Content-Type=application/json</url> + </episode> + </xsl:template> + + <xsl:template name="shrink-title"> + <xsl:param name="full-title"/> + <xsl:param name="title-list"/> + <xsl:param name="test-title"/> + <xsl:variable name="first" select="substring-before($title-list,$title-divider)"/> + <xsl:variable name="remaining" select="substring-after($title-list,$title-divider)"/> + <xsl:choose> + <xsl:when test="$test-title!=substring($first,1,string-length($first)-4)"><xsl:value-of select="substring($full-title,1,string-length($full-title)-string-length($title-divider))"/></xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$remaining=''"><xsl:value-of select="$test-title"/></xsl:when> + <xsl:otherwise> + <xsl:call-template name="shrink-title"> + <xsl:with-param name="full-title" select="$full-title" /> + <xsl:with-param name="title-list" select="$remaining" /> + <xsl:with-param name="test-title" select="$test-title" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + </xsl:stylesheet> + </XSLT> + </ParseEpisodeList> + + <!-- input : $$1=episode html --> + <!-- input : $$2=id --> + <!-- input : $$3=episode url --> + <!-- output: <details><title>*</title><plot>*</plot><uniqueid>*</uniqueid><aired>*</aired><episode>*</episode><season>*</season></details> --> + <GetEpisodeDetails dest="4" clearbuffers="no"> + <RegExp input="$$5" output="<details>\1<chain function="ParseEpisodeDetails"></chain></details>" dest="4"> + <RegExp input="$$3" output="\1" dest="18"> + <expression>"id":(\d+)}</expression> </RegExp> - <RegExp input="$$1" output="<uniqueid>$$2</uniqueid>" dest="4"> - <expression/> + <RegExp input="$$1" output="\1" dest="19"> + <expression>"token": "(.*)"</expression> </RegExp> - <RegExp input="$$8" output="<plot>\1</plot>" dest="4+"> - <expression><Overview>([^<]*)</Overview></expression> + <RegExp input="$$2|" output="<url function="GetEpisodeDetailsAuth" cache="episode-\1-$INFO[language].json">https://api.thetvdb.com/episodes/\1|Authorization=Bearer%20$$19&amp;Accept-Language=$INFO[language]</url>" dest="5"> + <expression noclean="1" repeat="yes">(\d+)\|</expression> </RegExp> - <RegExp input="$$8" output="\1" dest="6"> - <expression noclean="1"><Writer>([^<]*)</Writer></expression> + <RegExp input="$$1" output="" dest="13"> + <expression clear="yes"/> </RegExp> - <RegExp input="$$6" output="<credits>\1</credits>" dest="4+"> - <expression repeat="yes">([^\|]*)\|</expression> + <expression noclean="1"/> + </RegExp> + </GetEpisodeDetails> + <GetEpisodeDetailsAuth dest="4" clearbuffers="no"> + <RegExp input="$$5" output="<details>\1</details>" dest="4"> + <RegExp input="" output="" dest="14"> + <expression clear="yes"/> </RegExp> - <RegExp input="$$6" output="<credits>\1</credits>" dest="4+"> - <expression repeat="yes">([^,]*),</expression> + <RegExp input="$$1" output="<id>\1</id>" dest="10"> + <expression clear="yes">"id": (\d+),</expression> </RegExp> - <RegExp input="$$6" output="<credits>\1</credits>" dest="4+"> - <expression>([^\|,]+)$</expression> + <RegExp input="$$1" output="\1" dest="17"> + <expression clear="yes">"id": (\d+),</expression> </RegExp> - <RegExp input="$$8" output="\1" dest="6"> - <expression noclean="1"><Director>([^<]*)</Director></expression> + <RegExp input="$$1" output="<airedSeason>\1</airedSeason>" dest="10+"> + <expression>"airedSeason": (\d+),</expression> </RegExp> - <RegExp input="$$6" output="<director>\1</director>" dest="4+"> - <expression repeat="yes">([^\|]*)\|</expression> + <RegExp input="$$1" output="<airedEpisodeNumber>\1</airedEpisodeNumber>" dest="10+"> + <expression>"airedEpisodeNumber": (\d+),</expression> </RegExp> - <RegExp input="$$6" output="<director>\1</director>" dest="4+"> - <expression repeat="yes">([^,]*),</expression> + <RegExp input="$$1" output="<episodeName>\1</episodeName>" dest="10+"> + <expression fixchars="1">"episodeName": "(.*)",\s+"firstAired"</expression> </RegExp> - <RegExp input="$$6" output="<director>\1</director>" dest="4+"> - <expression>([^\|,]+)$</expression> + <RegExp conditional="usefallbacklanguage1" input="$$1" output="missingtitle|" dest="14"> + <expression clear="yes">"episodeName": null,\s+"firstAired"</expression> </RegExp> - <RegExp input="$$8" output="\1" dest="6"> - <expression noclean="1"><GuestStars>([^<]*)</GuestStars></expression> + <RegExp input="$$1" output="<firstAired>\1</firstAired>" dest="10+"> + <expression>"firstAired": (?:"([^"]*)"|null),</expression> </RegExp> - <RegExp input="$$6" output="<actor><name>\1</name></actor>" dest="4+"> - <expression repeat="yes">([^\|]*)\|</expression> + <RegExp input="$$7" output="<overview>\1</overview>" dest="10+"> + <RegExp input="$$6\r" output="\1\n" dest="7"> + <RegExp input="$$1" output="\1" dest="6"> + <expression clear="yes" noclean="1">"overview": "(.*)",\s+"language"</expression> + </RegExp> + <expression clear="yes" repeat="yes" fixchars="1">(.*?)\\r</expression> + </RegExp> + <expression noclean="1">(?!^$)(.*)</expression> </RegExp> - <RegExp input="$$6" output="<actor><name>\1</name></actor>" dest="4+"> - <expression repeat="yes">([^,]*),</expression> + <RegExp conditional="usefallbacklanguage1" input="$$1" output="missingplot|" dest="14+"> + <expression fixchars="1">"overview": null,\s+"language"</expression> </RegExp> - <RegExp input="$$6" output="<actor><name>\1</name></actor>" dest="4+"> - <expression>([^\|,]+)$</expression> + <RegExp input="$$1" output="<dvdSeason>\1</dvdSeason>" dest="10+"> + <expression>"dvdSeason": (?:(\d+)|null),</expression> </RegExp> - <RegExp input="$$8" output="<title>\1</title>" dest="4+"> - <expression><EpisodeName>([^<]*)</EpisodeName></expression> + <RegExp input="$$1" output="<dvdEpisodeNumber>\1</dvdEpisodeNumber>" dest="10+"> + <expression>"dvdEpisodeNumber": (?:(\d+)|null),</expression> </RegExp> - <!-- Regular Episodes - Absolute Order --> - <RegExp conditional="absolutenumber" input="$$8" output="<season>1</season><episode>\2</episode>" dest="4+"> - <expression><SeasonNumber>([1-9]*)</SeasonNumber>.*?<absolute_number>([0-9]*)</absolute_number></expression> + <RegExp input="$$1" output="<absoluteNumber>\1</absoluteNumber>" dest="10+"> + <expression>"absoluteNumber": (?:(\d+)|null),</expression> </RegExp> - <!-- Specials - Absolute Order --> - <RegExp conditional="absolutenumber" input="$$8" output="<season>0</season><episode>\1</episode>" dest="4+"> - <expression><EpisodeNumber>([0-9]*)</EpisodeNumber>.*?<SeasonNumber>0</SeasonNumber></expression> + <RegExp input="$$1" output="<airsAfterSeason>\1</airsAfterSeason>" dest="10+"> + <expression>"airsAfterSeason": (?:(\d+)|null),</expression> </RegExp> - <!-- Normal Season/Episodes --> - <RegExp conditional="!absolutenumber" input="$$9" output="<season>\1</season>" dest="4+"> - <RegExp conditional="!dvdorder" input="$$8" output="\1" dest="9"> - <expression clear="yes"><SeasonNumber>([^<]*)</SeasonNumber></expression> - </RegExp> - <RegExp conditional="dvdorder" input="$$8" output="\1" dest="9"> - <expression><Combined_season>([^<]*)</Combined_season></expression> - </RegExp> - <expression/> + <RegExp input="$$1" output="<airsBeforeSeason>\1</airsBeforeSeason>" dest="10+"> + <expression>"airsBeforeSeason": (?:(\d+)|null),</expression> </RegExp> - <RegExp conditional="!absolutenumber" input="$$9" output="<episode>\1</episode>" dest="4+"> - <RegExp conditional="!dvdorder" input="$$8" output="\1" dest="9"> - <expression clear="yes"><EpisodeNumber>([^<]*)</EpisodeNumber></expression> - </RegExp> - <RegExp conditional="dvdorder" input="$$8" output="\1" dest="9"> - <expression><Combined_episodenumber>([^<]*)</Combined_episodenumber></expression> - </RegExp> - <expression/> + <RegExp input="$$1" output="<airsBeforeEpisode>\1</airsBeforeEpisode>" dest="10+"> + <expression>"airsBeforeEpisode": (?:(\d+)|null),</expression> </RegExp> - <RegExp input="$$8" output="<thumb>http://thetvdb.com/banners/\1</thumb>" dest="4+"> - <expression><filename>([^<]+)</filename></expression> + <RegExp input="$$1" output="<siteRating>\1</siteRating>" dest="10+"> + <expression>"siteRating": (?:([\d\.]+)|null),</expression> </RegExp> - <RegExp input="$$8" output="<aired>\1</aired>" dest="4+"> - <expression><FirstAired>([^<]+)</FirstAired></expression> + <RegExp input="$$1" output="<siteRatingCount>\1</siteRatingCount>" dest="10+"> + <expression>"siteRatingCount": (?:(\d+)|null)\s+}</expression> </RegExp> - <RegExp input="$$8" output="<displayseason>\1</displayseason>" dest="4+"> - <expression><airsbefore_season>([^<]+)</airsbefore_season></expression> + <RegExp input="$$1" output="<imdbId>\1</imdbId>" dest="10+"> + <expression fixchars="1">"imdbId": "(tt\d+)",</expression> </RegExp> - <RegExp input="$$8" output="<displayepisode>\1</displayepisode>" dest="4+"> - <expression><airsbefore_episode>([^<]+)</airsbefore_episode></expression> + <RegExp input="$$1" output="<filename>\1</filename>" dest="10+"> + <expression>"filename": (?:"([^"]*)"|null),</expression> </RegExp> - <RegExp input="$$8" output="<displayafterseason>\1</displayafterseason>" dest="4+"> - <expression><airsafter_season>([^<]+)</airsafter_season></expression> + <RegExp input="$$9," output="<credits>\1</credits>" dest="10+"> + <RegExp input="$$1" output="\1" dest="9"> + <expression>"writers": \[([^]]*)\],</expression> + </RegExp> + <expression fixchars="1" repeat="yes">"([^"]*)",</expression> </RegExp> - <RegExp input="$INFO[RatingS]" output="$$12" dest="4+"> - <RegExp input="$$8" output="<rating>\1</rating>" dest="12+"> - <expression><Rating>([^<]+)</Rating></expression> + <RegExp input="$$9," output="<director>\1</director>" dest="10+"> + <RegExp input="$$1" output="\1" dest="9"> + <expression>"directors": \[([^]]*)\],</expression> </RegExp> - <RegExp input="$$8" output="<votes>\1</votes>" dest="12+"> - <expression><RatingCount>([^<]+)</RatingCount></expression> + <expression fixchars="1" repeat="yes">"([^"]*)",</expression> + </RegExp> + <RegExp input="$$9," output="<actor><name>\1</name></actor>" dest="10+"> + <RegExp input="$$1" output="\1" dest="9"> + <expression>"guestStars": \[\s+"([^]]*)"\s+\],</expression> </RegExp> - <expression>TheTVDB</expression> + <expression fixchars="1" repeat="yes">([^,"]+)[,"\s]+</expression> </RegExp> - <RegExp input="$INFO[RatingS]" output="$$13" dest="4+"> - <RegExp input="$$8" output="\1" dest="11"> - <expression clear="yes"><IMDB_ID>([^<]+)</IMDB_ID></expression> + <RegExp input="$$9" output="\1" dest="13+"> + <RegExp input="$$14" output="<Episode>$$10</Episode>" dest="9"> + <expression clear="yes">^$</expression> </RegExp> - <RegExp input="$$11" output="\1" dest="13"> - <RegExp conditional="fallback" input="$$8" output="<rating>\1</rating>" dest="13+"> - <expression><Rating>([^<]+)</Rating></expression> - </RegExp> - <RegExp conditional="fallback" input="$$8" output="<votes>\1</votes>" dest="13+"> - <expression><RatingCount>([^<]+)</RatingCount></expression> - </RegExp> - <expression>^$</expression> + <RegExp input="$INFO[language]" output="<Episode>$$10</Episode>" dest="9"> + <expression>^\Q$INFO[fallbacklanguage]\E$</expression> </RegExp> - <RegExp input="$$11" output="<chain function="GetIMDBRatingById">$$11</chain>" dest="13"> - <expression>(.+)</expression> + <expression noclean="1"/> + </RegExp> + <RegExp input="$INFO[language]" output="$$6" dest="5"> + <RegExp input="$$14" output="<url function="GetFallbackEpisodeDetails" cache="episode-$$17-$INFO[fallbacklanguage].json">https://api.thetvdb.com/episodes/$$17|Authorization=Bearer%20$$19&Accept-Language=$INFO[fallbacklanguage]</url>" dest="6"> + <expression clear="yes">(?!^$)</expression> </RegExp> - <expression>IMDb</expression> + <expression>(?!^\Q$INFO[fallbacklanguage]\E$)</expression> </RegExp> - <RegExp input="$$1" output="<runtime>\1</runtime>" dest="4+"> - <expression><Runtime>([^<]+)</Runtime></expression> + <expression noclean="1"/> + </RegExp> + </GetEpisodeDetailsAuth> + <GetFallbackEpisodeDetails dest="3" clearbuffers="no"> + <RegExp input="$$4" output="<details></details>" dest="3"> + <RegExp input="$$14" output="$$5" dest="10+"> + <RegExp input="$$1" output="<episodeName>\1</episodeName>" dest="5"> + <expression clear="yes" fixchars="1">"episodeName": "(.*)",\s+"firstAired"</expression> + </RegExp> + <expression>missingtitle</expression> + </RegExp> + <RegExp input="$$14" output="$$5" dest="10+"> + <RegExp input="$$7" output="<overview>\1</overview>" dest="5"> + <RegExp input="$$6\r" output="\1\n" dest="7"> + <RegExp input="$$1" output="\1" dest="6"> + <expression clear="yes" noclean="1">"overview": "(.*)",\s+"language"</expression> + </RegExp> + <expression repeat="yes" fixchars="1">(.*?)\\r</expression> + </RegExp> + <expression noclean="1"/> + </RegExp> + <expression>missingplot</expression> + </RegExp> + <RegExp input="$$10" output="<Episode>\1</Episode>" dest="13+"> + <expression noclean="1"/> </RegExp> <expression noclean="1"/> </RegExp> - </GetEpisodeDetails> -</scraper> + </GetFallbackEpisodeDetails> + <ParseEpisodeDetails dest="4" clearbuffers="no"> + <RegExp input="$$5" output="\1" dest="4"> + <RegExp input="$$1" output="" dest="5"> + <expression clear="yes"/> + </RegExp> + <XSLT input="<Data><current>$$13</current><all>$$11</all></Data>" output="\1" dest="5"> + <xsl:stylesheet version = "1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output indent="yes"/> + <xsl:strip-space elements="*"/> + <xsl:key name="EpisodesByDVDnumber" match="current/Episode" use="concat(dvdSeason,',',substring-before(dvdEpisodeNumber,'.'))"/> + <xsl:variable name="SeasonCounts"> + <xsl:if test="'$INFO[absolutenumber]'='true'">$$12</xsl:if> + </xsl:variable> + + <xsl:variable name="episode-list" select="concat('$$2','|')" /> + <xsl:variable name="FirstEpisode" select="Data/current/Episode[id=substring-before($episode-list,'|')]" /> + <xsl:variable name="single-episode" select="substring-after($episode-list,'|')=''" /> + <xsl:variable name="AirsBeforeEpisode" select="Data/all/Episode[(SeasonNumber=$FirstEpisode/airsBeforeSeason) and (EpisodeNumber=$FirstEpisode/airsBeforeEpisode)]"/> + <xsl:variable name="AirsAfterEpisode" select="Data/all/Episode[(SeasonNumber=$FirstEpisode/airsAfterSeason + 1) and (EpisodeNumber=1)]"/> + <xsl:variable name="AfterSeasonCount" select="substring-before(substring-after($SeasonCounts, concat('|S', $FirstEpisode/airsAfterSeason + 1, '|')), '|')"/> + + <xsl:variable name="title-divider" select="' / '"/> + <xsl:variable name="plot-divider" select="' ---- '" /> + + <xsl:template match="*"/> + + <xsl:template match="Episode"/> + + <xsl:template match="Data"> + <xsl:apply-templates select="current"/> + </xsl:template> + + <xsl:template match="current"> + <details> + <title> + <xsl:choose> + <xsl:when test="$single-episode"><xsl:value-of select="$FirstEpisode/episodeName"/></xsl:when> + <xsl:otherwise> + <xsl:variable name="title"> + <xsl:call-template name="merge-details"> + <xsl:with-param name="list" select="$episode-list" /> + <xsl:with-param name="element" select="'episodeName'" /> + <xsl:with-param name="divider" select="$title-divider" /> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="shrink-title"> + <xsl:with-param name="full-title" select="$title" /> + <xsl:with-param name="title-list" select="substring-after(concat($title,$title-divider),$title-divider)" /> + <xsl:with-param name="test-title" select="substring(substring-before($title,$title-divider),1,string-length(substring-before($title,$title-divider))-4)" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </title> + <plot> + <xsl:choose> + <xsl:when test="$single-episode"><xsl:value-of select="$FirstEpisode/overview"/></xsl:when> + <xsl:otherwise> + <xsl:call-template name="merge-details"> + <xsl:with-param name="list" select="$episode-list" /> + <xsl:with-param name="element" select="'overview'" /> + <xsl:with-param name="divider" select="$plot-divider" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </plot> + <uniqueid><xsl:value-of select="$FirstEpisode/id"/></uniqueid> + <aired><xsl:value-of select="$FirstEpisode/firstAired"/></aired> + <xsl:choose> + <xsl:when test="'$INFO[dvdorder]'!='true'"> + <xsl:choose> + <xsl:when test="('$INFO[absolutenumber]'='true') and (($FirstEpisode/airedSeason>0) or ($FirstEpisode/absoluteNumber!=''))"> + <episode> + <xsl:choose> + <xsl:when test="$FirstEpisode/absoluteNumber!=''"><xsl:value-of select="$FirstEpisode/absoluteNumber"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-before(substring-after($SeasonCounts, concat('|S', $FirstEpisode/airedSeason, '|')), '|') + $FirstEpisode/airedEpisodeNumber"/></xsl:otherwise> + </xsl:choose> + </episode> + <season>1</season> + </xsl:when> + <xsl:when test="('$INFO[absolutenumber]'='true') and ($FirstEpisode/airedSeason=0)"> + <episode><xsl:value-of select="$FirstEpisode/airedEpisodeNumber"/></episode> + <season>0</season> + </xsl:when> + <xsl:otherwise> + <episode><xsl:value-of select="$FirstEpisode/airedEpisodeNumber"/></episode> + <season><xsl:value-of select="$FirstEpisode/airedSeason"/></season> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="($FirstEpisode/dvdEpisodeNumber='') or ($FirstEpisode/dvdSeason='')"> + <episode><xsl:value-of select="$FirstEpisode/airedEpisodeNumber"/><xsl:if test="key('EpisodesByDVDnumber', concat($FirstEpisode/airedSeason,',',$FirstEpisode/airedEpisodeNumber))">.<xsl:value-of select="count(key('EpisodesByDVDnumber', concat($FirstEpisode/airedSeason,',',$FirstEpisode/airedEpisodeNumber))[(dvdEpisodeNumber!='') and (substring-after(dvdEpisodeNumber,'.')!='0')])+1"/></xsl:if></episode> + <season><xsl:value-of select="$FirstEpisode/airedSeason"/></season> + </xsl:when> + <xsl:otherwise> + <episode> + <xsl:choose> + <xsl:when test="$single-episode"><xsl:value-of select="$FirstEpisode/dvdEpisodeNumber"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-before($FirstEpisode/dvdEpisodeNumber,'.')"/></xsl:otherwise> + </xsl:choose> + </episode> + <season><xsl:value-of select="$FirstEpisode/dvdSeason"/></season> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$FirstEpisode/airedSeason=0"> + <xsl:choose> + <xsl:when test="'$INFO[dvdorder]'!='true'"> + <xsl:choose> + <xsl:when test="'$INFO[absolutenumber]'='true'"> + <xsl:if test="($FirstEpisode/airsBeforeSeason!='') or ($FirstEpisode/airsBeforeEpisode!='')"> + <displayepisode> + <xsl:choose> + <xsl:when test="$AirsBeforeEpisode and ($AirsBeforeEpisode/absoluteNumber!='')"><xsl:value-of select="$AirsBeforeEpisode/absoluteNumber"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-before(substring-after($SeasonCounts, concat('|S', $AirsBeforeEpisode/SeasonNumber, '|')), '|') + $FirstEpisode/airsBeforeEpisode"/></xsl:otherwise> + </xsl:choose> + </displayepisode> + <displayseason>1</displayseason> + </xsl:if> + <xsl:if test="($FirstEpisode/airsAfterSeason!='') and ($AfterSeasonCount!='')"> + <displayepisode> + <xsl:choose> + <xsl:when test="$AirsAfterEpisode and ($AirsAfterEpisode/absoluteNumber!='')"><xsl:value-of select="$AirsAfterEpisode/absoluteNumber"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$AfterSeasonCount + 1"/></xsl:otherwise> + </xsl:choose> + </displayepisode> + <displayseason>1</displayseason> + </xsl:if> + <xsl:if test="($FirstEpisode/airsAfterSeason!='') and ($AfterSeasonCount='')"> + <displayafterseason>1</displayafterseason> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <displayepisode><xsl:value-of select="$FirstEpisode/airsBeforeEpisode"/></displayepisode> + <displayseason><xsl:value-of select="$FirstEpisode/airsBeforeSeason"/></displayseason> + <displayafterseason><xsl:value-of select="$FirstEpisode/airsAfterSeason"/></displayafterseason> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$AirsBeforeEpisode and ($AirsBeforeEpisode/dvdEpisodeNumber!='') and ($AirsBeforeEpisode/dvdSeason!='')"> + <displayepisode><xsl:value-of select="$AirsBeforeEpisode/dvdEpisodeNumber"/></displayepisode> + <displayseason><xsl:value-of select="$AirsBeforeEpisode/dvdSeason"/></displayseason> + </xsl:when> + <xsl:otherwise> + <displayepisode><xsl:value-of select="$FirstEpisode/airsBeforeEpisode"/></displayepisode> + <displayseason><xsl:value-of select="$FirstEpisode/airsBeforeSeason"/></displayseason> + </xsl:otherwise> + </xsl:choose> + <displayafterseason><xsl:value-of select="$FirstEpisode/airsAfterSeason"/></displayafterseason> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:choose> + <xsl:when test="('$INFO[RatingS]'='IMDb') and (($FirstEpisode/imdbId!='') or ('$INFO[fallback]'='false'))"> + <xsl:if test="$FirstEpisode/imdbId!=''"><chain function="GetIMDBRatingById"><xsl:value-of select="$FirstEpisode/imdbId"/></chain></xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$single-episode"> + <rating><xsl:value-of select="$FirstEpisode/siteRating"/></rating> + <votes><xsl:value-of select="$FirstEpisode/siteRatingCount"/></votes> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="merge-rating"> + <xsl:with-param name="list" select="$episode-list" /> + <xsl:with-param name="rating" select="'0'" /> + <xsl:with-param name="votes" select="'0'" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="split-details"> + <xsl:with-param name="list" select="$episode-list"/> + </xsl:call-template> + </details> + </xsl:template> + + <xsl:template name="merge-details"> + <xsl:param name="list"/> + <xsl:param name="element"/> + <xsl:param name="divider"/> + <xsl:variable name="first" select="substring-before($list, '|')" /> + <xsl:variable name="remaining" select="substring-after($list, '|')" /> + <xsl:if test="$first!=''"><xsl:value-of select="//Episode[id=$first]/child::*[name()=$element]"/><xsl:if test="$remaining!=''"><xsl:value-of select="$divider"/></xsl:if></xsl:if> + <xsl:if test="$remaining!=''"> + <xsl:call-template name="merge-details"> + <xsl:with-param name="list" select="$remaining" /> + <xsl:with-param name="element" select="$element" /> + <xsl:with-param name="divider" select="$divider" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="shrink-title"> + <xsl:param name="full-title"/> + <xsl:param name="title-list"/> + <xsl:param name="test-title"/> + <xsl:variable name="first" select="substring-before($title-list,$title-divider)"/> + <xsl:variable name="remaining" select="substring-after($title-list,$title-divider)"/> + <xsl:choose> + <xsl:when test="$test-title!=substring($first,1,string-length($first)-4)"><xsl:value-of select="$full-title"/></xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$remaining=''"><xsl:value-of select="$test-title"/></xsl:when> + <xsl:otherwise> + <xsl:call-template name="shrink-title"> + <xsl:with-param name="full-title" select="$full-title" /> + <xsl:with-param name="title-list" select="$remaining" /> + <xsl:with-param name="test-title" select="$test-title" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="merge-rating"> + <xsl:param name="list"/> + <xsl:param name="rating"/> + <xsl:param name="votes"/> + <xsl:variable name="first" select="substring-before($list, '|')" /> + <xsl:variable name="remaining" select="substring-after($list, '|')" /> + <xsl:variable name="currVotes" select="$votes + Episode[id=$first]/siteRatingCount" /> + <xsl:variable name="firstRating"> + <xsl:choose> + <xsl:when test="Episode[id=$first]/siteRating!=''"><xsl:value-of select="Episode[id=$first]/siteRating"/></xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="currRating" select="$rating + ($firstRating * Episode[id=$first]/siteRatingCount)" /> + <xsl:choose> + <xsl:when test="$remaining!=''"> + <xsl:call-template name="merge-rating"> + <xsl:with-param name="list" select="$remaining" /> + <xsl:with-param name="rating" select="$currRating" /> + <xsl:with-param name="votes" select="$currVotes" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$currVotes>0"> + <rating><xsl:value-of select="format-number($currRating div $currVotes,'#.#')"/></rating> + </xsl:if> + <votes><xsl:value-of select="$currVotes"/></votes> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="split-details"> + <xsl:param name="list"/> + <xsl:variable name="first" select="substring-before(normalize-space($list), '|')" /> + <xsl:variable name="remaining" select="substring-after(normalize-space($list), '|')" /> + <xsl:if test="$first!=''"><xsl:apply-templates select="Episode[id=$first]" mode="match"/></xsl:if> + <xsl:if test="$remaining!='' and $remaining!='|'"> + <xsl:call-template name="split-details"> + <xsl:with-param name="list" select="$remaining" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="Episode" mode="match"> + <xsl:if test="filename!=''"><thumb>http://www.thetvdb.com/banners/<xsl:value-of select="filename"/></thumb></xsl:if> + <xsl:for-each select="credits|director|actor"> + <xsl:copy-of select="."/> + </xsl:for-each> + </xsl:template> + + <xsl:template name="split"> + <xsl:param name="list"/> + <xsl:param name="element"/> + <xsl:variable name="first" select="substring-before(normalize-space($list), '|')" /> + <xsl:variable name="remaining" select="substring-after(normalize-space($list), '|')" /> + <xsl:if test="$first!=''"><xsl:element name="{$element}"><xsl:value-of select="$first"/></xsl:element></xsl:if> + <xsl:if test="$remaining!='' and $remaining!='|'"> + <xsl:call-template name="split"> + <xsl:with-param name="list" select="$remaining" /> + <xsl:with-param name="element" select="$element" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + + </xsl:stylesheet> + </XSLT> + <expression noclean="1"/> + </RegExp> + </ParseEpisodeDetails> +</scraper>
\ No newline at end of file |