если не смогли определить тип видео, проверяем расширения из списка
parent
b1da58c3b3
commit
bf655e3f96
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="script.module.gorrent2http" name="gorrent2http" version="1.2.0" provider-name="inpos">
|
<addon id="script.module.gorrent2http" name="gorrent2http" version="1.2.1" provider-name="inpos">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="3.0.0"/>
|
<import addon="xbmc.python" version="3.0.0"/>
|
||||||
<import addon="script.module.chardet" />
|
<import addon="script.module.chardet" />
|
||||||
|
|
|
@ -14,7 +14,7 @@ from .structs import MediaType
|
||||||
|
|
||||||
SUBTITLES_FORMATS = ['.aqt', '.gsub', '.jss', '.sub', '.ttxt', '.pjs', '.psb', '.rt', '.smi', '.stl',
|
SUBTITLES_FORMATS = ['.aqt', '.gsub', '.jss', '.sub', '.ttxt', '.pjs', '.psb', '.rt', '.smi', '.stl',
|
||||||
'.ssf', '.srt', '.ssa', '.ass', '.usf', '.idx']
|
'.ssf', '.srt', '.ssa', '.ass', '.usf', '.idx']
|
||||||
|
VIDEO_FORMATS = ['.mkv', '.mp4', '.avi', '.ogv', '.ts', '.flv', '.webm', '.vob', '.3gp', '.mpg', '.mpeg']
|
||||||
|
|
||||||
class Struct(dict):
|
class Struct(dict):
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
|
@ -43,7 +43,9 @@ def detect_media_type(name):
|
||||||
return MediaType.SUBTITLES
|
return MediaType.SUBTITLES
|
||||||
else:
|
else:
|
||||||
mime_type = mimetypes.guess_type(name)[0]
|
mime_type = mimetypes.guess_type(name)[0]
|
||||||
if not mime_type:
|
if mime_type is None:
|
||||||
|
if ext.lower() in VIDEO_FORMATS:
|
||||||
|
return MediaType.VIDEO
|
||||||
return MediaType.UNKNOWN
|
return MediaType.UNKNOWN
|
||||||
mime_type = mime_type.split("/")[0]
|
mime_type = mime_type.split("/")[0]
|
||||||
if mime_type == 'audio':
|
if mime_type == 'audio':
|
||||||
|
|
Loading…
Reference in New Issue