Skip to content

Commit

Permalink
recent file support #23 - newest at top of results
Browse files Browse the repository at this point in the history
  • Loading branch information
clach04 committed Nov 11, 2023
1 parent fa8ee1b commit 76289f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webook_opds_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
werkzeug = None

import ebook_conversion
from webook_core import BootMeta, ebook_only_mimetypes, guess_mimetype, find_recent_files, load_config
from webook_core import BootMeta, ebook_only_mimetypes, guess_mimetype, find_recent_files, load_config, ORDER_DESCENDING

is_py3 = sys.version_info >= (3,)

Expand Down Expand Up @@ -232,6 +232,7 @@ def browser_recent(environ, start_response):
start_response(status, headers)

number_of_files = 50
sort_order = ORDER_DESCENDING
search_term = 'RECENT %d' % number_of_files

log.debug('yield head')
Expand All @@ -254,7 +255,7 @@ def browser_recent(environ, start_response):
# find all recent files before returning any results
directory_path = config['ebook_dir']
directory_path_len = len(directory_path) + 1 # +1 is the directory seperator (assuming Unix or Windows paths)
recent_file_list = find_recent_files(directory_path, number_of_files=number_of_files)
recent_file_list = find_recent_files(directory_path, number_of_files=number_of_files, order=sort_order)

log.debug('pre recent for loop')
for file_name in recent_file_list:
Expand Down

0 comments on commit 76289f5

Please sign in to comment.