try to fix os.path.join None error

+ remove original thumbnails folder
This commit is contained in:
mungai-njoroge
2024-04-15 07:33:48 +03:00
parent a99d8c654d
commit b1de2c7321
3 changed files with 17 additions and 4 deletions
+4 -2
View File
@@ -26,7 +26,7 @@ migrations: list[list[Migration]] = [
v1_3_0.RemoveAllTracks,
v1_3_0.UpdateAppSettingsTable,
],
[v1_4_9.AddTimestampToFavoritesTable],
[v1_4_9.AddTimestampToFavoritesTable, v1_4_9.DeleteOriginalThumbnails],
]
@@ -46,6 +46,8 @@ def apply_migrations():
log.info("Applied migration: %s", m.__name__)
except:
log.error("Failed to run migration: %s", m.__name__)
print("Migrations applied successfully.")
print("Current migration version: ", len(migrations))
# bump migration version
MigrationManager.set_version(len(migrations))
+12 -1
View File
@@ -1,5 +1,8 @@
import os
import shutil
from app.db.sqlite.utils import SQLiteManager
from app.migrations.base import Migration
from app.settings import Paths
class AddTimestampToFavoritesTable(Migration):
@@ -45,5 +48,13 @@ class DeleteOriginalThumbnails(Migration):
"""
Original thumbnails are too large and are not needed.
"""
# TODO: Implement this migration
pass
@staticmethod
def migrate():
imgpath = Paths.get_thumbs_path()
og_imgpath = os.path.join(imgpath, "original")
if os.path.exists(og_imgpath):
shutil.rmtree(og_imgpath)
+1 -1
View File
@@ -29,7 +29,7 @@ class Paths:
@classmethod
def get_config_dir(cls):
return cls.XDG_CONFIG_DIR
return cls.XDG_CONFIG_DIR or os.path.realpath(".")
@classmethod
def get_config_folder(cls):