Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Final Release Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
360modder committed Nov 6, 2021
1 parent d19850a commit 468b84e
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 43 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# VSDownload Changelog (DD/MM/YYYY)

## 1.1.21 (04/11/2021)
## 1.1.21 (06/11/2021)

Features:

- Verbose downloading output
- Added **-m/--max-quality** option
- Added `-m/--max-quality` option
- Colorful console outputs
- Optimized downloads and gui wrapper
- Raises RuntimeError on calling *vsdownload.save()*
- Raises RuntimeError on calling `vsdownload.save()`

Changes:

- *-o* option alais added to capture command *--output* option
- Now version checking is only done by *--version* flag only
- `-o` option alais added to capture command `--output` option
- Now version checking is only done by `--version` flag only

Bug Fixes:

Expand Down
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
VenvActivate := "./env/Scripts/activate.bat"
SitePackages := %LOCALAPPDATA%\Programs\Python\Python38\Lib\site-packages

.PHONY: help requirements updates docs venv package gui

Expand All @@ -13,17 +14,19 @@ help:
@echo help shows this help message

requirements:
@pip install --upgrade pip
@pip install pip --upgrade
@pip install virtualenv
@pip install -r requirements.txt
@pip install PyQt6
@pip install typer-cli

updates:
@pyuic6 vsdownload/vsdownload.ui -x -o vsdownload/vsdownload_ui.py

docs:
@pip install typer-cli --upgrade
@typer vsdownload/vsdownload.py utils docs --output docs/CLI-API.md
@pip install typer --upgrade
@pip install click --upgrade

venv:
@python -m venv env
Expand All @@ -32,17 +35,28 @@ venv:
@$(VenvActivate) && python -m pip install -r requirements.txt

package: venv
@$(VenvActivate) && pyinstaller main.py --noconfirm --name vsdownload --onefile
@$(VenvActivate) && pyinstaller main.py \
--name vsdownload --onefile --noconfirm \
--add-data "$(SitePackages)\selenium;selenium" --add-data "$(SitePackages)\Crypto;Crypto"

@powershell -C "Remove-Item vsdownload.spec"
@powershell -C "Remove-Item env -Recurse"
@powershell -C "Remove-Item __pycache__ -Recurse"
@powershell -C "Remove-Item build -Recurse"

gui: venv
@$(VenvActivate) && python -m pip install PyQt6
@$(VenvActivate) && pyinstaller main.py --noconfirm --name vsdownload

@$(VenvActivate) && pyinstaller main.py \
--name vsdownload --noconfirm \
--add-data "$(SitePackages)\selenium;selenium" --add-data "$(SitePackages)\Crypto;Crypto"

@powershell -C "Rename-Item -Path dist -NewName dist_cli"
@$(VenvActivate) && pyinstaller main_gui_wrapper.py --noconfirm --name vsdownload_gui --noconsole

@$(VenvActivate) && pyinstaller main_gui_wrapper.py \
--name vsdownload_gui --noconfirm --noconsole \
--add-data "$(SitePackages)\selenium;selenium" --add-data "$(SitePackages)\Crypto;Crypto"

@powershell -C "Copy-Item -Path dist_cli/vsdownload/* -Destination dist/vsdownload_gui -Recurse -Force"
@powershell -C "Compress-Archive -Path dist/vsdownload_gui -DestinationPath dist/vsdownload_gui.zip"
@powershell -C "Remove-Item env -Recurse"
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ command line program to download hls video streams from websites, m3u8 files and
- [x] gui support
- [x] master m3u8 playlist parsing
- [x] platform independent
- [x] realtime file size prediction (arithmetic mean) and download speed
- [x] resume support
- [x] retry on error
- [x] realtime file size prediction (arithmetic mean) and downloading speed
- [x] resume and retry support
- [ ] supports live stream download

