diff --git a/etiquette/constants.py b/etiquette/constants.py index f9aae6e..10d300c 100644 --- a/etiquette/constants.py +++ b/etiquette/constants.py @@ -41,7 +41,7 @@ ffmpeg = _load_ffmpeg() # Database ######################################################################################### -DATABASE_VERSION = 19 +DATABASE_VERSION = 20 DB_VERSION_PRAGMA = f''' PRAGMA user_version = {DATABASE_VERSION}; ''' @@ -254,7 +254,7 @@ ADDITIONAL_MIMETYPES = { DEFAULT_DATADIR = '_etiquette' DEFAULT_DBNAME = 'phototagger.db' DEFAULT_CONFIGNAME = 'config.json' -DEFAULT_THUMBDIR = 'site_thumbnails' +DEFAULT_THUMBDIR = 'thumbnails' DEFAULT_CONFIGURATION = { 'cache_size': { @@ -315,6 +315,7 @@ DEFAULT_CONFIGURATION = { '_etiquette', '_site_thumbnails', 'site_thumbnails', + 'thumbnails', ], 'file_read_chunk': 2 ** 20, diff --git a/utilities/database_upgrader.py b/utilities/database_upgrader.py index 93597b8..e4a497b 100644 --- a/utilities/database_upgrader.py +++ b/utilities/database_upgrader.py @@ -654,6 +654,22 @@ def upgrade_18_to_19(photodb): m.go() +def upgrade_19_to_20(photodb): + ''' + In this version, the thumbnail folder was renamed from "site_thumbnails" + to just "thumbnails". + ''' + old = photodb.data_directory.with_child('site_thumbnails') + if not old.exists: + return + new = photodb.data_directory.with_child('thumbnails') + if new.exists: + if len(new.listdir()) > 0: + raise Exception(f'{new.absolute_path} already has items in it.') + else: + os.rmdir(new.absolute_path) + os.rename(old.absolute_path, new.absolute_path) + def upgrade_all(data_directory): ''' Given the directory containing a phototagger database, apply all of the