Few changes
Added --match-forced flag
This commit is contained in:
parent
f7bdd003c4
commit
91e9e2f579
@ -426,6 +426,7 @@ Tested so far on Amazon, AppleTVPlus, Max, and DisneyPlus.
|
|||||||
- [ ] Fix `-sl all` and `-al all`
|
- [ ] Fix `-sl all` and `-al all`
|
||||||
- [ ] Make a windscribe.py for proxies modelled after nordvpn.py. Refer to the chrome extension for the code.
|
- [ ] Make a windscribe.py for proxies modelled after nordvpn.py. Refer to the chrome extension for the code.
|
||||||
- [ ] Move to requests, curl or otherwise to download subtitles (?)
|
- [ ] Move to requests, curl or otherwise to download subtitles (?)
|
||||||
|
- [ ] Replace track.dv, track.hdr10 with track.PQ. Value will be an enum. This will require a major-ish rewrite.
|
||||||
- [ ] Netflix service is currently broken (will probably be fixed Soon™)
|
- [ ] Netflix service is currently broken (will probably be fixed Soon™)
|
||||||
- [ ] Integrate [subby](https://github.com/vevv/subby)
|
- [ ] Integrate [subby](https://github.com/vevv/subby)
|
||||||
- [ ] Licensing before download (?)
|
- [ ] Licensing before download (?)
|
||||||
|
|||||||
@ -278,6 +278,8 @@ def get_credentials(service, profile="default"):
|
|||||||
help="Force muxing when using --audio-only/--subs-only/--chapters-only.")
|
help="Force muxing when using --audio-only/--subs-only/--chapters-only.")
|
||||||
@click.option("-ss", "--strip-sdh", is_flag=True, default=False,
|
@click.option("-ss", "--strip-sdh", is_flag=True, default=False,
|
||||||
help="Stip SDH subtitles and convert them to CC. Plus fix common errors.")
|
help="Stip SDH subtitles and convert them to CC. Plus fix common errors.")
|
||||||
|
@click.option("-mf", "--match-forced", is_flag=True, default=False,
|
||||||
|
help="Only select forced subtitles matching with specified audio language")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def dl(ctx, profile, cdm, *_, **__):
|
def dl(ctx, profile, cdm, *_, **__):
|
||||||
log = logging.getLogger("dl")
|
log = logging.getLogger("dl")
|
||||||
@ -330,7 +332,7 @@ def dl(ctx, profile, cdm, *_, **__):
|
|||||||
|
|
||||||
@dl.result_callback()
|
@dl.result_callback()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def result(ctx, service, quality, closest_resolution, range_, wanted, alang, slang, acodec, audio_only, subs_only, chapters_only, audio_description, audio_channels, max_audio_compatability,
|
def result(ctx, service, quality, closest_resolution, range_, wanted, alang, slang, acodec, audio_only, subs_only, chapters_only, audio_description, audio_channels, max_audio_compatability, match_forced,
|
||||||
list_, keys, cache, no_cache, no_subs, no_audio, no_video, no_chapters, atmos, vbitrate, abitrate: int, no_mux, mux, selected, latest_episode, strip_sdh, *_, **__):
|
list_, keys, cache, no_cache, no_subs, no_audio, no_video, no_chapters, atmos, vbitrate, abitrate: int, no_mux, mux, selected, latest_episode, strip_sdh, *_, **__):
|
||||||
def ccextractor():
|
def ccextractor():
|
||||||
log.info("Extracting EIA-608 captions from stream with CCExtractor")
|
log.info("Extracting EIA-608 captions from stream with CCExtractor")
|
||||||
@ -436,7 +438,8 @@ def result(ctx, service, quality, closest_resolution, range_, wanted, alang, sla
|
|||||||
else:
|
else:
|
||||||
title.tracks.select_videos(by_quality=quality, by_vbitrate=vbitrate, by_range=range_, one_only=True)
|
title.tracks.select_videos(by_quality=quality, by_vbitrate=vbitrate, by_range=range_, one_only=True)
|
||||||
title.tracks.select_audios(by_language=alang, by_bitrate=abitrate, with_descriptive=audio_description, by_codec=acodec, by_channels=audio_channels, max_audio_compatability=max_audio_compatability)
|
title.tracks.select_audios(by_language=alang, by_bitrate=abitrate, with_descriptive=audio_description, by_codec=acodec, by_channels=audio_channels, max_audio_compatability=max_audio_compatability)
|
||||||
title.tracks.select_subtitles(by_language=slang, with_forced=True)
|
forced = alang if (match_forced and alang) else True
|
||||||
|
title.tracks.select_subtitles(by_language=slang, with_forced=forced)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
log.error(f" - {e}")
|
log.error(f" - {e}")
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -343,7 +343,7 @@ class MSL:
|
|||||||
|
|
||||||
def send_message(self, endpoint, params, application_data, userauthdata=None):
|
def send_message(self, endpoint, params, application_data, userauthdata=None):
|
||||||
message = self.create_message(application_data, userauthdata)
|
message = self.create_message(application_data, userauthdata)
|
||||||
res = self.session.post(url=endpoint, data=message, params=params, verify=False)
|
res = self.session.post(url=endpoint, data=message, params=params, verify=False) # verify=True?
|
||||||
header, payload_data = self.parse_message(res.text)
|
header, payload_data = self.parse_message(res.text)
|
||||||
if "errordata" in header:
|
if "errordata" in header:
|
||||||
raise self.log.exit(
|
raise self.log.exit(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user