diff options
author | Britney Fransen <brfransen@gmail.com> | 2019-01-30 15:48:09 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2019-01-30 15:48:09 (GMT) |
commit | fb52b64b5af9edfe83c361916a51c28d802b1d36 (patch) | |
tree | 7f6d8c693a47eb3ab348e45785c61a9199ee277e /abs/core/mythtv/stable-30/mythtv/pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch | |
parent | 9b6c8730fe90c05fa38880963f4fea2ac7ab7391 (diff) | |
download | linhes_pkgbuild-fb52b64b5af9edfe83c361916a51c28d802b1d36.zip linhes_pkgbuild-fb52b64b5af9edfe83c361916a51c28d802b1d36.tar.gz linhes_pkgbuild-fb52b64b5af9edfe83c361916a51c28d802b1d36.tar.bz2 |
mythtv mythplugins mythweb: add fixes/30 branch. refs#1034
Diffstat (limited to 'abs/core/mythtv/stable-30/mythtv/pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch')
-rw-r--r-- | abs/core/mythtv/stable-30/mythtv/pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/abs/core/mythtv/stable-30/mythtv/pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch b/abs/core/mythtv/stable-30/mythtv/pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch new file mode 100644 index 0000000..2845250 --- /dev/null +++ b/abs/core/mythtv/stable-30/mythtv/pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch @@ -0,0 +1,39 @@ +--- src/mythtv/programs/scripts/metadata/Movie/tmdb3.py 2017-02-23 13:18:12.000000000 +0100 ++++ src/mythtv/programs/scripts/metadata/Movie/tmdb3.py 2017-02-25 13:12:40.213333328 +0100 +@@ -29,6 +29,7 @@ + + from optparse import OptionParser + import sys ++import re + + def buildSingle(inetref, opts): + from MythTV.tmdb3.tmdb_exceptions import TMDBRequestInvalid +@@ -122,11 +123,27 @@ + # replace all dashes from queries to work around search behavior + # as negative to all text that comes afterwards + query = query.replace('-',' ') ++ query = query.strip() # trim extra whitespace ++ # extract year from name -- note that we require a space before the year ++ # so we don't confuse movie names for years (example: "2012 - 2009", ++ # a 2009 movie); also note that we accept optional paranthesis around ++ # the year: ++ yearRegex = re.compile(r"\s\(?((19|20)[0-9]{2})\)?$") ++ year = yearRegex.search(query) ++ if year is not None: ++ year = year.group(1) ++ # if no year was found, we'll pass year=None to searchMovie, ++ # which is the default anyway ++ ++ # get rid of the year (if any) from the query text, because ++ # it causes bad TMDB results ++ query = yearRegex.sub("", query) ++ query = query.strip() + + from MythTV.tmdb3 import searchMovie + from MythTV import VideoMetadata + from lxml import etree +- results = iter(searchMovie(query)) ++ results = iter(searchMovie(query, locale=None, adult=False, year=year)) + tree = etree.XML(u'<metadata></metadata>') + mapping = [['runtime', 'runtime'], ['title', 'originaltitle'], + ['releasedate', 'releasedate'], ['tagline', 'tagline'], |