[mythtv-users] Changes to tmdb? Video details lookup failing.

Joseph Fry joe at thefrys.com
Fri Sep 27 23:02:55 UTC 2013


>>>>> So essentially.... we just need to parse the file name, and if it
>>>>> >>>finds a 4 digit number at the end of the name, between 1900 and
>>>>> >>><current year>, assume it's a year and submit it as such.  If it
>>>>> >>>fails, then resubmit with it in the title?
>>>>
>>>> >>
>>>> >>
>>>> >>what happens to "The Kiss 1896"?
>>>> >>
>>>
>>> >
>>> >There needs to be some indication that it is a Year and not part of
>>> >the title. How about something like
>>> >
>>> >Office Space -1999-.ext
>>> >
>>> >Where the value between the - - is determined to be the year?
>>> >
>>
>> I disagree... we should not need to use a delimiter in the file name.
>> Titles that end in 4 digit years between 1900 and the current year,
>> are very uncommon.  By default we could simply assume a 4 digit
>> numeric string between 1900 and the current year at the end of the
>> title is the year the movie was released.  Sure there are exceptions,
>> but far fewer than the issues we have if we don't specify a release
>> year.
>
>
> That just seems inherently wrong to assume the user has added extra crap to
> the filename.

I am not assuming anything.  I'm simply saying that if the end or the
title provided to the tmdb3.py script happens to be a numeric value
between 1900 and the current year... treat it as the release year.

Here is the patch I just finished... works like a treat for me (my
files are all named like the.croods.2013):

----------------------

--- tmdb3.py.bak 2013-09-21 19:58:11.000000000 -0400
+++ tmdb3.py 2013-09-27 18:52:47.086461718 -0400
@@ -110,7 +110,19 @@
     from MythTV.tmdb3 import searchMovie
     from MythTV import VideoMetadata
     from lxml import etree
-    results = searchMovie(query)
+    from datetime import date
+
+    if len(query.split()) > 1:
+        title = query.rsplit(' ', 1)[0]
+        titleyear = query.rsplit(' ', 1)[1]
+        if titleyear.isdigit() and int(titleyear) > 1900 and \
+           int(titleyear) < int(date.today().year + 1):
+            results = searchMovie(title, year=titleyear)
+        else:
+            results = searchMovie(query)
+    else:
+        results = searchMovie(query)
+
     tree = etree.XML(u'<metadata></metadata>')
     mapping = [['runtime',      'runtime'],     ['title',
'originaltitle'],
                ['releasedate',  'releasedate'], ['tagline',     'tagline'],

-------------------------------------------

Of course, this does not work if you put the year in parenthesis as
mythtv discards this information when calling tmdb3.py.


More information about the mythtv-users mailing list