Skip to content

Commit

Permalink
添加 --all-subtitles 选项,发布新版本
Browse files Browse the repository at this point in the history
  • Loading branch information
xhlove committed Jul 9, 2022
1 parent 3e1afd8 commit b3bcd5c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 34 deletions.
10 changes: 2 additions & 8 deletions README.md
Expand Up @@ -4,12 +4,6 @@

基于`python 3.7.4`的,命令行版本的,HLS/DASH流下载器,仅支持**HLS标准AES-128-CBC**解密

![XstreamDL-GUI](images/oCam_2021_12_19_00_07_34_559.gif)

[XstreamDL-GUI](https://github.com/xhlove/XstreamDL-CLI/releases/download/1.3.8/XstreamDL-GUI_v1.3.8.exe)

**使用XstreamDL-GUI需要和XstreamDL-CLI放一起**

## 使用

**首先将`ffmpeg``mp4decrypt`的可执行文件放置在`binaries`文件夹中**
Expand Down Expand Up @@ -220,7 +214,7 @@ C#版写起来非常不顺手,搁置了
## HELP INFO

```bash
version 1.4.1, A downloader that download the HLS/DASH stream.
version 1.4.3, A downloader that download the HLS/DASH stream.
usage: XstreamDL-CLI [OPTION]... URL/FILE/FOLDER...

A downloader that download the HLS/DASH stream
Expand Down Expand Up @@ -302,7 +296,7 @@ optional arguments:
## pyinstaller打包
```bash
pyinstaller -i logo.ico -n XstreamDL-CLI_v1.4.1 -F XstreamDL_CLI\__main__.py
pyinstaller -i logo.ico -n XstreamDL-CLI_v1.4.3 -F XstreamDL_CLI\__main__.py
```
已添加自动构建,可前往[Actions](https://github.com/xhlove/XstreamDL-CLI/actions)页面下载最新dev版本程序
Expand Down
16 changes: 4 additions & 12 deletions README_ENG.md
@@ -1,11 +1,3 @@
![XstreamDL-GUI](images/oCam_2021_12_19_00_07_34_559.gif)

[XstreamDL-GUI](https://github.com/xhlove/XstreamDL-CLI/releases/download/1.3.8/XstreamDL-GUI_v1.3.8.exe)

**XstreamDL-GUI must use with XstreamDL-CLI**

---

The tool is unfriendly, read README carefully if you want to use it.

# FIRST
Expand Down Expand Up @@ -36,7 +28,7 @@ some_folder
binaries
ffmpeg.exe
mp4decrypt.exe
XstreamDL-CLI_v1.4.1.exe
XstreamDL-CLI_v1.4.3.exe
```

## tips
Expand Down Expand Up @@ -85,8 +77,8 @@ if you want to privacy protection, you can

```bash
[question]: download successfully, but cannot decrypt
[version]: XstreamDL-CLI_v1.4.1.exe
[command]: XstreamDL-CLI_v1.4.1.exe --select --raw-concat "https://ec05-poz1.waw2.cache.orange.pl/canal/v/canal/vod/store01/FPL_Y6mY2VScXBCoXRHn6R9K/_/hd4-hssdrm02.ism/manifest"
[version]: XstreamDL-CLI_v1.4.3.exe
[command]: XstreamDL-CLI_v1.4.3.exe --select --raw-concat "https://ec05-poz1.waw2.cache.orange.pl/canal/v/canal/vod/store01/FPL_Y6mY2VScXBCoXRHn6R9K/_/hd4-hssdrm02.ism/manifest"
[traceback]:
[init segment]:
[sample segment]:
Expand Down Expand Up @@ -130,7 +122,7 @@ read **HELP INFO** for more option
# HELP INFO

```bash
version 1.4.1, A downloader that download the HLS/DASH stream.
version 1.4.3, A downloader that download the HLS/DASH stream.
usage: XstreamDL-CLI [OPTION]... URL/FILE/FOLDER...

A downloader that download the HLS/DASH stream
Expand Down
2 changes: 1 addition & 1 deletion XstreamDL-GUI.spec
Expand Up @@ -27,7 +27,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='XstreamDL-GUI_v1.4.1',
name='XstreamDL-GUI_v1.4.3',
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down
1 change: 1 addition & 0 deletions XstreamDL_CLI/cli.py
Expand Up @@ -109,6 +109,7 @@ def print_version():
parser.add_argument('--audio-only', action='store_true', help='only choose audio stream when use --best-quality')
parser.add_argument('--all-videos', action='store_true', help='choose all video stream to download')
parser.add_argument('--all-audios', action='store_true', help='choose all audio stream to download')
parser.add_argument('--all-subtitles', action='store_true', help='choose all subtitle stream to download')
parser.add_argument('--service', default='', help='set serviceLocation for BaseURL choose')
parser.add_argument('--save-dir', default='Downloads', help='set save dir for Stream')
parser.add_argument('--select', action='store_true', help='show stream to select and download, default is to download all')
Expand Down
1 change: 1 addition & 0 deletions XstreamDL_CLI/cmdargs.py
Expand Up @@ -22,6 +22,7 @@ def __init__(self):
self.audio_only = None # type: bool
self.all_videos = None # type: bool
self.all_audios = None # type: bool
self.all_subtitles = None # type: bool
self.service = None # type: str
self.save_dir = None # type: Path
self.ffmpeg = None # type: str
Expand Down
2 changes: 2 additions & 0 deletions XstreamDL_CLI/downloader.py
Expand Up @@ -268,6 +268,8 @@ def do_select(self, streams: List[Stream], selected: list = []):
selected = [index for index, stream in enumerate(streams) if stream.stream_type == 'video']
elif self.args.all_audios:
selected = [index for index, stream in enumerate(streams) if stream.stream_type == 'audio']
elif self.args.all_subtitles:
selected = [index for index, stream in enumerate(streams) if stream.stream_type == 'subtitle']
elif self.args.resolution != '':
selected = auto_choose_resolution(self.args, streams)
else:
Expand Down
13 changes: 1 addition & 12 deletions XstreamDL_CLI/extractors/dash/parser.py
Expand Up @@ -216,8 +216,6 @@ def walk_representation(self, adaptationset: AdaptationSet, period: Period, sind
stream.set_stream_type(adaptationset.mimeType)
else:
stream.set_stream_type(representation.mimeType)
if representation.mimeType == 'text/vtt':
print('debug')
if representation.width is None or representation.height is None:
stream.set_resolution(adaptationset.width, adaptationset.height)
else:
Expand Down Expand Up @@ -306,7 +304,7 @@ def walk_segmenttemplate(self, representation: Representation, period: Period, s
if len(segmenttemplates) > 1:
logger.error('please report this DASH content.')
else:
logger.warning('stream has no SegmentTemplate between Representation tag.')
# logger.warning('stream has no SegmentTemplate between Representation tag.')
if stream.base_url.startswith('http'):
stream.set_init_url(stream.base_url)
return
Expand All @@ -332,11 +330,6 @@ def walk_s_v2(self, segmenttimeline: SegmentTimeline, adaptationset: AdaptationS
return [stream]

def walk_s(self, segmenttimeline: SegmentTimeline, st: SegmentTemplate, representation: Representation, period: Period, stream: DASHStream):
# # ---------对于直播流 计算单轮最大下载分段数
# max_segments_one_round = -1
# if self.is_live:
# max_segments_one_round = math.floor(self.root.minBufferTime / self.root.maxSegmentDuration)
# # ---------
init_url = st.get_url()
if init_url is not None:
if '$RepresentationID$' in init_url:
Expand Down Expand Up @@ -432,10 +425,6 @@ def walk_s(self, segmenttimeline: SegmentTimeline, st: SegmentTemplate, represen
time_offset += s.d
stream.set_segment_duration(interval)
stream.set_media_url(media_url, name_from_url=self.args.name_from_url)
# # 当设置了最大分段数 且大于上限的时候结束解析
# # 注意这里的分段 包含了init分段以及下一个未设置url的分段
# if max_segments_one_round > 0 and len(stream.segments) > max_segments_one_round + 1:
# break

def generate_v1(self, period: Period, rid: str, st: SegmentTemplate, stream: DASHStream):
init_url = st.get_url()
Expand Down
2 changes: 1 addition & 1 deletion XstreamDL_CLI/version.py
@@ -1,2 +1,2 @@
script_name = 'XstreamDL-CLI'
__version__ = '1.4.2'
__version__ = '1.4.3'

0 comments on commit b3bcd5c

Please sign in to comment.