Redid hash function. Hashids only supports ints and our hash text is string. Moved over to hashlib and md5 function.
This commit is contained in:
12
src/core.py
12
src/core.py
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
from guessit import guessit
|
from guessit import guessit
|
||||||
from babelfish import Language, LanguageReverseError
|
from babelfish import Language, LanguageReverseError
|
||||||
from hashids import Hashids
|
import hashlib
|
||||||
import os, errno
|
import os, errno
|
||||||
import logging
|
import logging
|
||||||
import tvdb_api
|
import tvdb_api
|
||||||
@@ -72,11 +72,11 @@ def scan_video(path):
|
|||||||
video.size = os.path.getsize(path)
|
video.size = os.path.getsize(path)
|
||||||
|
|
||||||
# hash of name
|
# hash of name
|
||||||
hashids = Hashids(min_length=16)
|
if isinstance(video, Movie):
|
||||||
if isinstance(v, Episode):
|
hash_str = ''.join([video.title, str(video.year) or ''])
|
||||||
videoHash = hashids.encode(''.join(self.title, self.year or ''))
|
elif isinstance(video, Episode):
|
||||||
elif isinstance(v, Movie):
|
hash_str = ''.join([video.series, str(video.season), str(video.episode)])
|
||||||
videoHash = hashids.encode(''.join(self.series, self.season, self.episode))
|
videoHash = hashlib.md5(hash_str.encode()).hexdigest()
|
||||||
video.hash = videoHash
|
video.hash = videoHash
|
||||||
|
|
||||||
return video
|
return video
|
||||||
|
|||||||
Reference in New Issue
Block a user