Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

graphql: fix global_settings query

+253 -13
+14
crates/graphql/src/schema/objects/compressor_settings.rs
··· 1 1 use async_graphql::*; 2 + use rockbox_sys as rb; 2 3 use serde::{Deserialize, Serialize}; 3 4 4 5 #[derive(Default, Clone, Serialize, Deserialize)] ··· 37 38 self.attack_time 38 39 } 39 40 } 41 + 42 + impl From<rb::types::user_settings::CompressorSettings> for CompressorSettings { 43 + fn from(settings: rb::types::user_settings::CompressorSettings) -> Self { 44 + Self { 45 + threshold: settings.threshold, 46 + makeup_gain: settings.makeup_gain, 47 + ratio: settings.ratio, 48 + knee: settings.knee, 49 + release_time: settings.release_time, 50 + attack_time: settings.attack_time, 51 + } 52 + } 53 + }
+11
crates/graphql/src/schema/objects/eq_band_setting.rs
··· 1 1 use async_graphql::*; 2 + use rockbox_sys as rb; 2 3 use serde::{Deserialize, Serialize}; 3 4 4 5 #[derive(Default, Clone, Serialize, Deserialize)] ··· 22 23 self.gain 23 24 } 24 25 } 26 + 27 + impl From<rb::types::user_settings::EqBandSetting> for EqBandSetting { 28 + fn from(setting: rb::types::user_settings::EqBandSetting) -> Self { 29 + Self { 30 + cutoff: setting.cutoff, 31 + q: setting.q, 32 + gain: setting.gain, 33 + } 34 + } 35 + }
+11
crates/graphql/src/schema/objects/replaygain_settings.rs
··· 1 1 use async_graphql::*; 2 + use rockbox_sys as rb; 2 3 use serde::{Deserialize, Serialize}; 3 4 4 5 #[derive(Default, Clone, Serialize, Deserialize)] ··· 22 23 self.preamp 23 24 } 24 25 } 26 + 27 + impl From<rb::types::user_settings::ReplaygainSettings> for ReplaygainSettings { 28 + fn from(settings: rb::types::user_settings::ReplaygainSettings) -> Self { 29 + Self { 30 + noclip: settings.noclip, 31 + r#type: settings.r#type, 32 + preamp: settings.preamp, 33 + } 34 + } 35 + }
+209 -11
crates/graphql/src/schema/objects/user_settings.rs
··· 1 1 use async_graphql::*; 2 + use rockbox_sys as rb; 2 3 use serde::{Deserialize, Serialize}; 3 4 4 5 use super::{ ··· 57 58 pub pause_rewind: i32, 58 59 pub unplug_mode: i32, 59 60 pub unplug_autoresume: bool, 60 - 61 - pub qs_items: Vec<SettingsList>, 62 61 63 62 pub timeformat: i32, 64 63 pub disk_spindown: i32, ··· 213 212 214 213 pub usb_skip_first_drive: bool, 215 214 216 - pub ui_vp_config: String, 217 215 pub player_name: String, 218 216 219 217 pub compressor_settings: CompressorSettings, ··· 405 403 self.unplug_autoresume 406 404 } 407 405 408 - async fn qs_items(&self) -> Vec<SettingsList> { 409 - self.qs_items.clone() 410 - } 411 - 412 406 async fn timeformat(&self) -> i32 { 413 407 self.timeformat 414 408 } ··· 933 927 self.usb_skip_first_drive 934 928 } 935 929 936 - async fn ui_vp_config(&self) -> &str { 937 - &self.ui_vp_config 938 - } 939 - 940 930 async fn player_name(&self) -> &str { 941 931 &self.player_name 942 932 } ··· 1061 1051 self.stereosw_mode 1062 1052 } 1063 1053 } 1054 + 1055 + impl From<rb::types::user_settings::UserSettings> for UserSettings { 1056 + fn from(settings: rb::types::user_settings::UserSettings) -> Self { 1057 + Self { 1058 + volume: settings.volume, 1059 + balance: settings.balance, 1060 + bass: settings.bass, 1061 + treble: settings.treble, 1062 + channel_config: settings.channel_config, 1063 + stereo_width: settings.stereo_width, 1064 + bass_cutoff: settings.bass_cutoff, 1065 + treble_cutoff: settings.treble_cutoff, 1066 + crossfade: settings.crossfade, 1067 + crossfade_fade_in_delay: settings.crossfade_fade_in_delay, 1068 + crossfade_fade_out_delay: settings.crossfade_fade_out_delay, 1069 + crossfade_fade_in_duration: settings.crossfade_fade_in_duration, 1070 + crossfade_fade_out_duration: settings.crossfade_fade_out_duration, 1071 + crossfade_fade_out_mixmode: settings.crossfade_fade_out_mixmode, 1072 + replaygain_settings: ReplaygainSettings::from(settings.replaygain_settings), 1073 + crossfeed: settings.crossfeed, 1074 + crossfeed_direct_gain: settings.crossfeed_direct_gain, 1075 + crossfeed_cross_gain: settings.crossfeed_cross_gain, 1076 + crossfeed_hf_attenuation: settings.crossfeed_hf_attenuation, 1077 + crossfeed_hf_cutoff: settings.crossfeed_hf_cutoff, 1078 + eq_enabled: settings.eq_enabled, 1079 + eq_precut: settings.eq_precut, 1080 + eq_band_settings: settings 1081 + .eq_band_settings 1082 + .into_iter() 1083 + .map(|band| band.into()) 1084 + .collect(), 1085 + beep: settings.beep, 1086 + keyclick: settings.keyclick, 1087 + keyclick_repeats: settings.keyclick_repeats, 1088 + dithering_enabled: settings.dithering_enabled, 1089 + timestretch_enabled: settings.timestretch_enabled, 1090 + list_accel_start_delay: settings.list_accel_start_delay, 1091 + list_accel_wait: settings.list_accel_wait, 1092 + touchpad_sensitivity: settings.touchpad_sensitivity, 1093 + touchpad_deadzone: settings.touchpad_deadzone, 1094 + pause_rewind: settings.pause_rewind, 1095 + unplug_mode: settings.unplug_mode, 1096 + unplug_autoresume: settings.unplug_autoresume, 1097 + timeformat: settings.timeformat, 1098 + disk_spindown: settings.disk_spindown, 1099 + buffer_margin: settings.buffer_margin, 1100 + dirfilter: settings.dirfilter, 1101 + show_filename_ext: settings.show_filename_ext, 1102 + default_codepage: settings.default_codepage, 1103 + hold_lr_for_scroll_in_list: settings.hold_lr_for_scroll_in_list, 1104 + play_selected: settings.play_selected, 1105 + single_mode: settings.single_mode, 1106 + party_mode: settings.party_mode, 1107 + cuesheet: settings.cuesheet, 1108 + car_adapter_mode: settings.car_adapter_mode, 1109 + car_adapter_mode_delay: settings.car_adapter_mode_delay, 1110 + start_in_screen: settings.start_in_screen, 1111 + ff_rewind_min_step: settings.ff_rewind_min_step, 1112 + ff_rewind_accel: settings.ff_rewind_accel, 1113 + peak_meter_release: settings.peak_meter_release, 1114 + peak_meter_hold: settings.peak_meter_hold, 1115 + peak_meter_clip_hold: settings.peak_meter_clip_hold, 1116 + peak_meter_dbfs: settings.peak_meter_dbfs, 1117 + peak_meter_min: settings.peak_meter_min, 1118 + peak_meter_max: settings.peak_meter_max, 1119 + wps_file: settings.wps_file, 1120 + sbs_file: settings.sbs_file, 1121 + lang_file: settings.lang_file, 1122 + playlist_catalog_dir: settings.playlist_catalog_dir, 1123 + skip_length: settings.skip_length, 1124 + max_files_in_dir: settings.max_files_in_dir, 1125 + max_files_in_playlist: settings.max_files_in_playlist, 1126 + volume_type: settings.volume_type, 1127 + battery_display: settings.battery_display, 1128 + show_icons: settings.show_icons, 1129 + statusbar: settings.statusbar, 1130 + scrollbar: settings.scrollbar, 1131 + scrollbar_width: settings.scrollbar_width, 1132 + list_line_padding: settings.list_line_padding, 1133 + list_separator_height: settings.list_separator_height, 1134 + list_separator_color: settings.list_separator_color, 1135 + browse_current: settings.browse_current, 1136 + scroll_paginated: settings.scroll_paginated, 1137 + list_wraparound: settings.list_wraparound, 1138 + list_order: settings.list_order, 1139 + scroll_speed: settings.scroll_speed, 1140 + bidir_limit: settings.bidir_limit, 1141 + scroll_delay: settings.scroll_delay, 1142 + scroll_step: settings.scroll_step, 1143 + autoloadbookmark: settings.autoloadbookmark, 1144 + autocreatebookmark: settings.autocreatebookmark, 1145 + autoupdatebookmark: settings.autoupdatebookmark, 1146 + usemrb: settings.usemrb, 1147 + dircache: settings.dircache, 1148 + tagcache_ram: settings.tagcache_ram, 1149 + tagcache_autoupdate: settings.tagcache_autoupdate, 1150 + autoresume_enable: settings.autoresume_enable, 1151 + autoresume_automatic: settings.autoresume_automatic, 1152 + autoresume_paths: settings.autoresume_paths, 1153 + runtimedb: settings.runtimedb, 1154 + tagcache_scan_paths: settings.tagcache_scan_paths, 1155 + tagcache_db_path: settings.tagcache_db_path, 1156 + backdrop_file: settings.backdrop_file, 1157 + bg_color: settings.bg_color, 1158 + fg_color: settings.fg_color, 1159 + lss_color: settings.lss_color, 1160 + lse_color: settings.lse_color, 1161 + lst_color: settings.lst_color, 1162 + colors_file: settings.colors_file, 1163 + browser_default: settings.browser_default, 1164 + repeat_mode: settings.repeat_mode, 1165 + next_folder: settings.next_folder, 1166 + constrain_next_folder: settings.constrain_next_folder, 1167 + recursive_dir_insert: settings.recursive_dir_insert, 1168 + fade_on_stop: settings.fade_on_stop, 1169 + playlist_shuffle: settings.playlist_shuffle, 1170 + warnon_erase_dynplaylist: settings.warnon_erase_dynplaylist, 1171 + keep_current_track_on_replace_playlist: settings.keep_current_track_on_replace_playlist, 1172 + show_shuffled_adding_options: settings.show_shuffled_adding_options, 1173 + show_queue_options: settings.show_queue_options, 1174 + album_art: settings.album_art, 1175 + rewind_across_tracks: settings.rewind_across_tracks, 1176 + playlist_viewer_icons: settings.playlist_viewer_icons, 1177 + playlist_viewer_indices: settings.playlist_viewer_indices, 1178 + playlist_viewer_track_display: settings.playlist_viewer_track_display, 1179 + talk_menu: settings.talk_menu, 1180 + talk_dir: settings.talk_dir, 1181 + talk_dir_clip: settings.talk_dir_clip, 1182 + talk_file: settings.talk_file, 1183 + talk_file_clip: settings.talk_file_clip, 1184 + talk_filetype: settings.talk_filetype, 1185 + talk_battery_level: settings.talk_battery_level, 1186 + talk_mixer_amp: settings.talk_mixer_amp, 1187 + sort_case: settings.sort_case, 1188 + sort_dir: settings.sort_dir, 1189 + sort_file: settings.sort_file, 1190 + interpret_numbers: settings.interpret_numbers, 1191 + poweroff: settings.poweroff, 1192 + battery_capacity: settings.battery_capacity, 1193 + battery_type: settings.battery_type, 1194 + spdif_enable: settings.spdif_enable, 1195 + usb_charging: settings.usb_charging, 1196 + contrast: settings.contrast, 1197 + invert: settings.invert, 1198 + flip_display: settings.flip_display, 1199 + cursor_style: settings.cursor_style, 1200 + screen_scroll_step: settings.screen_scroll_step, 1201 + show_path_in_browser: settings.show_path_in_browser, 1202 + offset_out_of_view: settings.offset_out_of_view, 1203 + disable_mainmenu_scrolling: settings.disable_mainmenu_scrolling, 1204 + icon_file: settings.icon_file, 1205 + viewers_icon_file: settings.viewers_icon_file, 1206 + font_file: settings.font_file, 1207 + glyphs_to_cache: settings.glyphs_to_cache, 1208 + kbd_file: settings.kbd_file, 1209 + backlight_timeout: settings.backlight_timeout, 1210 + caption_backlight: settings.caption_backlight, 1211 + bl_filter_first_keypress: settings.bl_filter_first_keypress, 1212 + backlight_timeout_plugged: settings.backlight_timeout_plugged, 1213 + bt_selective_softlock_actions: settings.bt_selective_softlock_actions, 1214 + bt_selective_softlock_actions_mask: settings.bt_selective_softlock_actions_mask, 1215 + bl_selective_actions: settings.bl_selective_actions, 1216 + bl_selective_actions_mask: settings.bl_selective_actions_mask, 1217 + backlight_on_button_hold: settings.backlight_on_button_hold, 1218 + lcd_sleep_after_backlight_off: settings.lcd_sleep_after_backlight_off, 1219 + brightness: settings.brightness, 1220 + speaker_mode: settings.speaker_mode, 1221 + prevent_skip: settings.prevent_skip, 1222 + touch_mode: settings.touch_mode, 1223 + pitch_mode_semitone: settings.pitch_mode_semitone, 1224 + pitch_mode_timestretch: settings.pitch_mode_timestretch, 1225 + usb_hid: settings.usb_hid, 1226 + usb_keypad_mode: settings.usb_keypad_mode, 1227 + usb_skip_first_drive: settings.usb_skip_first_drive, 1228 + player_name: settings.player_name, 1229 + compressor_settings: CompressorSettings::from(settings.compressor_settings), 1230 + sleeptimer_duration: settings.sleeptimer_duration, 1231 + sleeptimer_on_startup: settings.sleeptimer_on_startup, 1232 + keypress_restarts_sleeptimer: settings.keypress_restarts_sleeptimer, 1233 + show_shutdown_message: settings.show_shutdown_message, 1234 + hotkey_wps: settings.hotkey_wps, 1235 + hotkey_tree: settings.hotkey_tree, 1236 + resume_rewind: settings.resume_rewind, 1237 + depth_3d: settings.depth_3d, 1238 + roll_off: settings.roll_off, 1239 + power_mode: settings.power_mode, 1240 + keyclick_hardware: settings.keyclick_hardware, 1241 + start_directory: settings.start_directory, 1242 + root_menu_customized: settings.root_menu_customized, 1243 + shortcuts_replaces_qs: settings.shortcuts_replaces_qs, 1244 + play_frequency: settings.play_frequency, 1245 + volume_limit: settings.volume_limit, 1246 + volume_adjust_mode: settings.volume_adjust_mode, 1247 + volume_adjust_norm_steps: settings.volume_adjust_norm_steps, 1248 + surround_enabled: settings.surround_enabled, 1249 + surround_balance: settings.surround_balance, 1250 + surround_fx1: settings.surround_fx1, 1251 + surround_fx2: settings.surround_fx2, 1252 + surround_method2: settings.surround_method2, 1253 + surround_mix: settings.surround_mix, 1254 + pbe: settings.pbe, 1255 + pbe_precut: settings.pbe_precut, 1256 + afr_enabled: settings.afr_enabled, 1257 + governor: settings.governor, 1258 + stereosw_mode: settings.stereosw_mode, 1259 + } 1260 + } 1261 + }
+8 -2
crates/graphql/src/schema/settings.rs
··· 1 1 use async_graphql::*; 2 2 3 3 use crate::{rockbox_url, schema::objects::user_settings::UserSettings}; 4 + use rockbox_sys as rb; 4 5 5 6 #[derive(Default)] 6 7 pub struct SettingsQuery; ··· 10 11 async fn global_settings(&self, ctx: &Context<'_>) -> Result<UserSettings, Error> { 11 12 let client = ctx.data::<reqwest::Client>().unwrap(); 12 13 let url = format!("{}/settings", rockbox_url()); 13 - let settings = client.get(url).send().await?.json::<UserSettings>().await?; 14 - Ok(settings) 14 + let settings = client 15 + .get(url) 16 + .send() 17 + .await? 18 + .json::<rb::types::user_settings::UserSettings>() 19 + .await?; 20 + Ok(settings.into()) 15 21 } 16 22 } 17 23