Skip to content

Commit

Permalink
Fix yt-dlp install issues on MSWin
Browse files Browse the repository at this point in the history
  • Loading branch information
A S Lewis committed Dec 5, 2024
1 parent b0bb4ec commit b00868a
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 84 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ Problems can be reported at `our GitHub page <https://github.com/axcore/tartube/
3 Downloads
===========

Stable release: **v2.5.059 (26 Nov 2024)**
Stable release: **v2.5.062** (5 Dec 2024 on MS Windows), **v2.5.059** (26 Nov 2024 on all other systems)

Development release: **v2.5.059 (26 Nov 2024)**
Development release: **v2.5.062 (5 Dec 2024)**

Official packages (also available from the `Github release page <https://github.com/axcore/tartube/releases>`__):

- `MS Windows (64-bit) installer <https://sourceforge.net/projects/tartube/files/v2.5.059/install-tartube-2.5.059-64bit.exe/download>`__, `MS Windows (64-bit) and FFmpeg installer <https://sourceforge.net/projects/tartube/files/v2.5.059/install-tartube-with-ffmpeg-2.5.059-64bit.exe/download>`__ and `portable edition <https://sourceforge.net/projects/tartube/files/v2.5.059/tartube-2.5.059-64bit-portable.zip/download>`__ from Sourceforge
- `MS Windows (64-bit) installer <https://sourceforge.net/projects/tartube/files/v2.5.062/install-tartube-2.5.062-64bit.exe/download>`__, `MS Windows (64-bit) and FFmpeg installer <https://sourceforge.net/projects/tartube/files/v2.5.062/install-tartube-with-ffmpeg-2.5.062-64bit.exe/download>`__ and `portable edition <https://sourceforge.net/projects/tartube/files/v2.5.062/tartube-2.5.062-64bit-portable.zip/download>`__ from Sourceforge
- Tartube is no longer supported on older versions of MS Windows - see `7.24 Doesn't work on 32-bit Windows / Windows 7 / Windows 8`_
- `DEB package (for Debian-based distros, e.g. Ubuntu, Linux Mint) <https://sourceforge.net/projects/tartube/files/v2.5.059/python3-tartube_2.5.059.deb/download>`__ from Sourceforge
- `RPM package (for RHEL-based distros, e.g. Fedora) <https://sourceforge.net/projects/tartube/files/v2.5.059/tartube-2.5.059.rpm/download>`__ from Sourceforge
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.059
2.5.062
6 changes: 3 additions & 3 deletions nsis/tartube_install_64bit.nsi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Tartube v2.5.059 installer script for MS Windows
# Tartube v2.5.062 installer script for MS Windows
#
# Copyright (C) 2019-2024 A S Lewis
#
Expand Down Expand Up @@ -294,7 +294,7 @@

;Name and file
Name "Tartube"
OutFile "install-tartube-2.5.059-64bit.exe"
OutFile "install-tartube-2.5.062-64bit.exe"

;Default installation folder
InstallDir "$LOCALAPPDATA\Tartube"
Expand Down Expand Up @@ -397,7 +397,7 @@ Section "Tartube" SecClient
# "Publisher" "A S Lewis"
# WriteRegStr HKLM \
# "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tartube" \
# "DisplayVersion" "2.5.059"
# "DisplayVersion" "2.5.062"

# Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
Expand Down
4 changes: 2 additions & 2 deletions pack/bin/no_download/tartube
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import mainapp

# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.5.059'
__date__ = '26 Nov 2024'
__version__ = '2.5.062'
__date__ = '5 Dec 2024'
__copyright__ = 'Copyright \xa9 2019-2024 A S Lewis'
__license__ = """
Copyright \xa9 2019-2024 A S Lewis.
Expand Down
4 changes: 2 additions & 2 deletions pack/bin/pkg/tartube
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import mainapp

# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.5.059'
__date__ = '26 Nov 2024'
__version__ = '2.5.062'
__date__ = '5 Dec 2024'
__copyright__ = 'Copyright \xa9 2019-2024 A S Lewis'
__license__ = """
Copyright \xa9 2019-2024 A S Lewis.
Expand Down
4 changes: 2 additions & 2 deletions pack/bin/strict/tartube
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import mainapp

# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.5.059'
__date__ = '26 Nov 2024'
__version__ = '2.5.062'
__date__ = '5 Dec 2024'
__copyright__ = 'Copyright \xa9 2019-2024 A S Lewis'
__license__ = """
Copyright \xa9 2019-2024 A S Lewis.
Expand Down
2 changes: 1 addition & 1 deletion pack/tartube.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH man 1 "26 Nov 2024" "2.5.059" "tartube man page"
.TH man 1 "5 Dec 2024" "2.5.062" "tartube man page"
.SH NAME
tartube \- GUI front-end for youtube-dl and yt-dlp
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
# Setup
setuptools.setup(
name = 'tartube',
version = '2.5.059',
version = '2.5.062',
description = 'GUI front-end for youtube-dl and yt-dlp',
long_description = long_description,
long_description_content_type = 'text/plain',
Expand Down
4 changes: 2 additions & 2 deletions tartube/tartube
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import mainapp

# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.5.059'
__date__ = '26 Nov 2024'
__version__ = '2.5.062'
__date__ = '5 Dec 2024'
__copyright__ = 'Copyright \xa9 2019-2024 A S Lewis'
__license__ = """
Copyright \xa9 2019-2024 A S Lewis.
Expand Down
119 changes: 52 additions & 67 deletions tartube/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,87 +611,82 @@ def install_ytdl(self):
# Rather than trying to distinguish the portable and non-portable
# versions, just do this for all MS Windows users with default
# settings
uninstall_fail_flag = False
if os.name == 'nt' and self.wiz_win_obj is None and (
ytdl_update_current == 'ytdl_update_win_64' \
or ytdl_update_current == 'ytdl_update_win_64_no_dependencies' \
or ytdl_update_current == 'ytdl_update_win_32' \
or ytdl_update_current == 'ytdl_update_win_32_no_dependencies'
):
if not self.uninstall_ytdl(downloader, ytdl_update_current):
uninstall_fail_flag = True
self.uninstall_ytdl(downloader, ytdl_update_current)

