Rename thumbnail directory to just "thumbnails".

This commit is contained in:
voussoir 2021-09-30 16:55:13 -07:00
parent a3f7c796c4
commit 1dfbdfa70c
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 19 additions and 2 deletions

View file

@ -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,

View file

@ -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