checkpoint

This commit is contained in:
voussoir 2017-01-06 18:08:22 -08:00
parent a305350f5f
commit 76523db2b6
3 changed files with 41 additions and 45 deletions

View file

@ -7,8 +7,6 @@ import decorators
import exceptions import exceptions
import helpers import helpers
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import bytestring from voussoirkit import bytestring
from voussoirkit import pathclass from voussoirkit import pathclass
from voussoirkit import spinal from voussoirkit import spinal

View file

@ -16,8 +16,6 @@ import helpers
import objects import objects
import searchhelpers import searchhelpers
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import pathclass from voussoirkit import pathclass
from voussoirkit import safeprint from voussoirkit import safeprint
from voussoirkit import spinal from voussoirkit import spinal
@ -696,7 +694,7 @@ class PDBPhotoMixin:
'tag_expression': tag_expression, 'tag_expression': tag_expression,
'limit': limit, 'limit': limit,
'offset': offset, 'offset': offset,
'orderby': orderby, 'orderby': [term.replace('RANDOM()', 'random') for term in orderby],
} }
yield parameters yield parameters
@ -1179,46 +1177,46 @@ class PhotoDB(PDBAlbumMixin, PDBPhotoMixin, PDBTagMixin, PDBUserMixin):
self.commit() self.commit()
return album return album
def digest_new_files( # def digest_new_files(
self, # self,
directory, # directory,
exclude_directories=None, # exclude_directories=None,
exclude_filenames=None, # exclude_filenames=None,
recurse=False, # recurse=False,
commit=True # commit=True
): # ):
''' # '''
Walk the directory and add new files as Photos. # Walk the directory and add new files as Photos.
Does NOT create or modify any albums like `digest_directory` does. # Does NOT create or modify any albums like `digest_directory` does.
''' # '''
if not os.path.isdir(directory): # if not os.path.isdir(directory):
raise ValueError('Not a directory: %s' % directory) # raise ValueError('Not a directory: %s' % directory)
if exclude_directories is None: # if exclude_directories is None:
exclude_directories = self.config['digest_exclude_dirs'] # exclude_directories = self.config['digest_exclude_dirs']
if exclude_filenames is None: # if exclude_filenames is None:
exclude_filenames = self.config['digest_exclude_files'] # exclude_filenames = self.config['digest_exclude_files']
directory = spinal.str_to_fp(directory) # directory = spinal.str_to_fp(directory)
generator = spinal.walk_generator( # generator = spinal.walk_generator(
directory, # directory,
exclude_directories=exclude_directories, # exclude_directories=exclude_directories,
exclude_filenames=exclude_filenames, # exclude_filenames=exclude_filenames,
recurse=recurse, # recurse=recurse,
yield_style='flat', # yield_style='flat',
) # )
for filepath in generator: # for filepath in generator:
filepath = filepath.absolute_path # filepath = filepath.absolute_path
try: # try:
self.get_photo_by_path(filepath) # self.get_photo_by_path(filepath)
except exceptions.NoSuchPhoto: # except exceptions.NoSuchPhoto:
# This is what we want. # # This is what we want.
pass # pass
else: # else:
continue # continue
photo = self.new_photo(filepath, commit=False) # photo = self.new_photo(filepath, commit=False)
if commit: # if commit:
self.log.debug('Committing - digest_new_files') # self.log.debug('Committing - digest_new_files')
self.commit() # self.commit()
def easybake(self, ebstring): def easybake(self, ebstring):

View file

@ -2,6 +2,6 @@ bcrypt
flask flask
gevent gevent
pillow pillow
voussoirkit
zipstream zipstream
https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
git+https://github.com/senko/python-video-converter.git git+https://github.com/senko/python-video-converter.git