> Create an issue to request a new feature
Expand All @@ -65,7 +64,7 @@ Or install from github repository.
pip install https://github.com/360modder/vsdownload/archive/master.zip
```

Or you can also find a windows [executable](https://github.com/360modder/vsdownload/releases/download/v1.1.02/vsdownload.exe) / [gui wrapper](https://github.com/360modder/vsdownload/releases/download/v1.1.02/vsdownload_gui.zip) from [releases](https://github.com/360modder/vsdownload/releases).
Or you can also find a windows [executable](https://github.com/360modder/vsdownload/releases/download/v1.1.21/vsdownload.exe) / [gui wrapper](https://github.com/360modder/vsdownload/releases/download/v1.1.21/vsdownload_gui.zip) from [releases](https://github.com/360modder/vsdownload/releases).

## Usage

Expand Down Expand Up @@ -102,7 +101,7 @@ $ vsdownload-gui

## Scripting And Automation

You can also integrate vsdownload save and capture command in any python program. This is useful when you have to automate or create sub website m3u8 downloaders. First you can find or parse the m3u8 uri from a website then call *vsdownload.save()* in order to download it.
You can also integrate vsdownload save and capture command in any python program. This is useful when you have to automate or create sub website m3u8 downloaders. First you can find or parse the m3u8 uri from a website then call `vsdownload.save()` function in order to download it.

- save command function

Expand All @@ -112,7 +111,7 @@ from vsdownload import vsdownload
vsdownload.save("http://videoserver.com/playlist.m3u8", output="merged.mp4")
```

- capture and save commands at once
- capture and save command functions

```python
from vsdownload import vsdownload
Expand Down
6 changes: 4 additions & 2 deletions docs/CLI-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $ vsdownload [OPTIONS] COMMAND [ARGS]...

**Options**:

* `-v, --version`: show current version of vsdownload
* `--version`: show current version of vsdownload
* `--install-completion`: Install completion for the current shell.
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
* `--help`: Show this message and exit.
Expand All @@ -36,7 +36,7 @@ $ vsdownload capture [OPTIONS] URL

**Options**:

* `--output mysite_log.json`: output website m3u8 capture logs in which path [default: log.json]
* `-o, --output mysite_log.json`: output website m3u8 capture logs in which path [default: log.json]
* `--driver chromedriver.exe`: path of chrome driver for selenium
* `--scan-ext m3u8/ts/mp4`: scan network logs until --scan-ext extension is found in any one of the request url [default: ts]
* `--baseurl / --no-baseurl`: detect baseurl (not recommended) [default: False]
Expand All @@ -60,6 +60,8 @@ $ vsdownload save [OPTIONS] INPUT

* `-o, --output merged.ts/merged.mp4/merged.mkv`: path for output of downloaded video stream file [default: merged.ts]
* `--cleanup / --no-cleanup`: delete temporary downloaded segments, add --no-cleanup flag to use resume capabilities [default: True]
* `-m, --max-quality`: auto select highest quality sub m3u8 playlist [default: False]
* `-v, --verbose`: verbose downloading outputs and logs [default: False]
* `-b, --baseurl http://videoserver.com/`: base url for all segments, usally needed for local m3u8 file
* `-t, --threads 1-32`: max thread count for parallel threads to download segments [default: 5]
* `--chunk-size INTEGER`: chunk size for downloading ts files (in kilobytes) [default: 1024]
Expand Down
Binary file modified images/gui_wrapper.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ def get_version() -> str:
version_file_data = open(version_file, "rt", encoding="utf-8").read()
version_regex = r"(?<=^__version__ = ['\"])[^'\"]+(?=['\"]$)"
try:
version = re.findall(version_regex, version_file_data, re.M)[0]
return version
return re.findall(version_regex, version_file_data, re.M)[0]
except IndexError:
raise ValueError(f"Unable to find version string in {version_file}.")

