@ -21,7 +21,7 @@ class QualityPlugin(Plugin):
{ ' identifier ' : ' 720p ' , ' hd ' : True , ' size ' : ( 3500 , 10000 ) , ' label ' : ' 720P ' , ' width ' : 1280 , ' alternative ' : [ ] , ' allow ' : [ ] , ' ext ' : [ ' mkv ' , ' m2ts ' , ' ts ' ] } ,
{ ' identifier ' : ' 720p ' , ' hd ' : True , ' size ' : ( 3500 , 10000 ) , ' label ' : ' 720P ' , ' width ' : 1280 , ' alternative ' : [ ] , ' allow ' : [ ] , ' ext ' : [ ' mkv ' , ' m2ts ' , ' ts ' ] } ,
{ ' identifier ' : ' brrip ' , ' hd ' : True , ' size ' : ( 700 , 7000 ) , ' label ' : ' BR-Rip ' , ' alternative ' : [ ' bdrip ' ] , ' allow ' : [ ' 720p ' ] , ' ext ' : [ ' avi ' ] } ,
{ ' identifier ' : ' brrip ' , ' hd ' : True , ' size ' : ( 700 , 7000 ) , ' label ' : ' BR-Rip ' , ' alternative ' : [ ' bdrip ' ] , ' allow ' : [ ' 720p ' ] , ' ext ' : [ ' avi ' ] } ,
{ ' identifier ' : ' dvdr ' , ' size ' : ( 3000 , 10000 ) , ' label ' : ' DVD-R ' , ' alternative ' : [ ] , ' allow ' : [ ] , ' ext ' : [ ' iso ' , ' img ' ] , ' tags ' : [ ' pal ' , ' ntsc ' , ' video_ts ' , ' audio_ts ' ] } ,
{ ' identifier ' : ' dvdr ' , ' size ' : ( 3000 , 10000 ) , ' label ' : ' DVD-R ' , ' alternative ' : [ ] , ' allow ' : [ ] , ' ext ' : [ ' iso ' , ' img ' ] , ' tags ' : [ ' pal ' , ' ntsc ' , ' video_ts ' , ' audio_ts ' ] } ,
{ ' identifier ' : ' dvdrip ' , ' size ' : ( 600 , 2400 ) , ' label ' : ' DVD-Rip ' , ' alternative ' : [ ' dvdrip ' ] , ' allow ' : [ ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' dvdrip ' , ' size ' : ( 600 , 2400 ) , ' label ' : ' DVD-Rip ' , ' width ' : 720 , ' alternative' : [ ' dvdrip ' ] , ' allow ' : [ ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' scr ' , ' size ' : ( 600 , 1600 ) , ' label ' : ' Screener ' , ' alternative ' : [ ' screener ' , ' dvdscr ' , ' ppvrip ' ] , ' allow ' : [ ' dvdr ' , ' dvd ' ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' scr ' , ' size ' : ( 600 , 1600 ) , ' label ' : ' Screener ' , ' alternative ' : [ ' screener ' , ' dvdscr ' , ' ppvrip ' ] , ' allow ' : [ ' dvdr ' , ' dvd ' ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' r5 ' , ' size ' : ( 600 , 1000 ) , ' label ' : ' R5 ' , ' alternative ' : [ ] , ' allow ' : [ ' dvdr ' ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' r5 ' , ' size ' : ( 600 , 1000 ) , ' label ' : ' R5 ' , ' alternative ' : [ ] , ' allow ' : [ ' dvdr ' ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' tc ' , ' size ' : ( 600 , 1000 ) , ' label ' : ' TeleCine ' , ' alternative ' : [ ' telecine ' ] , ' allow ' : [ ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
{ ' identifier ' : ' tc ' , ' size ' : ( 600 , 1000 ) , ' label ' : ' TeleCine ' , ' alternative ' : [ ' telecine ' ] , ' allow ' : [ ] , ' ext ' : [ ' avi ' , ' mpg ' , ' mpeg ' ] } ,
@ -151,7 +151,7 @@ class QualityPlugin(Plugin):
return True
return True
def guess ( self , files , extra = { } , loose = False ) :
def guess ( self , files , extra = { } ) :
# Create hash for cache
# Create hash for cache
hash = md5 ( str ( [ f . replace ( ' . ' + getExt ( f ) , ' ' ) for f in files ] ) )
hash = md5 ( str ( [ f . replace ( ' . ' + getExt ( f ) , ' ' ) for f in files ] ) )
@ -182,25 +182,25 @@ class QualityPlugin(Plugin):
log . debug ( ' Found %s via tag %s in %s ' % ( quality [ ' identifier ' ] , quality . get ( ' tags ' ) , cur_file ) )
log . debug ( ' Found %s via tag %s in %s ' % ( quality [ ' identifier ' ] , quality . get ( ' tags ' ) , cur_file ) )
return self . setCache ( hash , quality )
return self . setCache ( hash , quality )
# Check on unreliable stuff
# Try again with loose testing
if loose :
quality = self . guessLoose ( hash , extra = extra )
if quality :
return self . setCache ( hash , quality )
log . debug ( ' Could not identify quality for: %s ' % files )
return None
def guessLoose ( self , hash , extra ) :
for quality in self . all ( ) :
# Last check on resolution only
# Last check on resolution only
if quality . get ( ' width ' , 480 ) == extra . get ( ' resolution_width ' , 0 ) :
if quality . get ( ' width ' , 480 ) == extra . get ( ' resolution_width ' , 0 ) :
log . debug ( ' Found %s via resolution_width: %s == %s ' % ( quality [ ' identifier ' ] , quality . get ( ' width ' , 480 ) , extra . get ( ' resolution_width ' , 0 ) ) )
log . debug ( ' Found %s via resolution_width: %s == %s ' % ( quality [ ' identifier ' ] , quality . get ( ' width ' , 480 ) , extra . get ( ' resolution_width ' , 0 ) ) )
return self . setCache ( hash , quality )
return self . setCache ( hash , quality )
# Check extension + filesize
if 480 < = extra . get ( ' resolution_width ' , 0 ) < = 720 :
if list ( set ( quality . get ( ' ext ' , [ ] ) ) & set ( words ) ) and size > = quality [ ' size_min ' ] and size < = quality [ ' size_max ' ] :
log . debug ( ' Found as dvdrip ' )
log . debug ( ' Found %s via ext and filesize %s in %s ' % ( quality [ ' identifier ' ] , quality . get ( ' ext ' ) , words ) )
return self . setCache ( hash , self . single ( ' dvdrip ' ) )
return self . setCache ( hash , quality )
# Try again with loose testing
if not loose :
quality = self . guess ( files , extra = extra , loose = True )
if quality :
return self . setCache ( hash , quality )
log . debug ( ' Could not identify quality for: %s ' % files )
return None
return None