diff --git a/README.rst b/README.rst index 34dc744..d9f50c4 100644 --- a/README.rst +++ b/README.rst @@ -46,7 +46,7 @@ Problems can be reported at `our GitHub page `__): diff --git a/VERSION b/VERSION index 437459c..fe795a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5.0 +2.5.003 diff --git a/nsis/tartube_install_64bit.nsi b/nsis/tartube_install_64bit.nsi index ff5b609..d857c2a 100644 --- a/nsis/tartube_install_64bit.nsi +++ b/nsis/tartube_install_64bit.nsi @@ -1,4 +1,4 @@ -# Tartube v2.5.0 installer script for MS Windows +# Tartube v2.5.003 installer script for MS Windows # # Copyright (C) 2019-2024 A S Lewis # @@ -294,7 +294,7 @@ ;Name and file Name "Tartube" - OutFile "install-tartube-2.5.0-64bit.exe" + OutFile "install-tartube-2.5.003-64bit.exe" ;Default installation folder InstallDir "$LOCALAPPDATA\Tartube" @@ -397,7 +397,7 @@ Section "Tartube" SecClient # "Publisher" "A S Lewis" # WriteRegStr HKLM \ # "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tartube" \ -# "DisplayVersion" "2.5.0" +# "DisplayVersion" "2.5.003" # Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" diff --git a/pack/bin/no_download/tartube b/pack/bin/no_download/tartube index 373c19f..89c0dec 100644 --- a/pack/bin/no_download/tartube +++ b/pack/bin/no_download/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.5.0' -__date__ = '3 Jan 2024' +__version__ = '2.5.003' +__date__ = '8 Jan 2024' __copyright__ = 'Copyright \xa9 2019-2024 A S Lewis' __license__ = """ Copyright \xa9 2019-2024 A S Lewis. diff --git a/pack/bin/pkg/tartube b/pack/bin/pkg/tartube index dfd1885..c06c995 100644 --- a/pack/bin/pkg/tartube +++ b/pack/bin/pkg/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.5.0' -__date__ = '3 Jan 2024' +__version__ = '2.5.003' +__date__ = '8 Jan 2024' __copyright__ = 'Copyright \xa9 2019-2024 A S Lewis' __license__ = """ Copyright \xa9 2019-2024 A S Lewis. diff --git a/pack/bin/strict/tartube b/pack/bin/strict/tartube index 39fa511..a61b1e3 100644 --- a/pack/bin/strict/tartube +++ b/pack/bin/strict/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.5.0' -__date__ = '3 Jan 2024' +__version__ = '2.5.003' +__date__ = '8 Jan 2024' __copyright__ = 'Copyright \xa9 2019-2024 A S Lewis' __license__ = """ Copyright \xa9 2019-2024 A S Lewis. diff --git a/pack/tartube.1 b/pack/tartube.1 index af9ff1e..8e682f0 100644 --- a/pack/tartube.1 +++ b/pack/tartube.1 @@ -1,4 +1,4 @@ -.TH man 1 "3 Jan 2024" "2.5.0" "tartube man page" +.TH man 1 "8 Jan 2024" "2.5.003" "tartube man page" .SH NAME tartube \- GUI front-end for youtube-dl and yt-dlp .SH SYNOPSIS diff --git a/setup.py b/setup.py index 5a785d9..b94a2f9 100644 --- a/setup.py +++ b/setup.py @@ -164,7 +164,7 @@ # Setup setuptools.setup( name = 'tartube', - version = '2.5.0', + version = '2.5.003', description = 'GUI front-end for youtube-dl and yt-dlp', long_description = long_description, long_description_content_type = 'text/plain', diff --git a/tartube/mainapp.py b/tartube/mainapp.py index 2676dde..0b2215b 100644 --- a/tartube/mainapp.py +++ b/tartube/mainapp.py @@ -37,6 +37,7 @@ import platform import re import shutil +import string import sys import threading import time @@ -8267,6 +8268,22 @@ def update_db(self, version): for options_obj in self.ffmpeg_reg_dict.values(): options_obj.options_dict['extra_override_flag'] = False + if version < 2005002: # v2.5.002 + + # This version updates each media.Video's .natname, to remove + # punctuation and leading/trailing zeroes + for media_data_obj in self.media_reg_dict.values(): + if isinstance(media_data_obj, media.Video): + + natname = media_data_obj.natname + natname = natname.translate( + str.maketrans('', '', string.punctuation) + ) + natname = natname.strip() + natname = re.sub(r'^[\s]+', ' ', natname) + + media_data_obj.natname = natname + # --- Do this last, or the call to .check_integrity_db() fails ------- # -------------------------------------------------------------------- diff --git a/tartube/media.py b/tartube/media.py index e5c6b65..e76d0d3 100644 --- a/tartube/media.py +++ b/tartube/media.py @@ -29,6 +29,7 @@ import functools import os import re +import string import time @@ -55,8 +56,9 @@ class GenericMedia(object): def get_natural_name(self, name): """Converts the specified name so it is suitable for so-called - 'natural' sorting, adding leading zeroes and reducing to all-lower - case. + 'natural' sorting, removing leading/trailing whitespace, remove + punctuation, adding leading zeroes to numbers, and reducing to + all-lower case. Based on the algorithm by Stephen Quan: https://stackoverflow.com/questions/4836710/ @@ -67,6 +69,10 @@ def get_natural_name(self, name): """ + name = name.translate(str.maketrans('', '', string.punctuation)) + name = name.strip() + name = re.sub(r'^[\s]+', ' ', name) + return re.sub( r'\d+', lambda m: m.group(0).rjust(10, '0'), name @@ -1892,7 +1898,8 @@ def __init__(self, app_obj, dbid, name, parent_obj=None, options_obj=None, # If the video's JSON data has not been fetched, self.name and # self.nickname are the same self.nickname = name - # Modified version of self.nickname, padded with leading zeroes and + # Modified version of self.nickname, with leading/trailing whitespace + # removed, punctuation removed, padded with leading zeroes and # reduced to lower case; used in so-called 'natural' sorting of names self.natname = name # Download source (a URL) @@ -3457,7 +3464,8 @@ def __init__(self, app_obj, dbid, name, parent_obj=None, options_obj=None): # Channel nickname (displayed in the Video Index; the same as .name, # unless the user changes it) self.nickname = name - # Modified version of self.nickname, padded with leading zeroes and + # Modified version of self.nickname, with leading/trailing whitespace + # removed, punctuation removed, padded with leading zeroes and # reduced to lower case; used in so-called 'natural' sorting of names self.natname = name # Download source (a URL) @@ -3802,7 +3810,8 @@ def __init__(self, app_obj, dbid, name, parent_obj=None, options_obj=None): # Playlist nickname (displayed in the Video Index; the same as .name, # unless the user changes it) self.nickname = name - # Modified version of self.nickname, padded with leading zeroes and + # Modified version of self.nickname, with leading/trailing whitespace + # removed, punctuation removed, padded with leading zeroes and # reduced to lower case; used in so-called 'natural' sorting of names self.natname = name # Download source (a URL) @@ -4167,7 +4176,8 @@ def __init__(self, app_obj, dbid, name, parent_obj=None, options_obj=None, # unless the user changes it). Note that the nickname of a fixed # folder can't be changed self.nickname = name - # Modified version of self.nickname, padded with leading zeroes and + # Modified version of self.nickname, with leading/trailing whitespace + # removed, punctuation removed, padded with leading zeroes and # reduced to lower case; used in so-called 'natural' sorting of names self.natname = name diff --git a/tartube/tartube b/tartube/tartube index 3bdd4df..0121f07 100644 --- a/tartube/tartube +++ b/tartube/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.5.0' -__date__ = '3 Jan 2024' +__version__ = '2.5.003' +__date__ = '8 Jan 2024' __copyright__ = 'Copyright \xa9 2019-2024 A S Lewis' __license__ = """ Copyright \xa9 2019-2024 A S Lewis. diff --git a/tartube/utils.py b/tartube/utils.py index 801314c..4a068b8 100644 --- a/tartube/utils.py +++ b/tartube/utils.py @@ -34,6 +34,7 @@ import re import requests import shutil +import string import subprocess import sys import time @@ -2008,9 +2009,11 @@ def extract_timestamps_from_descrip(app_obj, descrip): # Remove punctuation in the title, such as the hyphen in a line # like 'Intro - 15.52', and strip leading/trailing whitespace if title != '': - # !!! DEBUG This is not yet tested on other alphabets - title = re.sub(r'\s\W+\s', ' ', title) - title = strip_whitespace(title) + title = title.translate( + str.maketrans('', '', string.punctuation), + ) + title = title.strip() + title = re.sub(r'^[\s]+', ' ', title) # Use None as the title, rather than an empty string if title == '':