Six import
This commit is contained in:
1 parent
e1eb68e226
commit
6c2aef7a6d
7 files changed
+12
-8
No files matched your search
@@ -89,7 +89,7 @@ class MediaBase(Plugin):
|
||||
|
||||
# Loop over type
|
||||
for image in image_urls.get(image_type, []):
|
||||
if not isinstance(image, (str, unicode)):
|
||||
if not isinstance(image, six.string_types):
|
||||
continue
|
||||
|
||||
if file_type not in existing_files or len(existing_files.get(file_type, [])) == 0:
|
||||
|
||||
@@ -12,6 +12,7 @@ from couchpotato.core.helpers.variable import splitString, getImdb, getTitle
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.media import MediaBase
|
||||
from .index import MediaIndex, MediaStatusIndex, MediaTypeIndex, TitleSearchIndex, TitleIndex, StartsWithIndex, MediaChildrenIndex, MediaTagIndex
|
||||
import six
|
||||
|
||||
|
||||
log = CPLog(__name__)
|
||||
@@ -280,7 +281,7 @@ class MediaPlugin(MediaBase):
|
||||
offset = 0
|
||||
limit = -1
|
||||
if limit_offset:
|
||||
splt = splitString(limit_offset) if isinstance(limit_offset, (str, unicode)) else limit_offset
|
||||
splt = splitString(limit_offset) if isinstance(limit_offset, six.string_types) else limit_offset
|
||||
limit = tryInt(splt[0])
|
||||
offset = tryInt(0 if len(splt) is 1 else splt[1])
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from couchpotato.core.event import fireEvent, addEvent
|
||||
from couchpotato.core.helpers.variable import mergeDicts, getImdb
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
import six
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
@@ -30,7 +31,7 @@ class Search(Plugin):
|
||||
def search(self, q = '', types = None, **kwargs):
|
||||
|
||||
# Make sure types is the correct instance
|
||||
if isinstance(types, (str, unicode)):
|
||||
if isinstance(types, six.string_types):
|
||||
types = [types]
|
||||
elif isinstance(types, (list, tuple, set)):
|
||||
types = list(types)
|
||||
|
||||
@@ -7,6 +7,7 @@ from couchpotato.core.helpers.encoding import tryUrlencode
|
||||
from couchpotato.core.helpers.variable import tryInt, tryFloat, splitString
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.media.movie.providers.base import MovieProvider
|
||||
import six
|
||||
|
||||
|
||||
log = CPLog(__name__)
|
||||
@@ -72,7 +73,7 @@ class OMDBAPI(MovieProvider):
|
||||
try:
|
||||
|
||||
try:
|
||||
if isinstance(movie, (str, unicode)):
|
||||
if isinstance(movie, six.string_types):
|
||||
movie = json.loads(movie)
|
||||
except ValueError:
|
||||
log.info('No proper json to decode')
|
||||
|
||||
Reference in new issue
Block a user