mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-11-11 01:23:38 +08:00
Merge remote-tracking branch 'origin/development' into halali
# Conflicts: # bazarr/get_subtitle.py
This commit is contained in:
commit
eeb63d2568
15 changed files with 55 additions and 30 deletions
|
@ -16,7 +16,7 @@ import subliminal
|
|||
import subliminal_patch
|
||||
from datetime import datetime, timedelta
|
||||
from subzero.language import Language
|
||||
from subzero.video import parse_video
|
||||
from subzero.video import parse_video, refine_video
|
||||
from subliminal import region, score as subliminal_scores, \
|
||||
list_subtitles
|
||||
from subliminal_patch.core import SZAsyncProviderPool, download_best_subtitles, save_subtitles, download_subtitles
|
||||
|
@ -58,12 +58,14 @@ def get_video(path, title, sceneName, use_scenename, providers=None, media_type=
|
|||
# use the sceneName but keep the folder structure for better guessing
|
||||
path = os.path.join(os.path.dirname(path), sceneName + os.path.splitext(path)[1])
|
||||
dont_use_actual_file = True
|
||||
|
||||
try:
|
||||
if providers:
|
||||
video = parse_video(path, hints=hints, providers=providers, dry_run=dont_use_actual_file)
|
||||
video.used_scene_name = dont_use_actual_file
|
||||
video.original_name = original_name
|
||||
video.original_path = original_path
|
||||
refine_video(video)
|
||||
return video
|
||||
else:
|
||||
logging.info("BAZARR All providers are throttled")
|
||||
|
|
|
@ -153,17 +153,18 @@ def init_binaries():
|
|||
|
||||
unrar_exe = None
|
||||
exe = None
|
||||
if platform.system() == "Windows": # Windows
|
||||
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "Windows", "i386", "UnRAR", "UnRAR.exe"))
|
||||
|
||||
elif platform.system() == "Darwin": # MacOSX
|
||||
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "MacOSX", "i386", "UnRAR", "unrar"))
|
||||
|
||||
elif platform.system() == "Linux": # Linux
|
||||
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "Linux", platform.machine(), "UnRAR", "unrar"))
|
||||
|
||||
else:
|
||||
if os.path.isfile("unrar"):
|
||||
unrar_exe = "unrar"
|
||||
else:
|
||||
if platform.system() == "Windows": # Windows
|
||||
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "Windows", "i386", "UnRAR", "UnRAR.exe"))
|
||||
|
||||
elif platform.system() == "Darwin": # MacOSX
|
||||
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "MacOSX", "i386", "UnRAR", "unrar"))
|
||||
|
||||
elif platform.system() == "Linux": # Linux
|
||||
unrar_exe = os.path.abspath(os.path.join(binaries_dir, "Linux", platform.machine(), "UnRAR", "unrar"))
|
||||
|
||||
if unrar_exe and os.path.isfile(unrar_exe):
|
||||
exe = unrar_exe
|
||||
|
|
0
bin/Linux/aarch64/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/aarch64/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/armv5tel/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/armv5tel/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/i386/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/i386/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/x86_64/UnRAR/unrar
Normal file → Executable file
0
bin/Linux/x86_64/UnRAR/unrar
Normal file → Executable file
0
bin/MacOSX/i386/UnRAR/unrar
Normal file → Executable file
0
bin/MacOSX/i386/UnRAR/unrar
Normal file → Executable file
|
@ -565,7 +565,7 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen
|
|||
p = entry.name
|
||||
|
||||
# keep only valid subtitle filenames
|
||||
if not p.startswith(fileroot) or not p.endswith(SUBTITLE_EXTENSIONS):
|
||||
if not p.lower().startswith(fileroot.lower()) or not p.endswith(SUBTITLE_EXTENSIONS):
|
||||
continue
|
||||
|
||||
p_root, p_ext = os.path.splitext(p)
|
||||
|
|
|
@ -4,6 +4,7 @@ import io
|
|||
import logging
|
||||
import math
|
||||
import re
|
||||
from random import randint
|
||||
|
||||
import rarfile
|
||||
|
||||
|
@ -24,6 +25,7 @@ from subliminal.subtitle import guess_matches
|
|||
from subliminal.video import Episode, Movie
|
||||
from subliminal.subtitle import fix_line_ending
|
||||
from subzero.language import Language
|
||||
from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST
|
||||
|
||||
# parsing regex definitions
|
||||
title_re = re.compile(r'(?P<title>(?:.+(?= [Aa][Kk][Aa] ))|.+)(?:(?:.+)(?P<altitle>(?<= [Aa][Kk][Aa] ).+))?')
|
||||
|
@ -134,8 +136,7 @@ class TitloviProvider(Provider, ProviderSubtitleArchiveMixin):
|
|||
|
||||
def initialize(self):
|
||||
self.session = Session()
|
||||
self.session.headers['User-Agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3)' \
|
||||
'Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
|
||||
self.session.headers['User-Agent'] = AGENT_LIST[randint(0, len(AGENT_LIST) - 1)]
|
||||
logger.debug('User-Agent set to %s', self.session.headers['User-Agent'])
|
||||
self.session.headers['Referer'] = self.server_url
|
||||
logger.debug('Referer set to %s', self.session.headers['Referer'])
|
||||
|
@ -223,7 +224,7 @@ class TitloviProvider(Provider, ProviderSubtitleArchiveMixin):
|
|||
if match:
|
||||
try:
|
||||
# decode language
|
||||
lang = Language.fromtitlovi(match.group('lang')+match.group('script'))
|
||||
lang = Language.fromtitlovi(match.group('lang') + match.group('script'))
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
|
|
|
@ -8,6 +8,25 @@ repl_map = {
|
|||
"dk": "da",
|
||||
"nld": "nl",
|
||||
"english": "en",
|
||||
"alb": "sq",
|
||||
"arm": "hy",
|
||||
"baq": "eu",
|
||||
"bur": "my",
|
||||
"chi": "zh",
|
||||
"cze": "cs",
|
||||
"dut": "nl",
|
||||
"fre": "fr",
|
||||
"geo": "ka",
|
||||
"ger": "de",
|
||||
"gre": "el",
|
||||
"ice": "is",
|
||||
"mac": "mk",
|
||||
"mao": "mi",
|
||||
"may": "ms",
|
||||
"per": "fa",
|
||||
"rum": "ro",
|
||||
"slo": "sk",
|
||||
"tib": "bo",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -472,7 +472,7 @@
|
|||
hi: hi,
|
||||
sonarrSeriesId: sonarrSeriesId,
|
||||
sonarrEpisodeId: sonarrEpisodeId,
|
||||
title: '{{!details[0].replace("'", "\\'")}}'
|
||||
title: '{{!details[0].replace("'", "\'")}}'
|
||||
};
|
||||
|
||||
$('#search_result').DataTable( {
|
||||
|
@ -482,12 +482,13 @@
|
|||
zeroRecords: 'No subtitles found for this episode'
|
||||
},
|
||||
paging: true,
|
||||
lengthChange: false,
|
||||
pageLength: 5,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
processing: false,
|
||||
serverSide: false,
|
||||
lengthMenu: [ [ 5, 10, 25, 50, 100 , -1 ] , [ 5, 10, 25, 50, 100, "All" ] ],
|
||||
ajax: {
|
||||
ajax: {
|
||||
url: '{{base_url}}manual_search',
|
||||
type: 'POST',
|
||||
data: values
|
||||
|
|
|
@ -417,7 +417,7 @@
|
|||
language: language,
|
||||
hi: hi,
|
||||
radarrId: radarrId,
|
||||
title: '{{!details[0].replace("'", "\\'")}}'
|
||||
title: '{{!details[0].replace("'", "\'")}}'
|
||||
};
|
||||
|
||||
$('#search_result').DataTable( {
|
||||
|
@ -427,12 +427,13 @@
|
|||
zeroRecords: 'No subtitles found for this movie'
|
||||
},
|
||||
paging: true,
|
||||
lengthChange: false,
|
||||
pageLength: 5,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
processing: false,
|
||||
serverSide: false,
|
||||
lengthMenu: [ [ 5, 10, 25, 50, 100 , -1 ] , [ 5, 10, 25, 50, 100, "All" ] ],
|
||||
ajax: {
|
||||
ajax: {
|
||||
url: '{{base_url}}manual_search_movie',
|
||||
type: 'POST',
|
||||
data: values
|
||||
|
|
|
@ -1028,7 +1028,7 @@
|
|||
<div class="two wide column">
|
||||
<div class='field'>
|
||||
<div class="ui input">
|
||||
<input name="settings_general_minimum_score" type="number" min="0" max="100" step="5" onkeydown="return false" value="{{settings.general.minimum_score}}">
|
||||
<input name="settings_general_minimum_score" type="number" min="0" max="100" step="1" onkeydown="return false" value="{{settings.general.minimum_score}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1048,7 +1048,7 @@
|
|||
<div class="two wide column">
|
||||
<div class='field'>
|
||||
<div class="ui input">
|
||||
<input name="settings_general_minimum_score_movies" type="number" min="0" max="100" step="5" onkeydown="return false" value="{{settings.general.minimum_score_movie}}">
|
||||
<input name="settings_general_minimum_score_movies" type="number" min="0" max="100" step="1" onkeydown="return false" value="{{settings.general.minimum_score_movie}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
%end
|
||||
%end
|
||||
%else:
|
||||
<a data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[4]}}" data-radarrId={{row[2]}} class="get_subtitle ui tiny label">
|
||||
<a data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[4]}}" data-radarrId="{{row[2]}}" data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
|
||||
{{language}}
|
||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||
</a>
|
||||
|
@ -119,12 +119,12 @@
|
|||
backward icon"></i>
|
||||
{{page}} / {{max_page}}
|
||||
<i class="\\
|
||||
%if int(page) == int(max_page):
|
||||
%if int(page) >= int(max_page):
|
||||
disabled\\
|
||||
%end
|
||||
forward icon"></i>
|
||||
<i class="\\
|
||||
%if int(page) == int(max_page):
|
||||
%if int(page) >= int(max_page):
|
||||
disabled\\
|
||||
%end
|
||||
fast forward icon"></i>
|
||||
|
@ -168,7 +168,7 @@
|
|||
language: $(this).attr("data-language"),
|
||||
hi: $(this).attr("data-hi"),
|
||||
radarrId: $(this).attr("data-radarrId"),
|
||||
title: '{{!row[0].replace("'", "\\'")}}'
|
||||
title: $(this).attr("data-title")
|
||||
};
|
||||
$('#loader_text').text("Downloading subtitles...");
|
||||
$('#loader').addClass('active');
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
%end
|
||||
%end
|
||||
%else:
|
||||
<a data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[6]}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} class="get_subtitle ui tiny label">
|
||||
<a data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[6]}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
|
||||
{{language}}
|
||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||
</a>
|
||||
|
@ -126,12 +126,12 @@
|
|||
backward icon"></i>
|
||||
{{page}} / {{max_page}}
|
||||
<i class="\\
|
||||
%if int(page) == int(max_page):
|
||||
%if int(page) >= int(max_page):
|
||||
disabled\\
|
||||
%end
|
||||
forward icon"></i>
|
||||
<i class="\\
|
||||
%if int(page) == int(max_page):
|
||||
%if int(page) >= int(max_page):
|
||||
disabled\\
|
||||
%end
|
||||
fast forward icon"></i>
|
||||
|
@ -176,7 +176,7 @@
|
|||
hi: $(this).attr("data-hi"),
|
||||
sonarrSeriesId: $(this).attr("data-sonarrSeriesId"),
|
||||
sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId"),
|
||||
title: '{{!row[0].replace("'", "\\'")}}'
|
||||
title: $(this).attr("data-title")
|
||||
};
|
||||
$('#loader_text').text("Downloading subtitles...");
|
||||
$('#loader').addClass('active');
|
||||
|
|
Loading…
Reference in a new issue