Fix miscellaneous refresh op errors

This commit is contained in:
A S Lewis 2020-08-13 15:39:25 +01:00
parent b413dbf5dc
commit 6c5df1099e
13 changed files with 69 additions and 35 deletions

2
.gitignore vendored
View File

@ -9,5 +9,3 @@
# Python egg metadata, regenerated from source files by setuptools.
/*.egg-info
.idea/

View File

@ -1,4 +1,4 @@
# Tartube v2.1.074 installer script for MS Windows
# Tartube v2.1.080 installer script for MS Windows
#
# Copyright (C) 2019-2020 A S Lewis
#
@ -244,7 +244,7 @@
;Name and file
Name "Tartube"
OutFile "install-tartube-2.1.074-32bit.exe"
OutFile "install-tartube-2.1.080-32bit.exe"
;Default installation folder
InstallDir "$LOCALAPPDATA\Tartube"
@ -347,7 +347,7 @@ Section "Tartube" SecClient
# "Publisher" "A S Lewis"
# WriteRegStr HKLM \
# "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tartube" \
# "DisplayVersion" "2.1.074"
# "DisplayVersion" "2.1.080"
# Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

View File

@ -1,4 +1,4 @@
# Tartube v2.1.074 installer script for MS Windows
# Tartube v2.1.080 installer script for MS Windows
#
# Copyright (C) 2019-2020 A S Lewis
#
@ -244,7 +244,7 @@
;Name and file
Name "Tartube"
OutFile "install-tartube-2.1.074-64bit.exe"
OutFile "install-tartube-2.1.080-64bit.exe"
;Default installation folder
InstallDir "$LOCALAPPDATA\Tartube"
@ -347,7 +347,7 @@ Section "Tartube" SecClient
# "Publisher" "A S Lewis"
# WriteRegStr HKLM \
# "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tartube" \
# "DisplayVersion" "2.1.074"
# "DisplayVersion" "2.1.080"
# Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

View File

@ -42,8 +42,8 @@ import mainapp
# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.1.074'
__date__ = '10 Aug 2020'
__version__ = '2.1.080'
__date__ = '13 Aug 2020'
__copyright__ = 'Copyright \xa9 2019-2020 A S Lewis'
__license__ = """
Copyright \xa9 2019-2020 A S Lewis.

View File

@ -42,8 +42,8 @@ import mainapp
# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.1.074'
__date__ = '10 Aug 2020'
__version__ = '2.1.080'
__date__ = '13 Aug 2020'
__copyright__ = 'Copyright \xa9 2019-2020 A S Lewis'
__license__ = """
Copyright \xa9 2019-2020 A S Lewis.

View File

@ -1,4 +1,4 @@
.TH man 1 "10 Aug 2020" "2.1.074" "tartube man page"
.TH man 1 "13 Aug 2020" "2.1.080" "tartube man page"
.SH NAME
tartube \- GUI front-end for youtube-dl
.SH SYNOPSIS

View File

@ -1,6 +1,6 @@
[Desktop Entry]
Name=Tartube
Version=2.1.074
Version=2.1.080
Exec=tartube
Icon=tartube
Type=Application

View File

@ -145,7 +145,7 @@ for path in glob.glob('sounds/*'):
# Setup
setuptools.setup(
name='tartube',
version='2.1.074',
version='2.1.080',
description='GUI front-end for youtube-dl',
long_description=long_description,
long_description_content_type='text/plain',

View File

@ -8484,7 +8484,7 @@ class SystemPrefWin(GenericPrefWin):
0, 1, 1, 1,
)
# Signal connect appears below
if platform.system() != 'Windows' and platform.system != 'Darwin':
text = 'Show a desktop notification at the end of a download' \
+ '/update/refresh/info/tidy operation'

View File

@ -2278,7 +2278,10 @@ class TartubeApp(Gtk.Application):
):
config_dir = self.config_file_dir
if config_dir is not None and not self.make_directory(config_dir):
# The True argument prevents the function showing a dialogue window
# of its own
if config_dir is not None \
and not self.make_directory(config_dir, True):
# Can't use an ordinary message dialogue without a parent
# window, and most users won't see a message in the terminal,
@ -6348,7 +6351,7 @@ class TartubeApp(Gtk.Application):
print('FILE ERROR: ' + msg)
def make_directory(self, dir_path):
def make_directory(self, dir_path, no_win_flag=False):
"""Can be called by anything.
@ -6363,6 +6366,9 @@ class TartubeApp(Gtk.Application):
dir_path (str): The path to the directory to be created with a
call to os.makedirs()
no_win_flag (bool): If True, do not show a dialogue window on
failure
Returns:
True if the directory was created, False if not
@ -6380,12 +6386,21 @@ class TartubeApp(Gtk.Application):
# The True argument tells the dialogue window that it's an
# unwriteable directory
dialogue_win = mainwin.MountDriveDialogue(self.main_win_obj, True)
dialogue_win.run()
available_flag = dialogue_win.available_flag
dialogue_win.destroy()
if not no_win_flag:
return available_flag
dialogue_win = mainwin.MountDriveDialogue(
self.main_win_obj,
True,
)
dialogue_win.run()
available_flag = dialogue_win.available_flag
dialogue_win.destroy()
return available_flag
else:
return False
def move_backup_files(self):
@ -6405,7 +6420,12 @@ class TartubeApp(Gtk.Application):
if DEBUG_FUNC_FLAG:
utils.debug_time('app 6128 move_backup_files')
for filename in os.listdir(path=self.data_dir):
try:
file_list = os.listdir(path=self.data_dir)
except:
return
for filename in file_list:
if re.search(r'^tartube_BU_.*\.db$', filename):
old_path = os.path.abspath(
@ -9093,7 +9113,9 @@ class TartubeApp(Gtk.Application):
# exist)
dir_path = channel_obj.get_default_dir(self)
if not os.path.exists(dir_path):
self.make_directory(dir_path)
# The True argument prevents the function showing a dialogue window
# for the database on failure
self.make_directory(dir_path, True)
return channel_obj
@ -9182,7 +9204,9 @@ class TartubeApp(Gtk.Application):
# exist)
dir_path = playlist_obj.get_default_dir(self)
if not os.path.exists(dir_path):
self.make_directory(dir_path)
# The True argument prevents the function showing a dialogue window
# for the database on failure
self.make_directory(dir_path, True)
# Procedure complete
return playlist_obj
@ -9274,7 +9298,9 @@ class TartubeApp(Gtk.Application):
# Obviously don't do that for private folders
dir_path = folder_obj.get_default_dir(self)
if not folder_obj.priv_flag and not os.path.exists(dir_path):
self.make_directory(dir_path)
# The True argument prevents the function showing a dialogue window
# for the database on failure
self.make_directory(dir_path, True)
# Procedure complete
return folder_obj
@ -12426,7 +12452,7 @@ class TartubeApp(Gtk.Application):
#
# display_name
# - the media data object's name, indented for display
# in mainwin.ImportDialogueWin
# in mainwin.ImportDialogue
# video_count
# - the number of videos this media data object contains
# import_flag
@ -12986,8 +13012,10 @@ class TartubeApp(Gtk.Application):
# exists in our database. Rename it if the user wants
# that, or if the two have different source URLs
if not merge_duplicates_flag \
or old_obj.source != mini_dict['source']:
or (
not isinstance(old_obj, media.Folder) \
and old_obj.source != mini_dict['source']
):
# Rename the imported channel/playlist/folder
mini_dict['name'] = self.rename_imported_container(
mini_dict['name'],

View File

@ -19681,7 +19681,7 @@ class ImportDialogue(Gtk.Dialog):
if mini_dict['video_count'] == 1:
text += ' [ ' + _('1 video') + ' ]'
elif mini_dict['video_count']:
text += ' [ '
text += ' [ ' \
+ _('{0} videos').format(str(mini_dict['video_count'])) + ' ]'
self.liststore.append( [True, pixbuf, text, mini_dict['dbid']] )

View File

@ -284,7 +284,11 @@ class RefreshManager(threading.Thread):
dir_path = media_data_obj.get_default_dir(self.app_obj)
# Get a list of video files in the sub-directory
init_list = os.listdir(dir_path)
try:
init_list = os.listdir(dir_path)
except:
# Can't read the directory
return
# From this list, filter out files without a recognised file extension
# (.mp4, .webm, etc)
@ -552,7 +556,11 @@ class RefreshManager(threading.Thread):
dir_path = media_data_obj.get_actual_dir(self.app_obj)
# Get a list of video files in that sub-directory
init_list = os.listdir(dir_path)
try:
init_list = os.listdir(dir_path)
except:
# Can't read the directory
return
# Now check each media.Video object, to see if the video file still
# exists (or not)

View File

@ -42,8 +42,8 @@ import mainapp
# 'Global' variables
__packagename__ = 'tartube'
__version__ = '2.1.074'
__date__ = '10 Aug 2020'
__version__ = '2.1.080'
__date__ = '13 Aug 2020'
__copyright__ = 'Copyright \xa9 2019-2020 A S Lewis'
__license__ = """
Copyright \xa9 2019-2020 A S Lewis.