if not uninstall_fail_flag:

# Prepare a system command...
if os.name == 'nt' \
and ytdl_update_current == 'ytdl_update_custom_path' \
and re.search(r'\.exe$', self.app_obj.ytdl_path):
# Special case: on MS Windows, a custom path may point at an
# .exe, therefore 'python3' must be removed from the system
# command (we can't run 'python3.exe youtube-dl.exe' or
# anything like that)
cmd_list = [self.app_obj.ytdl_path, '-U']
# Prepare a system command...
if os.name == 'nt' \
and ytdl_update_current == 'ytdl_update_custom_path' \
and re.search(r'\.exe$', self.app_obj.ytdl_path):
# Special case: on MS Windows, a custom path may point at an .exe,
# therefore 'python3' must be removed from the system command (we
# can't run 'python3.exe youtube-dl.exe' or anything like that)
cmd_list = [self.app_obj.ytdl_path, '-U']

else:
cmd_list = self.app_obj.ytdl_update_dict[ytdl_update_current]
else:
cmd_list = self.app_obj.ytdl_update_dict[ytdl_update_current]

mod_list = []
for arg in cmd_list:
mod_list = []
for arg in cmd_list:

# Substitute in the fork, if one is specified
arg = self.app_obj.check_downloader(arg, self.wiz_win_obj)
# Convert a path beginning with ~ (not on MS Windows)
if os.name != 'nt':
arg = re.sub(r'^\~', os.path.expanduser('~'), arg)
# Substitute in the fork, if one is specified
arg = self.app_obj.check_downloader(arg, self.wiz_win_obj)
# Convert a path beginning with ~ (not on MS Windows)
if os.name != 'nt':
arg = re.sub(r'^\~', os.path.expanduser('~'), arg)

mod_list.append(arg)
mod_list.append(arg)

# ...and display it in the Output tab (if required)
self.install_ytdl_write_output(
' '.join(mod_list),
True, # A system command, not a message
)
# ...and display it in the Output tab (if required)
self.install_ytdl_write_output(
' '.join(mod_list),
True, # A system command, not a message
)

# Create a new child process using that command...
self.create_child_process(mod_list)
# ...and set up the PipeReader objects to read from the child
# process STDOUT and STDERR
if self.child_process is not None:
self.stdout_reader.attach_fh(self.child_process.stdout)
self.stderr_reader.attach_fh(self.child_process.stderr)
# Create a new child process using that command...
self.create_child_process(mod_list)
# ...and set up the PipeReader objects to read from the child process
# STDOUT and STDERR
if self.child_process is not None:
self.stdout_reader.attach_fh(self.child_process.stdout)
self.stderr_reader.attach_fh(self.child_process.stderr)

while self.is_child_process_alive():
while self.is_child_process_alive():

# Pause a moment between each iteration of the loop (we don't
# want to hog system resources)
time.sleep(self.sleep_time)
# Pause a moment between each iteration of the loop (we don't want
# to hog system resources)
time.sleep(self.sleep_time)

# Read from the child process STDOUT and STDERR, in the correct
# order, until there is nothing left to read
while self.read_ytdl_child_process(downloader):
pass
# Read from the child process STDOUT and STDERR, in the correct
# order, until there is nothing left to read
while self.read_ytdl_child_process(downloader):
pass

# (Generate our own error messages for debugging purposes, in
# certain situations)
if self.child_process is None:
# (Generate our own error messages for debugging purposes, in certain
# situations)
if self.child_process is None:

msg = _('Update did not start')
msg = _('Update did not start')

self.stderr_list.append(msg)
self.install_ytdl_write_output(msg)
self.stderr_list.append(msg)
self.install_ytdl_write_output(msg)

elif self.child_process.returncode > 0:
elif self.child_process.returncode > 0:

msg = _('Child process exited with non-zero code: {}').format(
self.child_process.returncode,
)
msg = _('Child process exited with non-zero code: {}').format(
self.child_process.returncode,
)

self.stderr_list.append(msg)
self.install_ytdl_write_output(msg)
self.stderr_list.append(msg)
self.install_ytdl_write_output(msg)

# Operation complete. self.success_flag is checked by
# mainapp.TartubeApp.update_manager_finished
# mainapp.TartubeApp.update_manager_finished()
if not self.stderr_list:
self.success_flag = True

Expand Down Expand Up @@ -722,10 +717,6 @@ def uninstall_ytdl(self, downloader, ytdl_update_current):
mainapp.TartubeApp.ytdl_update_current, or an overriding
value chosen by the calling function
Return values:
True on success, False on failure
"""

# Prepare a system command...
Expand Down Expand Up @@ -782,12 +773,6 @@ def uninstall_ytdl(self, downloader, ytdl_update_current):
self.stderr_list.append(msg)
self.install_ytdl_write_output(msg)

# Uninstall complete
if self.stderr_list:
return False
else:
return True


def install_ytdl_write_output(self, msg, system_cmd_flag=False):

Expand Down

0 comments on commit b00868a

Please sign in to comment.