Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ignoring \'twitch not live\' error of yt-dlp #541

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion tartube/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24359,13 +24359,24 @@ def setup_operations_ignore_tab(self, inner_notebook):
checkbutton10 = self.add_checkbutton(grid,
_(
'Ignore \'Unable to download video thumbnail: HTTP Error 404:' \
+ ' Not Fuund\' warnings',
+ ' Not Found\' warnings',
),
self.app_obj.ignore_thumb_404_flag,
True, # Can be toggled by user
0, 10, grid_width, 1,
)
checkbutton10.connect('toggled', self.on_thumb_404_button_toggled)

checkbutton11 = self.add_checkbutton(grid,
_(
'Ignore \'ERROR: [twitch:stream] [N]: The channel is not'
+ ' currently live\' warnings',
),
self.app_obj.ignore_twitch_not_live_flag,
True, # Can be toggled by user
0, 11, grid_width, 1,
)
checkbutton11.connect('toggled', self.on_twitch_not_live_button_toggled)


def setup_operations_custom_dl_tab(self, inner_notebook):
Expand Down Expand Up @@ -34758,6 +34769,27 @@ def on_timeout_with_comments_spinbutton_changed(self, spinbutton):
)


def on_twitch_not_live_button_toggled(self, checkbutton):

"""Called from callback in self.setup_operations_ignore_tab().

Enables/disables ignoring of the 'ERROR: twitch stream not live'
warning messages.

Args:

checkbutton (Gtk.CheckButton): The widget clicked

"""

if checkbutton.get_active() \
and not self.app_obj.ignore_twitch_not_live_flag:
self.app_obj.set_ignore_twitch_not_live_flag(True)
elif not checkbutton.get_active() \
and self.app_obj.ignore_twitch_not_live_flag:
self.app_obj.set_ignore_twitch_not_live_flag(False)


def on_update_combo_changed(self, combo):

"""Called from a callback in self.setup_downloader_paths_tab().
Expand Down
6 changes: 6 additions & 0 deletions tartube/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -5620,6 +5620,12 @@ def is_ignorable(self, stderr):
r'Unable to download video thumbnail.*HTTP Error 404',
stderr,
)
) or (
app_obj.ignore_twitch_not_live_flag \
and re.search(
r'ERROR. .twitch.stream.* The channel is not currently live',
stderr,
)
) or (
app_obj.ignore_yt_age_restrict_flag \
and (
Expand Down
15 changes: 15 additions & 0 deletions tartube/mainapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,10 @@ def __init__(self, *args, **kwargs):
# Error 404: Not Found' warnings should be ignored (in the Errors/
# Warnings tab)
self.ignore_thumb_404_flag = True
# Flag set to True if 'ERROR: [twitch:stream] [N]: The channel is not
# currently live' warnings should be ignored (in the Errors/
# Warnings tab)
self.ignore_twitch_not_live_flag = True

# Flag set to True if YouTube copyright messages should be ignored (in
# the Errors/Warnings tab)
Expand Down Expand Up @@ -5170,6 +5174,8 @@ def load_config(self):
self.ignore_no_descrip_flag = json_dict['ignore_no_descrip_flag']
if version >= 2003403 and 'ignore_thumb_404_flag' in json_dict:
self.ignore_thumb_404_flag = json_dict['ignore_thumb_404_flag']
if version >= 2004370 and 'ignore_twitch_not_live_flag' in json_dict:
self.ignore_twitch_not_live_flag = json_dict['ignore_twitch_not_live_flag']

if version >= 5004 and 'ignore_yt_copyright_flag' in json_dict:
self.ignore_yt_copyright_flag \
Expand Down Expand Up @@ -6084,6 +6090,7 @@ def save_config(self):
'ignore_page_given_flag': self.ignore_page_given_flag,
'ignore_no_descrip_flag': self.ignore_no_descrip_flag,
'ignore_thumb_404_flag': self.ignore_thumb_404_flag,
'ignore_twitch_not_live_flag': self.ignore_twitch_not_live_flag,

'ignore_yt_copyright_flag': self.ignore_yt_copyright_flag,
'ignore_yt_age_restrict_flag': self.ignore_yt_age_restrict_flag,
Expand Down Expand Up @@ -26899,6 +26906,14 @@ def set_ignore_thumb_404_flag(self, flag):
self.ignore_thumb_404_flag = True


def set_ignore_twitch_not_live_flag(self, flag):

if not flag:
self.ignore_twitch_not_live_flag = False
else:
self.ignore_twitch_not_live_flag = True


def set_ignore_yt_age_restrict_flag(self, flag):

if not flag:
Expand Down