From 6b5c811d1cbd35a492ada36afb2b8d6e59b81a42 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 12 Dec 2021 18:32:58 +0100 Subject: [PATCH] PictureFlow: reset idle timer when art cache is being built - creating the album index and art cache can take longer than what the idle poweroff timer is set to, so make sure to reset it periodically - when finished, make sure progress is stored to disk immediately, so it isn't lost on idle poweroff Change-Id: Ibe88a260e4495b1bd007f37950e8c5fbc9364975 --- apps/plugins/pictureflow/pictureflow.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index db04f6b89a..9592ac5266 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -1293,6 +1293,9 @@ static int create_album_index(void) draw_progressbar(0, pf_idx.album_ct, "Assigning Albums"); for (j = 0; j < pf_idx.album_ct; j++) { + /* Prevent idle poweroff */ + rb->reset_poweroff_timer(); + if (rb->button_get(false) > BUTTON_NONE) { if (confirm_quit()) @@ -1351,6 +1354,9 @@ retry_artist_lookup: /* mark duplicate albums for deletion */ for (i = 0; i < pf_idx.album_ct - 1; i++) /* -1 don't check last entry */ { + /* Prevent idle poweroff */ + rb->reset_poweroff_timer(); + int idxi = pf_idx.album_index[i].artist_idx; int seeki = pf_idx.album_index[i].seek; @@ -2008,6 +2014,9 @@ static bool incremental_albumart_cache(bool verbose) if (aa_cache.inspected >= pf_idx.album_ct) return false; + /* Prevent idle poweroff */ + rb->reset_poweroff_timer(); + int idx, ret; unsigned int hash_artist, hash_album; unsigned int format = FORMAT_NATIVE; @@ -2065,11 +2074,20 @@ static bool incremental_albumart_cache(bool verbose) aa_failure: if (verbose) + { + if (aa_cache.inspected >= pf_idx.album_ct) + configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, + CONFIG_VERSION); return false; + } aa_success: if (aa_cache.inspected >= pf_idx.album_ct) + { + configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, + CONFIG_VERSION); free_all_slide_prio(0); + } if(verbose)/* direct interaction with user */ return true;