From 93a34d0cff256b8fe6f3f926b97b224bd6d7356e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 30 Dec 2023 21:55:49 +0000 Subject: [PATCH] Command option for number of books on profile screens --- daemon.py | 5 +++-- epicyon.py | 10 +++++++++- tests.py | 12 ++++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index 35620bf73..ac8bd026c 100644 --- a/daemon.py +++ b/daemon.py @@ -24093,7 +24093,8 @@ def load_tokens(base_dir: str, tokens_dict: {}, tokens_lookup: {}) -> None: break -def run_daemon(public_replies_unlisted: int, +def run_daemon(no_of_books: int, + public_replies_unlisted: int, max_shares_on_profile: int, max_hashtags: int, map_format: str, @@ -24193,7 +24194,7 @@ def run_daemon(public_replies_unlisted: int, httpd.starting_daemon = True # number of book events which show on profile screens - httpd.no_of_books = 10 + httpd.no_of_books = no_of_books # list of websites which are currently down httpd.sites_unavailable = load_unavailable_sites(base_dir) diff --git a/epicyon.py b/epicyon.py index e015b73b6..93400f0e5 100644 --- a/epicyon.py +++ b/epicyon.py @@ -634,6 +634,9 @@ def _command_options() -> None: default=1, help='Minimum number of votes to remove or add' + ' a newswire item') + parser.add_argument('--no_of_books', dest='no_of_books', type=int, + default=10, + help='Number of book events shown on profile screens') parser.add_argument('--max_like_count', dest='max_like_count', type=int, default=10, help='Maximum number of likes displayed on a post') @@ -3738,6 +3741,10 @@ def _command_options() -> None: if minimumvotes: argb.minimumvotes = int(minimumvotes) + no_of_books = get_config_param(base_dir, 'noOfBooks') + if no_of_books: + argb.no_of_books = int(no_of_books) + content_license_url = '' if argb.content_license_url: content_license_url = argb.content_license_url @@ -3980,7 +3987,8 @@ def _command_options() -> None: if __name__ == "__main__": argb2, opt2 = _command_options() print('allowdeletion: ' + str(argb2.allowdeletion)) - run_daemon(argb2.public_replies_unlisted, + run_daemon(argb2.no_of_books, + argb2.public_replies_unlisted, argb2.max_shares_on_profile, argb2.max_hashtags, argb2.mapFormat, diff --git a/tests.py b/tests.py index 851322f9c..9c4e399ed 100644 --- a/tests.py +++ b/tests.py @@ -880,8 +880,9 @@ def create_server_alice(path: str, domain: str, port: int, max_hashtags = 20 max_shares_on_profile = 8 public_replies_unlisted = False + no_of_books = 10 print('Server running: Alice') - run_daemon(public_replies_unlisted, + run_daemon(no_of_books, public_replies_unlisted, max_shares_on_profile, max_hashtags, map_format, clacks, preferred_podcast_formats, check_actor_timeout, @@ -1058,8 +1059,9 @@ def create_server_bob(path: str, domain: str, port: int, max_hashtags = 20 max_shares_on_profile = 8 public_replies_unlisted = False + no_of_books = 10 print('Server running: Bob') - run_daemon(public_replies_unlisted, + run_daemon(no_of_books, public_replies_unlisted, max_shares_on_profile, max_hashtags, map_format, clacks, preferred_podcast_formats, check_actor_timeout, @@ -1147,8 +1149,9 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [], max_hashtags = 20 max_shares_on_profile = 8 public_replies_unlisted = False + no_of_books = 10 print('Server running: Eve') - run_daemon(public_replies_unlisted, + run_daemon(no_of_books, public_replies_unlisted, max_shares_on_profile, max_hashtags, map_format, clacks, preferred_podcast_formats, check_actor_timeout, @@ -1238,8 +1241,9 @@ def create_server_group(path: str, domain: str, port: int, max_hashtags = 20 max_shares_on_profile = 8 public_replies_unlisted = False + no_of_books = 10 print('Server running: Group') - run_daemon(public_replies_unlisted, + run_daemon(no_of_books, public_replies_unlisted, max_shares_on_profile, max_hashtags, map_format, clacks, preferred_podcast_formats, check_actor_timeout,