если не смогли определить тип видео, проверяем расширения из списка
This commit is contained in:
		
							parent
							
								
									b1da58c3b3
								
							
						
					
					
						commit
						bf655e3f96
					
				@ -1,5 +1,5 @@
 | 
			
		||||
<?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>
 | 
			
		||||
        <import addon="xbmc.python" version="3.0.0"/>
 | 
			
		||||
        <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',
 | 
			
		||||
                     '.ssf', '.srt', '.ssa', '.ass', '.usf', '.idx']
 | 
			
		||||
 | 
			
		||||
VIDEO_FORMATS = ['.mkv', '.mp4', '.avi', '.ogv', '.ts', '.flv', '.webm', '.vob', '.3gp', '.mpg', '.mpeg']
 | 
			
		||||
 | 
			
		||||
class Struct(dict):
 | 
			
		||||
    def __getattr__(self, attr):
 | 
			
		||||
@ -43,7 +43,9 @@ def detect_media_type(name):
 | 
			
		||||
        return MediaType.SUBTITLES
 | 
			
		||||
    else:
 | 
			
		||||
        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
 | 
			
		||||
        mime_type = mime_type.split("/")[0]
 | 
			
		||||
        if mime_type == 'audio':
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user