Expand Down Expand Up @@ -43,7 +42,11 @@ def get_version() -> str:
install_requires=REQUIREMENTS,
entry_points={
"console_scripts": [
'vsdownload=vsdownload.vsdownload:app',
'vsdownload-gui=vsdownload.vsdownload_gui_wrapper:console_script',
]}
"vsdownload=vsdownload.vsdownload:app",
"vsdownload-gui=vsdownload.vsdownload_gui_wrapper:console_script",
]},
project_urls={
"Bug Tracker": "https://github.com/360modder/vsdownload/issues",
"Source": "https://github.com/360modder/vsdownload",
}
)
2 changes: 1 addition & 1 deletion vsdownload/commands/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _segments_from_variant_playlists(self, m3u8_file: m3u8.M3U8, baseurl: Union[

resolution_bandwidth_sum.append(total_digit_sum)

if not self.args.maxquality:
if not self.args.max_quality:
selected_playlist = int(input("\nchoose a m3u8 playlist (1, 2, etc.): "))
else:
selected_playlist = resolution_bandwidth_sum.index(max(resolution_bandwidth_sum)) + 1
Expand Down
4 changes: 2 additions & 2 deletions vsdownload/vsdownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def call_save(
input: str = typer.Argument(..., help="url|.m3u8|log.json"),
output: str = typer.Option("merged.ts", "--output", "-o", help="path for output of downloaded video stream file", metavar="merged.ts/merged.mp4/merged.mkv"),
cleanup: bool = typer.Option(True, help="delete temporary downloaded segments, add --no-cleanup flag to use resume capabilities"),
maxquality: bool = typer.Option(False, "--max-quality", "-m", help="auto select highest quality sub m3u8 playlist"),
max_quality: bool = typer.Option(False, "--max-quality", "-m", help="auto select highest quality sub m3u8 playlist"),
verbose: bool = typer.Option(False, "--verbose", "-v", help="verbose downloading outputs and logs"),
baseurl: str = typer.Option(None, "--baseurl", "-b", help="base url for all segments, usally needed for local m3u8 file", metavar="http://videoserver.com/", show_default=False),
threads: int = typer.Option(5, "--threads", "-t", help="max thread count for parallel threads to download segments", metavar="1-32", min=1, max=32),
Expand All @@ -56,7 +56,7 @@ def capture(
command_capture(Namespace(**locals()))

def save(
input: str, output: str = "merged.ts", cleanup: bool = True, maxquality: bool = False,
input: str, output: str = "merged.ts", cleanup: bool = True, max_quality: bool = False,
verbose: bool = False, baseurl: str = None, threads: int = 5, chunk_size: int = 1024,
headers: str = None, key_iv: str = None, proxy_address: str = None, ffmpeg_path: str = "ffmpeg",
tempdir: str = "temptsfiles", retry_count: int = 10, timeout: int = 5, pre_select: int = None
Expand Down
10 changes: 5 additions & 5 deletions vsdownload/vsdownload.ui
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,16 @@
<widget class="QLineEdit" name="outputLineEdit_save"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="maxqualityCheckBox">
<widget class="QCheckBox" name="max_qualityCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="maxqualityLabel">
<widget class="QLabel" name="max_qualityLabel">
<property name="text">
<string>maxquality</string>
<string>max_quality</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -317,8 +317,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>406</width>
<height>348</height>
<width>219</width>
<height>166</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
Expand Down
6 changes: 3 additions & 3 deletions vsdownload/vsdownload_gui_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def make_ui_updates(self) -> None:
self.update_placeholders_tooltips(self.save_callargs["input"], "inputLineEdit")
self.update_placeholders_tooltips(self.save_callargs["output"], "outputLineEdit_save")
self.update_placeholders_tooltips(self.save_callargs["cleanup"], "cleanupCheckBox")
self.update_placeholders_tooltips(self.save_callargs["maxquality"], "maxqualityCheckBox")
self.update_placeholders_tooltips(self.save_callargs["max_quality"], "max_qualityCheckBox")
self.update_placeholders_tooltips(self.save_callargs["verbose"], "verboseCheckBox")
self.update_placeholders_tooltips(self.save_callargs["baseurl"], "baseurlLineEdit_save")
self.update_placeholders_tooltips(self.save_callargs["threads"], "threadsSpinBox")
Expand Down Expand Up @@ -92,7 +92,7 @@ def make_connections(self) -> None:
self.ui.inputLineEdit.cursorPositionChanged.connect(self.update_execute_command)
self.ui.outputLineEdit_save.cursorPositionChanged.connect(self.update_execute_command)
self.ui.cleanupCheckBox.stateChanged.connect(self.update_execute_command)
self.ui.maxqualityCheckBox.stateChanged.connect(self.update_execute_command)
self.ui.max_qualityCheckBox.stateChanged.connect(self.update_execute_command)
self.ui.verboseCheckBox.stateChanged.connect(self.update_execute_command)
self.ui.baseurlLineEdit_save.cursorPositionChanged.connect(self.update_execute_command)
self.ui.threadsSpinBox.valueChanged.connect(self.update_execute_command)
Expand Down Expand Up @@ -137,7 +137,7 @@ def generate_save_command_args(self) -> list:
if not self.ui.cleanupCheckBox.isChecked():
args.append("--no-cleanup")

if self.ui.maxqualityCheckBox.isChecked():
if self.ui.max_qualityCheckBox.isChecked():
args.append("-m")

if self.ui.verboseCheckBox.isChecked():
Expand Down
18 changes: 9 additions & 9 deletions vsdownload/vsdownload_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ def setupUi(self, MainWindow):
self.outputLineEdit_save = QtWidgets.QLineEdit(self.scrollAreaWidgetContents)
self.outputLineEdit_save.setObjectName("outputLineEdit_save")
self.save_page_basic_grid_layout.addWidget(self.outputLineEdit_save, 1, 1, 1, 1)
self.maxqualityCheckBox = QtWidgets.QCheckBox(self.scrollAreaWidgetContents)
self.maxqualityCheckBox.setText("")
self.maxqualityCheckBox.setObjectName("maxqualityCheckBox")
self.save_page_basic_grid_layout.addWidget(self.maxqualityCheckBox, 3, 1, 1, 1)
self.maxqualityLabel = QtWidgets.QLabel(self.scrollAreaWidgetContents)
self.maxqualityLabel.setObjectName("maxqualityLabel")
self.save_page_basic_grid_layout.addWidget(self.maxqualityLabel, 3, 0, 1, 1)
self.max_qualityCheckBox = QtWidgets.QCheckBox(self.scrollAreaWidgetContents)
self.max_qualityCheckBox.setText("")
self.max_qualityCheckBox.setObjectName("max_qualityCheckBox")
self.save_page_basic_grid_layout.addWidget(self.max_qualityCheckBox, 3, 1, 1, 1)
self.max_qualityLabel = QtWidgets.QLabel(self.scrollAreaWidgetContents)
self.max_qualityLabel.setObjectName("max_qualityLabel")
self.save_page_basic_grid_layout.addWidget(self.max_qualityLabel, 3, 0, 1, 1)
self.verticalLayout_4.addLayout(self.save_page_basic_grid_layout)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
self.verticalLayout_4.addItem(spacerItem)
Expand All @@ -172,7 +172,7 @@ def setupUi(self, MainWindow):
self.capture_page_scroll_area.setWidgetResizable(True)
self.capture_page_scroll_area.setObjectName("capture_page_scroll_area")
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 406, 348))
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 219, 166))
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_2)
self.verticalLayout_5.setObjectName("verticalLayout_5")
Expand Down Expand Up @@ -277,7 +277,7 @@ def retranslateUi(self, MainWindow):
self.baseurlLabel_save.setText(_translate("MainWindow", "baseurl"))
self.save_page_output_btn.setText(_translate("MainWindow", "save"))
self.pre_selectLabel.setText(_translate("MainWindow", "pre_select"))
self.maxqualityLabel.setText(_translate("MainWindow", "maxquality"))
self.max_qualityLabel.setText(_translate("MainWindow", "max_quality"))
self.base_tab_widget.setTabText(self.base_tab_widget.indexOf(self.save_page_base_stacked_widget), _translate("MainWindow", "save"))
self.scan_extLabel.setText(_translate("MainWindow", "scan_ext"))
self.outputLabel_capture.setText(_translate("MainWindow", "output*"))
Expand Down

0 comments on commit 468b84e

Please sign in to comment.