TonieToolbox 0.5.0a1__py3-none-any.whl → 0.6.0__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 +2 -1
- TonieToolbox/__main__.py +303 -141
- TonieToolbox/artwork.py +59 -10
- TonieToolbox/audio_conversion.py +106 -34
- TonieToolbox/constants.py +133 -10
- TonieToolbox/dependency_manager.py +679 -184
- TonieToolbox/filename_generator.py +57 -10
- TonieToolbox/integration.py +73 -0
- TonieToolbox/integration_macos.py +613 -0
- TonieToolbox/integration_ubuntu.py +2 -0
- TonieToolbox/integration_windows.py +445 -0
- TonieToolbox/logger.py +9 -10
- TonieToolbox/media_tags.py +24 -104
- TonieToolbox/ogg_page.py +41 -41
- TonieToolbox/opus_packet.py +15 -15
- TonieToolbox/recursive_processor.py +34 -34
- TonieToolbox/tags.py +4 -5
- TonieToolbox/teddycloud.py +164 -51
- TonieToolbox/tonie_analysis.py +26 -24
- TonieToolbox/tonie_file.py +88 -72
- TonieToolbox/tonies_json.py +830 -37
- TonieToolbox/version_handler.py +14 -20
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0.dist-info}/METADATA +257 -177
- tonietoolbox-0.6.0.dist-info/RECORD +30 -0
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0.dist-info}/WHEEL +1 -1
- tonietoolbox-0.5.0a1.dist-info/RECORD +0 -26
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0.dist-info}/entry_points.txt +0 -0
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0.dist-info}/licenses/LICENSE.md +0 -0
- {tonietoolbox-0.5.0a1.dist-info → tonietoolbox-0.6.0.dist-info}/top_level.txt +0 -0
TonieToolbox/version_handler.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#!/usr/bin/python3
|
1
2
|
"""
|
2
3
|
Version handler to check if the latest version of TonieToolbox is being used.
|
3
4
|
"""
|
@@ -17,18 +18,17 @@ CACHE_DIR = os.path.join(os.path.expanduser("~"), ".tonietoolbox")
|
|
17
18
|
CACHE_FILE = os.path.join(CACHE_DIR, "version_cache.json")
|
18
19
|
CACHE_EXPIRY = 86400 # 24 hours in seconds
|
19
20
|
|
21
|
+
logger = get_logger(__name__)
|
20
22
|
|
21
|
-
def get_pypi_version(force_refresh=False):
|
23
|
+
def get_pypi_version(force_refresh: bool = False) -> tuple[str, str | None]:
|
22
24
|
"""
|
23
25
|
Get the latest version of TonieToolbox from PyPI.
|
24
26
|
|
25
27
|
Args:
|
26
|
-
force_refresh: If True, ignore the cache and fetch directly from PyPI
|
27
|
-
|
28
|
+
force_refresh (bool): If True, ignore the cache and fetch directly from PyPI
|
28
29
|
Returns:
|
29
|
-
tuple: (latest_version, None) on success, (current_version, error_message) on failure
|
30
|
+
tuple[str, str | None]: (latest_version, None) on success, (current_version, error_message) on failure
|
30
31
|
"""
|
31
|
-
logger = get_logger("version_handler")
|
32
32
|
logger.debug("Checking for latest version (force_refresh=%s)", force_refresh)
|
33
33
|
logger.debug("Current version: %s", __version__)
|
34
34
|
|
@@ -88,18 +88,16 @@ def get_pypi_version(force_refresh=False):
|
|
88
88
|
return __version__, f"Unexpected error checking for updates: {str(e)}"
|
89
89
|
|
90
90
|
|
91
|
-
def compare_versions(v1, v2):
|
91
|
+
def compare_versions(v1: str, v2: str) -> int:
|
92
92
|
"""
|
93
93
|
Compare two version strings according to PEP 440.
|
94
94
|
|
95
95
|
Args:
|
96
|
-
v1: First version string
|
97
|
-
v2: Second version string
|
98
|
-
|
96
|
+
v1 (str): First version string
|
97
|
+
v2 (str): Second version string
|
99
98
|
Returns:
|
100
99
|
int: -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2
|
101
100
|
"""
|
102
|
-
logger = get_logger("version_handler")
|
103
101
|
logger.debug("Comparing versions: '%s' vs '%s'", v1, v2)
|
104
102
|
|
105
103
|
try:
|
@@ -133,22 +131,20 @@ 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
|
149
146
|
update_confirmed: boolean indicating if the user confirmed the update
|
150
147
|
"""
|
151
|
-
logger = get_logger("version_handler")
|
152
148
|
current_version = __version__
|
153
149
|
update_confirmed = False
|
154
150
|
|
@@ -200,14 +196,13 @@ def check_for_updates(quiet=False, force_refresh=False):
|
|
200
196
|
return is_latest, latest_version, message, update_confirmed
|
201
197
|
|
202
198
|
|
203
|
-
def install_update():
|
199
|
+
def install_update() -> bool:
|
204
200
|
"""
|
205
201
|
Try to install the update using pip, pip3, or pipx.
|
206
202
|
|
207
203
|
Returns:
|
208
204
|
bool: True if the update was successfully installed, False otherwise
|
209
205
|
"""
|
210
|
-
logger = get_logger("version_handler")
|
211
206
|
import subprocess
|
212
207
|
import sys
|
213
208
|
|
@@ -238,14 +233,13 @@ def install_update():
|
|
238
233
|
return False
|
239
234
|
|
240
235
|
|
241
|
-
def clear_version_cache():
|
236
|
+
def clear_version_cache() -> bool:
|
242
237
|
"""
|
243
238
|
Clear the version cache file to force a refresh on next check.
|
244
239
|
|
245
240
|
Returns:
|
246
241
|
bool: True if cache was cleared, False otherwise
|
247
242
|
"""
|
248
|
-
logger = get_logger("version_handler")
|
249
243
|
|
250
244
|
try:
|
251
245
|
if os.path.exists(CACHE_FILE):
|