To a proper random string when no IMDB is found
This commit is contained in:
@@ -2,7 +2,9 @@ from couchpotato.core.logger import CPLog
|
|||||||
import hashlib
|
import hashlib
|
||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
|
import random
|
||||||
import re
|
import re
|
||||||
|
import string
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
@@ -117,3 +119,6 @@ def getTitle(library_dict):
|
|||||||
log.error('Could not get title for library item: %s' % library_dict)
|
log.error('Could not get title for library item: %s' % library_dict)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def randomString(size = 8, chars = string.ascii_uppercase + string.digits):
|
||||||
|
return ''.join(random.choice(chars) for x in range(size))
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from couchpotato import get_session
|
from couchpotato import get_session
|
||||||
from couchpotato.core.event import addEvent, fireEvent
|
from couchpotato.core.event import addEvent, fireEvent
|
||||||
from couchpotato.core.helpers.variable import mergeDicts
|
from couchpotato.core.helpers.variable import mergeDicts, randomString
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
from couchpotato.core.settings.model import Library
|
from couchpotato.core.settings.model import Library
|
||||||
@@ -23,7 +23,10 @@ class MovieResultModifier(Plugin):
|
|||||||
|
|
||||||
# Combine on imdb id
|
# Combine on imdb id
|
||||||
for item in results:
|
for item in results:
|
||||||
imdb = item.get('imdb', 'random-%s' % time.time())
|
random_string = randomString()
|
||||||
|
imdb = item.get('imdb', random_string)
|
||||||
|
imdb = imdb if imdb else random_string
|
||||||
|
|
||||||
if not temp.get(imdb):
|
if not temp.get(imdb):
|
||||||
temp[imdb] = self.getLibraryTags(imdb)
|
temp[imdb] = self.getLibraryTags(imdb)
|
||||||
order.append(imdb)
|
order.append(imdb)
|
||||||
|
|||||||
Reference in New Issue
Block a user