2023-02-12, 10:27
a simple way to scrap imdb and tmdb in filename :
in your kodi directory modify the file (save it before just in case)
e:\kodi\portable_data\addons\metadata.themoviedb.org.python\python\lib\tmdbscraper\tmdb.py
in fist line add
then find the line
and add just after
as you can see (lines after) the parse function only detect imdb and tmdb if it's in the beginning of the name. I just accept imdb and tmdb everywhere
in your kodi directory modify the file (save it before just in case)
e:\kodi\portable_data\addons\metadata.themoviedb.org.python\python\lib\tmdbscraper\tmdb.py
in fist line add
python:import re
then find the line
python:def _parse_media_id(title):
and add just after
python:
m=re.search(r'(tt\d+)',title)
if m: return {'type': 'imdb', 'id':m.group(1)}
m=re.search(r'tmdb[\/#](\d+)',title)
if m: return {'type': 'tmdb', 'id':m.group(1)}
as you can see (lines after) the parse function only detect imdb and tmdb if it's in the beginning of the name. I just accept imdb and tmdb everywhere
(don't forget to modify this file every time this addon is update. i made a script to do this automatically)python:
if title.startswith('tt') and title[2:].isdigit():
return {'type': 'imdb', 'id':title} # IMDB ID works alone because it is clear
title = title.lower()
if title.startswith('tmdb/') and title[5:].isdigit(): # TMDB ID
return {'type': 'tmdb', 'id':title[5:]}
elif title.startswith('imdb/tt') and title[7:].isdigit(): # IMDB ID with prefix to match
return {'type': 'imdb', 'id':title[5:]}
return None