Recently had something match incorrectly and it included tmdb and imdb IDs in mediainfo.
I'm sure there are better ways to do this but I am VERY rusty with regex and python
from pymediainfo import MediaInfo
import re
# Parse MediaInfo
media_info = MediaInfo.parse(filename="filename", output="STRING", full=False, mediainfo_options={'inform_version' : '1'})
# Get IMDB
imdb_line = re.search("(?:IMDB[ \t]+: tt[ \d]+)", media_info)
imdb_id = imdb_line.group().replace("IMDB : ", "")
# imdb_id = tt01234
if imdb_id is None:
# handle like you currently do
# Get TMDB
tmdb_line = re.search("(?:TMDB[ \t]+: .*)", media_info)
tmdb_id = tmdb_line.group().replace("TMDB : ", "")
# tmdb_id = movie/01234
if tmdb_id is None:
# handle like you currently do
Title says it all.
Recently had something match incorrectly and it included tmdb and imdb IDs in mediainfo.
I'm sure there are better ways to do this but I am VERY rusty with regex and python