summaryrefslogtreecommitdiff
path: root/imdb-lookup
diff options
context:
space:
mode:
Diffstat (limited to 'imdb-lookup')
-rw-r--r--imdb-lookup/html/index-files/css/style.css6
-rw-r--r--imdb-lookup/html/index.html8
-rwxr-xr-ximdb-lookup/imdbinfo.py33
3 files changed, 25 insertions, 22 deletions
diff --git a/imdb-lookup/html/index-files/css/style.css b/imdb-lookup/html/index-files/css/style.css
index aa3d234..6f95335 100644
--- a/imdb-lookup/html/index-files/css/style.css
+++ b/imdb-lookup/html/index-files/css/style.css
@@ -82,8 +82,10 @@ font-weight: bold;
}
.movie-tag {
font-family: monospace;
- padding: 3px;
+ font-size: 9pt;
+ padding-left: 3px;
+ padding-right: 3px;
background-color: #f0f0f0;
- border: 1px solid #e0e0e0;
+ border: 1px solid #a0a0a0;
border-radius: 4px;
}
diff --git a/imdb-lookup/html/index.html b/imdb-lookup/html/index.html
index deff8b2..dd3eafe 100644
--- a/imdb-lookup/html/index.html
+++ b/imdb-lookup/html/index.html
@@ -69,9 +69,11 @@
<a {{bind-attr href=movie.path.path title=movie.path.label}}>
{{movie.title}}
</a>
- {{#each tag in movie.tags}}
- <span class="movie-tag">{{tag}}</span>
- {{/each}}
+ </div>
+ <div>
+ {{#each tag in movie.tags}}
+ <span class="movie-tag">{{tag}}</span>
+ {{/each}}
</div>
<div class="headline">{{movie.summary}}</div>
<div class="plot">{{movie.plot}}</div>
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index ca0d7b1..84845ce 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -16,7 +16,6 @@ import hashlib
from io import BytesIO
from pprint import pprint
from multiprocessing.dummy import Pool
-from threading import Lock
from urllib.parse import quote as urlencode
from PIL import Image, ImageFilter
import tmdbsimple as tmdb
@@ -175,6 +174,7 @@ class TMDBCache(object):
data = json.loads(r.text)
r.close()
assert data is not None and data['data'], "Data must not be empty"
+ assert 'rating' in data['data']
return data['data']
return self._cache_json(movie_id, "imdb_maindetails.json", do_request)
@@ -238,7 +238,7 @@ class Protector(object):
except KeyboardInterrupt as e:
raise e
except Exception as e:
- logging.error("Error calling %s: %s: %s", name, type(e), e)
+ logging.error("Error calling %s: '%s': '%s' with args '(%s,%s)'", name, type(e), e, a ,kw)
return None
if callable(attr):
return protected
@@ -321,19 +321,14 @@ def do_index(args, imdb_ids):
def find():
for root, dirs, files in os.walk(path):
for curfile in files:
- if curfile.endswith("mkv"):
- yield "MKV"
- if curfile.endswith("avi"):
- yield "AVI"
- for curdir in dirs:
- tags = { "german" : "German",
- "1080" : "1080p", "720" : "720p",
- "bdrip" : "BlueRay", "blueray" : "BlueRay",
- "hevc" : "HEVC" }
- for (key, tag) in tags.items():
- if key in curdir.lower():
- yield tag
-
+ if curfile.lower()[-3:] in ["mkv","avi","mp4"]:
+ info = guessit.guess_movie_info(os.path.join(root,curfile)).to_dict()
+ for key,val in info.items():
+ if key in ["format","videoCodec","releaseGroup","container","container"]:
+ if not isinstance(val, list):
+ val = [val]
+ for lval in val:
+ yield "{}:{}".format(key,lval)
l = list(set(find()))
l.sort()
return l
@@ -366,7 +361,8 @@ def do_index(args, imdb_ids):
print("Error in {} {}".format(path, imdb_id))
return None
else:
- return {
+ try:
+ return {
'id': imdb_id,
'title': tmdb['title'],
'summary': compile_summary(imdb, omdb, tmdb),
@@ -383,7 +379,10 @@ def do_index(args, imdb_ids):
'omdbTomatoMeter': (omdb['tomatoMeter'] != 'N/A') and float(omdb['tomatoMeter']) or None,
'omdbTomatoRating': (omdb['tomatoRating'] != 'N/A') and float(omdb['tomatoRating']) or None,
'tmdbId': tmdb['id'],
- }
+ }
+ except Exception as e:
+ print("Error in {} {}: {}".format(path, imdb_id, str(e)))
+ return None
datadir = os.path.join(os.path.dirname(__file__), "html")
index_files = os.path.join(datadir, "index-files")