A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 78 lines 2.9 kB view raw
1--[[ 2/*************************************************************************** 3 * __________ __ ___. 4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 8 * \/ \/ \/ \/ \/ 9 * $Id$ 10 * 11 * Copyright (C) 2021 William Wilgus 12 * 13 * This program is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU General Public License 15 * as published by the Free Software Foundation; either version 2 16 * of the License, or (at your option) any later version. 17 * 18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 * KIND, either express or implied. 20 * 21 ****************************************************************************/ 22]] 23--menu core settings loaded from rockbox user settings 24--Bilgus 4/2021 25 26local function get_core_settings() 27 local tmploader = require("temploader") 28 -- rbsettings is a large module to have sitting in RAM 29 -- if user already has it in RAM then use that 30 local rbs_is_loaded = (package.loaded.rbsettings ~= nil) 31 local s_is_loaded = (package.loaded.settings ~= nil) 32 local rbold = rb 33 34 if not rbs_is_loaded then 35 --replace the rb table so we can keep the defines out of the namespace 36 rb = { global_settings = rb.global_settings, 37 global_status = rb.global_status} 38 end 39 40 tmploader("rbsettings") 41 tmploader("settings") 42 -- these are exact matches color and talk are wildcard matches 43 local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|" 44 local function filterfn(struct, k) 45 k = k or "" 46 --rbold.splash(100, struct .. " " .. k) 47 return (k:find("color") or k:find("talk") or list_settings:find(k)) 48 end 49 local rb_settings = rb.settings.dump('global_settings', "system", nil, nil, filterfn) 50 51 local color_table = {} 52 local talk_table = {} 53 local list_settings_table = {} 54 55 for key, value in pairs(rb_settings) do 56 key = key or "" 57 if (key:find("color")) then 58 color_table[key]=value 59 elseif (key:find("talk")) then 60 talk_table[key]=value 61 else --if (list_settings:find(key)) then 62 list_settings_table[key]=value 63 end 64 end 65 66 if not s_is_loaded then 67 rb.settings = nil 68 end 69 70 rb = rbold 71 rb.core_color_table = color_table 72 rb.core_talk_table = talk_table 73 rb.core_list_settings_table = list_settings_table 74end 75get_core_settings() 76get_core_settings = nil 77package.loaded.menucoresettings = nil 78collectgarbage("collect")