Skip to content

Commit

Permalink
Fix error log #557, fix markers #558, add copy button #559
Browse files Browse the repository at this point in the history
  • Loading branch information
A S Lewis committed Jun 9, 2023
1 parent 613badc commit 6c3b8d7
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ For a full list of new features and fixes, see `recent changes <CHANGES>`__.

Stable release: **v2.4.386 (8 Jun 2023)**

Development release: **v2.4.386 (8 Jun 2023)**
Development release: **v2.4.392 (9 Jun 2023)**

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

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.386
2.4.392
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.4.386 installer script for MS Windows
# Tartube v2.4.392 installer script for MS Windows
#
# Copyright (C) 2019-2023 A S Lewis
#
Expand Down Expand Up @@ -294,7 +294,7 @@

;Name and file
Name "Tartube"
OutFile "install-tartube-2.4.386-64bit.exe"
OutFile "install-tartube-2.4.392-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.4.386"
# "DisplayVersion" "2.4.392"

# 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.4.386'
__date__ = '8 Jun 2023'
__version__ = '2.4.392'
__date__ = '9 Jun 2023'
__copyright__ = 'Copyright \xa9 2019-2023 A S Lewis'
__license__ = """
Copyright \xa9 2019-2023 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.4.386'
__date__ = '8 Jun 2023'
__version__ = '2.4.392'
__date__ = '9 Jun 2023'
__copyright__ = 'Copyright \xa9 2019-2023 A S Lewis'
__license__ = """
Copyright \xa9 2019-2023 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.4.386'
__date__ = '8 Jun 2023'
__version__ = '2.4.392'
__date__ = '9 Jun 2023'
__copyright__ = 'Copyright \xa9 2019-2023 A S Lewis'
__license__ = """
Copyright \xa9 2019-2023 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 "8 Jun 2023" "2.4.386" "tartube man page"
.TH man 1 "9 Jun 2023" "2.4.392" "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 @@ -186,7 +186,7 @@
# Setup
setuptools.setup(
name = 'tartube',
version = '2.4.386',
version = '2.4.392',
description = 'GUI front-end for youtube-dl, yt-dlp and other compatible' \
+ ' video downloaders',
long_description = long_description,
Expand Down
20 changes: 16 additions & 4 deletions tartube/mainapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4199,7 +4199,7 @@ def system_error(self, error_code, msg):
currently assigned thus:

100-199: mainapp.py (in use: 101-197)
200-299: mainwin.py (in use: 201-275)
200-299: mainwin.py (in use: 201-276)
300-399: downloads.py (in use: 301-318)
400-499: config.py (in use: 401-406)
500-599: utils.py (in use: 501-503)
Expand Down Expand Up @@ -4292,8 +4292,20 @@ def write_downloader_log(self, msg):
"""

path = os.path.abspath(os.path.join(self.data_dir, self.ytdl_log_name))
with open(path, 'a') as outfile:
outfile.write(msg + '\n')
# !!! DEBUG GIT #557
# with open(path, 'a') as outfile:
# outfile.write(msg + '\n')
if os.name == 'nt':

# Expect CP1252 encoding
with open(path, 'a', errors='ignore') as outfile:
outfile.write(msg + '\n')

else:

# Encode to UTF-8
with open(path, 'a', encoding='utf-8') as outfile:
outfile.write(msg + '\n')


# (Config/database files load/save)
Expand Down Expand Up @@ -24951,7 +24963,7 @@ def on_menu_create_profile(self, action, par):
# Get a list of marked items in the Video Index
dbid_list = []
for this_dbid in self.main_win_obj.video_index_marker_dict.keys():
dbid_list.append(dbid)
dbid_list.append(this_dbid)

# Create the profile
self.add_profile(profile_name, dbid_list)
Expand Down
130 changes: 114 additions & 16 deletions tartube/mainwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def __init__(self, app_obj):
# Gtk.CheckButton
self.show_system_multi_line_checkbutton = None
# Gtk.CheckButton
self.error_list_copy_button = None # Gtk.Button
self.error_list_entry = None # Gtk Entry
self.error_list_togglebutton = None # Gtk.ToggleButton
self.error_list_container_checkbutton = None
Expand All @@ -348,8 +349,8 @@ def __init__(self, app_obj):
self.error_list_msg_checkbutton = None # Gtk.CheckButton
self.error_list_filter_toolbutton = None
# Gtk.ToolButton
self.error_list_cancel_toolbutton = None
self.error_list_button = None # Gtk.Button
self.error_list_cancel_toolbutton = None
self.error_list_clear_button = None # Gtk.Button


# IV list - other
Expand Down Expand Up @@ -4311,6 +4312,17 @@ def setup_errors_tab(self):
self.on_system_multi_line_checkbutton_changed,
)

self.error_list_copy_button = Gtk.Button()
hbox2.pack_end(self.error_list_copy_button, False, False, 0)
self.error_list_copy_button.set_label(_('Copy selected'))
self.error_list_copy_button.set_tooltip_text(
_('Copy selected errors/warnings to the clipboard')
)
self.error_list_copy_button.connect(
'clicked',
self.on_errors_list_copy,
)

