mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-28 23:53:37 +00:00
Merge branch 'feature/Change2160pParsing' into dev
This commit is contained in:
commit
35eaf4d0d5
5 changed files with 23 additions and 11 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Add menu Shows/"TVDb Cards"
|
* Add menu Shows/"TVDb Cards"
|
||||||
* Add a persons available socials (Youtube, LinkedIn, Reddit, Fansite, TikTok, Wikidata)
|
* Add a persons available socials (Youtube, LinkedIn, Reddit, Fansite, TikTok, Wikidata)
|
||||||
* Change increase viewable history menu items from 13 to 15
|
* Change increase viewable history menu items from 13 to 15
|
||||||
|
* Change add parsing of 2160p releases that don't have a source tag
|
||||||
|
|
||||||
|
|
||||||
### 3.32.8 (2024-10-07 00:30:00 UTC)
|
### 3.32.8 (2024-10-07 00:30:00 UTC)
|
||||||
|
|
|
@ -344,6 +344,8 @@ class Quality(object):
|
||||||
return Quality.UHD4KBLURAY
|
return Quality.UHD4KBLURAY
|
||||||
if name_has([webfmt]):
|
if name_has([webfmt]):
|
||||||
return Quality.UHD4KWEB
|
return Quality.UHD4KWEB
|
||||||
|
# for some non scene releases that have no source in name
|
||||||
|
return Quality.UHD4KWEB
|
||||||
|
|
||||||
return Quality.UNKNOWN
|
return Quality.UNKNOWN
|
||||||
|
|
||||||
|
@ -360,11 +362,12 @@ class Quality(object):
|
||||||
from sickgear import logger
|
from sickgear import logger
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
|
|
||||||
from hachoir.parser import createParser
|
from lib.hachoir.parser import createParser
|
||||||
from hachoir.metadata import extractMetadata
|
from lib.hachoir.metadata import extractMetadata
|
||||||
from hachoir.stream import InputStreamError
|
from lib.hachoir.metadata.metadata_item import QUALITY_BEST
|
||||||
|
from lib.hachoir.stream import InputStreamError
|
||||||
|
|
||||||
parser = height = None
|
parser = height = width = None
|
||||||
msg = 'Hachoir can\'t parse file "%s" content quality because it found error: %s'
|
msg = 'Hachoir can\'t parse file "%s" content quality because it found error: %s'
|
||||||
try:
|
try:
|
||||||
parser = createParser(filename)
|
parser = createParser(filename)
|
||||||
|
@ -381,17 +384,19 @@ class Quality(object):
|
||||||
parser.parse_exif = False
|
parser.parse_exif = False
|
||||||
parser.parse_photoshop_content = False
|
parser.parse_photoshop_content = False
|
||||||
parser.parse_comments = False
|
parser.parse_comments = False
|
||||||
extract = extractMetadata(parser, **args)
|
extract = extractMetadata(parser, quality=QUALITY_BEST, **args)
|
||||||
except (BaseException, Exception) as e:
|
except (BaseException, Exception) as e:
|
||||||
logger.warning(msg % (filename, ex(e)))
|
logger.warning(msg % (filename, ex(e)))
|
||||||
if extract:
|
if extract:
|
||||||
try:
|
try:
|
||||||
height = extract.get('height')
|
height = extract.get('height')
|
||||||
|
width = extract.get('width')
|
||||||
except (AttributeError, ValueError):
|
except (AttributeError, ValueError):
|
||||||
try:
|
try:
|
||||||
for metadata in extract.iterGroups():
|
for metadata in extract.iterGroups():
|
||||||
if re.search('(?i)video', metadata.header):
|
if re.search('(?i)video', metadata.header):
|
||||||
height = metadata.get('height')
|
height = metadata.get('height')
|
||||||
|
width = metadata.get('width')
|
||||||
break
|
break
|
||||||
except (AttributeError, ValueError):
|
except (AttributeError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
@ -401,9 +406,12 @@ class Quality(object):
|
||||||
|
|
||||||
tolerance = (lambda value, percent: int(round(value - (value * percent / 100.0))))
|
tolerance = (lambda value, percent: int(round(value - (value * percent / 100.0))))
|
||||||
if None is not height and height >= tolerance(352, 5):
|
if None is not height and height >= tolerance(352, 5):
|
||||||
if height <= tolerance(720, 2):
|
if height <= tolerance(720, 2) and (None is width or width < tolerance(1280, 2)):
|
||||||
return Quality.SDTV
|
return Quality.SDTV
|
||||||
return (Quality.HDTV, Quality.FULLHDTV)[height >= tolerance(1080, 1)]
|
if 1100 < height or (None is not width and 2000 < width):
|
||||||
|
return Quality.UHD4KWEB
|
||||||
|
return (Quality.HDTV, Quality.FULLHDTV)[
|
||||||
|
height >= tolerance(1080, 1) or (None is not width and width >= tolerance(1920, 4))]
|
||||||
return Quality.UNKNOWN
|
return Quality.UNKNOWN
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -40,6 +40,7 @@ if False:
|
||||||
|
|
||||||
from lib.hachoir.parser import createParser, guessParser
|
from lib.hachoir.parser import createParser, guessParser
|
||||||
from lib.hachoir.metadata import extractMetadata
|
from lib.hachoir.metadata import extractMetadata
|
||||||
|
from lib.hachoir.metadata.metadata_item import QUALITY_BEST
|
||||||
from lib.hachoir.stream import StringInputStream
|
from lib.hachoir.stream import StringInputStream
|
||||||
|
|
||||||
cache_img_base = {'tvmaze': TVINFO_TVMAZE, 'themoviedb': TVINFO_TMDB, 'thetvdb': TVINFO_TVDB, 'imdb': TVINFO_IMDB}
|
cache_img_base = {'tvmaze': TVINFO_TVMAZE, 'themoviedb': TVINFO_TMDB, 'thetvdb': TVINFO_TVDB, 'imdb': TVINFO_IMDB}
|
||||||
|
@ -379,7 +380,7 @@ class ImageCache(object):
|
||||||
img_parser.parse_comments = False
|
img_parser.parse_comments = False
|
||||||
img_parser.parse_exif = False
|
img_parser.parse_exif = False
|
||||||
img_parser.parse_photoshop_content = False
|
img_parser.parse_photoshop_content = False
|
||||||
img_metadata = extractMetadata(img_parser)
|
img_metadata = extractMetadata(img_parser, quality=QUALITY_BEST)
|
||||||
except (BaseException, Exception) as e:
|
except (BaseException, Exception) as e:
|
||||||
logger.debug(f'Unable to extract metadata from {image}, not using file. Error: {ex(e)}')
|
logger.debug(f'Unable to extract metadata from {image}, not using file. Error: {ex(e)}')
|
||||||
return
|
return
|
||||||
|
|
|
@ -41,8 +41,8 @@ from ..sgdatetime import SGDatetime
|
||||||
from ..tv import TVEpisode, TVShow
|
from ..tv import TVEpisode, TVShow
|
||||||
|
|
||||||
from cfscrape import CloudflareScraper
|
from cfscrape import CloudflareScraper
|
||||||
from hachoir.parser import guessParser
|
from lib.hachoir.parser import guessParser
|
||||||
from hachoir.stream import FileInputStream
|
from lib.hachoir.stream import FileInputStream
|
||||||
from lxml_etree import etree
|
from lxml_etree import etree
|
||||||
import requests
|
import requests
|
||||||
import requests.cookies
|
import requests.cookies
|
||||||
|
|
|
@ -126,7 +126,8 @@ quality_tests = {
|
||||||
'Test.Show.S01E02.2160p.WEBRip.h264-GROUP',
|
'Test.Show.S01E02.2160p.WEBRip.h264-GROUP',
|
||||||
'Test.Show.S01E02.2160p.WEBRip.x264-GROUP',
|
'Test.Show.S01E02.2160p.WEBRip.x264-GROUP',
|
||||||
'Test.Show.S01E02.2160p.WEBRip.x265-GROUP',
|
'Test.Show.S01E02.2160p.WEBRip.x265-GROUP',
|
||||||
'Test.Show.S01E02.2160p.WEBRip.vp9-GROUP'],
|
'Test.Show.S01E02.2160p.WEBRip.vp9-GROUP',
|
||||||
|
'Test.Show.S02E01.The.Name.2160p.DV.HDR.Opus.AV1'],
|
||||||
common.Quality.UHD4KBLURAY: [
|
common.Quality.UHD4KBLURAY: [
|
||||||
'Test.Show.S01E02.2160p.BluRay.h264-GROUP',
|
'Test.Show.S01E02.2160p.BluRay.h264-GROUP',
|
||||||
'Test.Show.S01E02.2160p.BluRay.x264-GROUP',
|
'Test.Show.S01E02.2160p.BluRay.x264-GROUP',
|
||||||
|
@ -3110,6 +3111,7 @@ class QualityTests(unittest.TestCase):
|
||||||
(('The.Show.S03E05.1080p.NF.WEB-DL.DD5.1.HDR.HEVC-Group', False), common.Quality.FULLHDWEBDL),
|
(('The.Show.S03E05.1080p.NF.WEB-DL.DD5.1.HDR.HEVC-Group', False), common.Quality.FULLHDWEBDL),
|
||||||
(('The.Show.S01E10.Name.2160p.UHD.BluRay.REMUX.HDR.HEVC.DTS-HD.MA.5.1', False), common.Quality.UHD4KBLURAY),
|
(('The.Show.S01E10.Name.2160p.UHD.BluRay.REMUX.HDR.HEVC.DTS-HD.MA.5.1', False), common.Quality.UHD4KBLURAY),
|
||||||
(('Show.S01E07.2160p.4K.UHD.10bit.NF.WEBRip.5.1.x265.HEVC-Group', False), common.Quality.UHD4KWEB),
|
(('Show.S01E07.2160p.4K.UHD.10bit.NF.WEBRip.5.1.x265.HEVC-Group', False), common.Quality.UHD4KWEB),
|
||||||
|
(('Test.Show.S02E01.The.Name.2160p.DV.HDR.Opus.AV1', False), common.Quality.UHD4KWEB),
|
||||||
])
|
])
|
||||||
for q, l in iteritems(quality_tests):
|
for q, l in iteritems(quality_tests):
|
||||||
self.check_sceneQuality([((v, False), q) for v in l])
|
self.check_sceneQuality([((v, False), q) for v in l])
|
||||||
|
|
Loading…
Reference in a new issue