TonieToolbox 0.5.0a1__py3-none-any.whl → 0.6.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- TonieToolbox/__init__.py +1 -1
- TonieToolbox/__main__.py +148 -127
- TonieToolbox/artwork.py +12 -7
- TonieToolbox/audio_conversion.py +104 -33
- TonieToolbox/config.py +1 -0
- TonieToolbox/constants.py +93 -9
- TonieToolbox/filename_generator.py +6 -8
- TonieToolbox/integration.py +20 -0
- TonieToolbox/integration_macos.py +428 -0
- TonieToolbox/integration_ubuntu.py +1 -0
- TonieToolbox/integration_windows.py +404 -0
- TonieToolbox/logger.py +8 -10
- TonieToolbox/media_tags.py +22 -101
- TonieToolbox/ogg_page.py +39 -39
- TonieToolbox/opus_packet.py +13 -13
- TonieToolbox/recursive_processor.py +32 -33
- TonieToolbox/tags.py +3 -4
- TonieToolbox/teddycloud.py +50 -50
- TonieToolbox/tonie_analysis.py +24 -23
- TonieToolbox/tonie_file.py +86 -71
- TonieToolbox/tonies_json.py +828 -36
- TonieToolbox/version_handler.py +12 -15
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0a1.dist-info}/METADATA +141 -98
- tonietoolbox-0.6.0a1.dist-info/RECORD +31 -0
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0a1.dist-info}/WHEEL +1 -1
- tonietoolbox-0.5.0a1.dist-info/RECORD +0 -26
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0a1.dist-info}/entry_points.txt +0 -0
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0a1.dist-info}/licenses/LICENSE.md +0 -0
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0a1.dist-info}/top_level.txt +0 -0
TonieToolbox/version_handler.py
CHANGED
@@ -18,15 +18,14 @@ CACHE_FILE = os.path.join(CACHE_DIR, "version_cache.json")
|
|
18
18
|
CACHE_EXPIRY = 86400 # 24 hours in seconds
|
19
19
|
|
20
20
|
|
21
|
-
def get_pypi_version(force_refresh=False):
|
21
|
+
def get_pypi_version(force_refresh: bool = False) -> tuple[str, str | None]:
|
22
22
|
"""
|
23
23
|
Get the latest version of TonieToolbox from PyPI.
|
24
24
|
|
25
25
|
Args:
|
26
|
-
force_refresh: If True, ignore the cache and fetch directly from PyPI
|
27
|
-
|
26
|
+
force_refresh (bool): If True, ignore the cache and fetch directly from PyPI
|
28
27
|
Returns:
|
29
|
-
tuple: (latest_version, None) on success, (current_version, error_message) on failure
|
28
|
+
tuple[str, str | None]: (latest_version, None) on success, (current_version, error_message) on failure
|
30
29
|
"""
|
31
30
|
logger = get_logger("version_handler")
|
32
31
|
logger.debug("Checking for latest version (force_refresh=%s)", force_refresh)
|
@@ -88,14 +87,13 @@ def get_pypi_version(force_refresh=False):
|
|
88
87
|
return __version__, f"Unexpected error checking for updates: {str(e)}"
|
89
88
|
|
90
89
|
|
91
|
-
def compare_versions(v1, v2):
|
90
|
+
def compare_versions(v1: str, v2: str) -> int:
|
92
91
|
"""
|
93
92
|
Compare two version strings according to PEP 440.
|
94
93
|
|
95
94
|
Args:
|
96
|
-
v1: First version string
|
97
|
-
v2: Second version string
|
98
|
-
|
95
|
+
v1 (str): First version string
|
96
|
+
v2 (str): Second version string
|
99
97
|
Returns:
|
100
98
|
int: -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2
|
101
99
|
"""
|
@@ -133,16 +131,15 @@ def compare_versions(v1, v2):
|
|
133
131
|
return 1
|
134
132
|
|
135
133
|
|
136
|
-
def check_for_updates(quiet=False, force_refresh=False):
|
134
|
+
def check_for_updates(quiet: bool = False, force_refresh: bool = False) -> tuple[bool, str, str, bool]:
|
137
135
|
"""
|
138
136
|
Check if the current version of TonieToolbox is the latest.
|
139
137
|
|
140
138
|
Args:
|
141
|
-
quiet: If True, will not log any information messages and skip user confirmation
|
142
|
-
force_refresh: If True, bypass cache and check PyPI directly
|
143
|
-
|
139
|
+
quiet (bool): If True, will not log any information messages and skip user confirmation
|
140
|
+
force_refresh (bool): If True, bypass cache and check PyPI directly
|
144
141
|
Returns:
|
145
|
-
tuple: (is_latest, latest_version, message, update_confirmed)
|
142
|
+
tuple[bool, str, str, bool]: (is_latest, latest_version, message, update_confirmed)
|
146
143
|
is_latest: boolean indicating if the current version is the latest
|
147
144
|
latest_version: string with the latest version
|
148
145
|
message: string message about the update status or error
|
@@ -200,7 +197,7 @@ def check_for_updates(quiet=False, force_refresh=False):
|
|
200
197
|
return is_latest, latest_version, message, update_confirmed
|
201
198
|
|
202
199
|
|
203
|
-
def install_update():
|
200
|
+
def install_update() -> bool:
|
204
201
|
"""
|
205
202
|
Try to install the update using pip, pip3, or pipx.
|
206
203
|
|
@@ -238,7 +235,7 @@ def install_update():
|
|
238
235
|
return False
|
239
236
|
|
240
237
|
|
241
|
-
def clear_version_cache():
|
238
|
+
def clear_version_cache() -> bool:
|
242
239
|
"""
|
243
240
|
Clear the version cache file to force a refresh on next check.
|
244
241
|
|