Skip to content

Commit

Permalink
Add support to CLI Backend (youtube-dl/yt-dlp)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksis committed May 17, 2021
1 parent ba5a010 commit dacde38
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 191 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## [Unreleased]

### Added
- Add initial support to Dark Theme.
- Add support to CLI Backend (youtube-dl/yt-dlp)
- Add initial support to Dark Theme.
- ChangeLog
- Man page
- Add locale (.mo) es_CU
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ A cross platform front-end GUI of the popular [youtube-dl](https://github.com/yt
* [GNU gettext](https://www.gnu.org/software/gettext/)

## Downloads
* [SHA2-256SUMS](https://github.com/oleksis/youtube-dl-gui/releases/download/v1.4.0/SHA2-256SUMS)
* [yt-dlg](https://github.com/oleksis/youtube-dl-gui/releases/download/v1.4.0/yt-dlg)
* [yt-dlg.exe](https://github.com/oleksis/youtube-dl-gui/releases/download/v1.4.0/yt-dlg.exe)
* [Source (.zip)](https://github.com/oleksis/youtube-dl-gui/archive/v1.4.0.zip)
* [Source (.tar.gz)](https://github.com/oleksis/youtube-dl-gui/archive/v1.4.0.tar.gz)
* [SHA2-256SUMS](https://github.com/oleksis/youtube-dl-gui/releases/download/v1.5.0/SHA2-256SUMS)
* [yt-dlg](https://github.com/oleksis/youtube-dl-gui/releases/download/v1.5.0/yt-dlg)
* [yt-dlg.exe](https://github.com/oleksis/youtube-dl-gui/releases/download/v1.5.0/yt-dlg.exe)
* [Source (.zip)](https://github.com/oleksis/youtube-dl-gui/archive/v1.5.0.zip)
* [Source (.tar.gz)](https://github.com/oleksis/youtube-dl-gui/archive/v1.5.0.tar.gz)

## Installation

### Install From Source
* Download & extract the source
* Change directory into *yt-dlg-1.4.0*
* Change directory into *yt-dlg-1.5.0*
* Create virtual environment
```bash
make clean-requirements
Expand Down
2 changes: 1 addition & 1 deletion youtube_dl_gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def main():

if opt_manager.options.get("disable_update", False) and not youtubedl_path.exists():
wx.MessageBox(
_("Failed to locate youtube-dl and updates are disabled"),
_("Failed to locate CLI Backend and updates are disabled"),
_("Error"),
wx.OK | wx.ICON_ERROR,
)
Expand Down
10 changes: 5 additions & 5 deletions youtube_dl_gui/downloadmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .updatemanager import UpdateThread
from .downloaders import YoutubeDLDownloader

from .utils import YOUTUBEDL_BIN, format_bytes, to_string, to_bytes
from .utils import YOUTUBEDL_BIN, YTDLP_BIN, format_bytes, to_string, to_bytes


MANAGER_PUB_TOPIC = "dlmanager"
Expand Down Expand Up @@ -402,6 +402,7 @@ def time_it_took(self):
def run(self):
if not self.opt_manager.options["disable_update"]:
self._check_youtubedl()

self._time_it_took = time.time()

while self._running:
Expand Down Expand Up @@ -515,9 +516,7 @@ def _check_youtubedl(self):
"""Check if youtube-dl binary exists. If not try to download it. """
ytdl_path = self._youtubedl_path()
if not Path(ytdl_path).exists() and self.parent.update_thread is None:
self.parent.update_thread = UpdateThread(
self.opt_manager.options["youtubedl_path"], True
)
self.parent.update_thread = UpdateThread(self.opt_manager, True)
self.parent.update_thread.join()
self.parent.update_thread = None

Expand All @@ -534,7 +533,8 @@ def _jobs_done(self):

def _youtubedl_path(self) -> str:
"""Returns the path to youtube-dl binary. """
path = Path(self.opt_manager.options["youtubedl_path"]).joinpath(YOUTUBEDL_BIN)
cli_backend = self.opt_manager.options.get("cli_backend", YOUTUBEDL_BIN)
path = Path(self.opt_manager.options["youtubedl_path"]).joinpath(cli_backend)
return str(path)


Expand Down
Loading

0 comments on commit dacde38

Please sign in to comment.