# (Third row)
hbox3 = Gtk.HBox()
vbox.pack_start(hbox3, False, False, 0)
Expand Down Expand Up @@ -4383,17 +4395,22 @@ def setup_errors_tab(self):
self.error_list_cancel_toolbutton.set_tooltip_text(
_('Cancel filter'),
)
self.error_list_cancel_toolbutton.set_action_name(
'app.cancel_error_filter_toolbutton',
)

self.error_list_button = Gtk.Button()
hbox3.pack_end(self.error_list_button, False, False, 0)
self.error_list_button.set_label(' ' + _('Clear list') + ' ')
self.error_list_button.connect(
self.error_list_clear_button = Gtk.Button()
hbox3.pack_end(self.error_list_clear_button, False, False, 0)
self.error_list_clear_button.set_label(
' ' + _('Clear list') + ' ',
)
self.error_list_copy_button.set_tooltip_text(
_('Clear all visible errors/warnings')
)
self.error_list_clear_button.connect(
'clicked',
self.on_errors_list_clear,
)
self.error_list_cancel_toolbutton.set_action_name(
'app.cancel_error_filter_toolbutton',
)


# (Moodify main window widgets)
Expand Down Expand Up @@ -10571,12 +10588,22 @@ def video_index_reset_marker(self, dbid=None):

# Reset the marker on the row for the specified channel/playlist/
# folder
tree_ref = self.video_index_row_dict[dbid]
model = tree_ref.get_model()
tree_path = tree_ref.get_path()
tree_iter = model.get_iter(tree_path)

model.set(tree_iter, 4, False)
# !!! DEBUG GIT #558
try:
tree_ref = self.video_index_row_dict[dbid]
model = tree_ref.get_model()
tree_path = tree_ref.get_path()
tree_iter = model.get_iter(tree_path)

model.set(tree_iter, 4, False)

except:
return self.app_obj.system_error(
276,
'Video Index reset marker request failed because row' \
+ ' missing from registry',
)

if dbid in self.video_index_marker_dict:
del self.video_index_marker_dict[dbid]
Expand Down Expand Up @@ -20807,7 +20834,7 @@ def on_errors_list_clear(self, button):

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

In the Errors/Warnings tab, when the user clicks the 'Clear the list'
In the Errors/Warnings tab, when the user clicks the 'Clear list'
button, clear the Errors List.

Args:
Expand All @@ -20820,6 +20847,77 @@ def on_errors_list_clear(self, button):
self.errors_list_reset()


def on_errors_list_copy(self, button):

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

In the Errors/Warnings tab, when the user clicks the 'Copy to
clipboard' button, copy all selected lines to the clipboard.

Args:

button (Gtk.Button): The clicked widget

"""

# Based on code from self.on_errors_list_drag_data_get()
# For each selected line, retrieve values from the three hidden columns
text = ''

selection = self.errors_list_treeview.get_selection()
(model, path_list) = selection.get_selected_rows()
for tree_path in path_list:

tree_iter = model.get_iter(tree_path)
if tree_iter:

file_path = model[tree_iter][0]
source = model[tree_iter][1]
name = model[tree_iter][2]
msg = model[tree_iter][9]

# If the path, source and name are all empty strings, then it
# probably wasn't a media data object that generated the
# message on this line
if file_path != '' or source != '' or name != '':

if self.app_obj.drag_error_separator_flag:
text += self.drag_drop_separator + '\n'

if self.app_obj.drag_error_path_flag:
if file_path == '':
text += '(' + _('unknown path') + ')\n'
else:
text += file_path + '\n'

if self.app_obj.drag_error_source_flag:
if source == '':
text += '(' + _('unknown URL') + ')\n'
else:
text += source + '\n'

if self.app_obj.drag_error_name_flag:
if name == '':
text += self.app_obj.default_video_name + '\n'
else:
text += name + '\n'

if self.app_obj.drag_error_msg_flag:

# Strip newline characters; we want the whole message
# on a single line, on this occasion
# (name == '' should be impossible, but for
# completeness, we'll check it anyway)
if name == '':
text += '(' + _('unknown message') + ')\n'
else:
text += re.sub(r'\n+', ' ', msg) + '\n'

# Copy the string to the clipboard
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(text, -1)


def on_errors_list_drag_data_get(self, treeview, drag_context, data, info,
time):

Expand Down Expand Up @@ -31988,7 +32086,7 @@ def __init__(self, main_win_obj):
else:
pixbuf = main_win_obj.pixbuf_dict['folder_small']

liststore.append( [pixbuf, name] )
liststore.append( [pixbuf, media_data_obj.name] )

label2 = Gtk.Label()
grid.attach(label2, 0, 3, 1, 1)
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.4.386'
__date__ = '8 Jun 2023'
__version__ = '2.4.392'
__date__ = '9 Jun 2023'
__copyright__ = 'Copyright \xa9 2019-2023 A S Lewis'
__license__ = """
Copyright \xa9 2019-2023 A S Lewis.
Expand Down

0 comments on commit 6c3b8d7

Please sign in to comment.