mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-24 23:15:39 +00:00
FRAMEWORK: migrating easter_eggs into a reworked splash_screen function
This commit is contained in:
parent
92760c7a43
commit
af724a6977
|
@ -1,6 +0,0 @@
|
||||||
1201^1231^0000^2359^rd-xmas-splash.svg
|
|
||||||
0209^0212^0000^2359^rd-lunar-dragon-splash.svg
|
|
||||||
0214^0214^0001^2359^rd-valentines-splash.svg
|
|
||||||
0304^0304^0000^2359^rd-gm-bday-splash.svg
|
|
||||||
0317^0317^0000^2359^rd-stpatricks-splash.svg
|
|
||||||
0429^0505^0000^2359^rd-kodomo-golden.svg
|
|
|
@ -58,7 +58,7 @@
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"spalsh_screens" : {
|
"splash_screens" : {
|
||||||
"xmas": {
|
"xmas": {
|
||||||
"start_date": "1201",
|
"start_date": "1201",
|
||||||
"end_date": "1231",
|
"end_date": "1231",
|
||||||
|
|
|
@ -29,7 +29,6 @@ rd_update_patch="/var/config/retrodeck/rd_update.patch"
|
||||||
bios_checklist="$config/retrodeck/reference_lists/bios_checklist.cfg" # A config file listing BIOS file information that can be verified
|
bios_checklist="$config/retrodeck/reference_lists/bios_checklist.cfg" # A config file listing BIOS file information that can be verified
|
||||||
compression_targets="$config/retrodeck/reference_lists/compression_targets.cfg" # A config file containing supported compression types per system
|
compression_targets="$config/retrodeck/reference_lists/compression_targets.cfg" # A config file containing supported compression types per system
|
||||||
zip_compressable_extensions="$config/retrodeck/reference_lists/zip_compressable_extensions.cfg" # A config file containing every file extension that is allowed to be compressed to .zip format, because there are a lot!
|
zip_compressable_extensions="$config/retrodeck/reference_lists/zip_compressable_extensions.cfg" # A config file containing every file extension that is allowed to be compressed to .zip format, because there are a lot!
|
||||||
easter_egg_checklist="$config/retrodeck/reference_lists/easter_egg_checklist.cfg" # A config file listing days and times when special splash screens should show up
|
|
||||||
input_validation="$config/retrodeck/reference_lists/input_validation.cfg" # A config file listing valid CLI inputs
|
input_validation="$config/retrodeck/reference_lists/input_validation.cfg" # A config file listing valid CLI inputs
|
||||||
finit_options_list="$config/retrodeck/reference_lists/finit_options_list.cfg" # A config file listing available optional installs during finit
|
finit_options_list="$config/retrodeck/reference_lists/finit_options_list.cfg" # A config file listing available optional installs during finit
|
||||||
splashscreen_dir="/var/config/ES-DE/resources/graphics/extra_splashes" # The default location of extra splash screens
|
splashscreen_dir="/var/config/ES-DE/resources/graphics/extra_splashes" # The default location of extra splash screens
|
||||||
|
|
|
@ -572,26 +572,26 @@ deploy_helper_files() {
|
||||||
done < "$helper_files_list"
|
done < "$helper_files_list"
|
||||||
}
|
}
|
||||||
|
|
||||||
easter_eggs() {
|
splash_screen() {
|
||||||
# This function will replace the RetroDECK startup splash screen with a different image if the day and time match a listing in easter_egg_checklist.cfg
|
# This function will replace the RetroDECK startup splash screen with a different image if the day and time match a listing in the JSON data.
|
||||||
# The easter_egg_checklist.cfg file has the current format: $start_date^$end_date^$start_time^$end_time^$splash_file
|
# USAGE: splash_screen
|
||||||
# Ex. The line "1001^1031^0000^2359^spooky.svg" would show the file "spooky.svg" during any time of day in the month of October
|
|
||||||
# The easter_egg_checklist.cfg is read in order, so lines higher in the file will have higher priority in the event of an overlap
|
current_day=$(date +"%m%d") # Read the current date in a format that can be calculated in ranges
|
||||||
# USAGE: easter_eggs
|
current_time=$(date +"%H%M") # Read the current time in a format that can be calculated in ranges
|
||||||
current_day=$(date +"%0m%0d") # Read the current date in a format that can be calculated in ranges
|
|
||||||
current_time=$(date +"%0H%0M") # Read the current time in a format that can be calculated in ranges
|
# Read the JSON file and extract splash screen data using jq
|
||||||
if [[ ! -z $(cat $easter_egg_checklist) ]]; then
|
splash_screen=$(jq -r --arg current_day "$current_day" --arg current_time "$current_time" '
|
||||||
while IFS="^" read -r start_date end_date start_time end_time splash_file || [[ -n "$start_date" ]]; # Read Easter Egg checklist file and separate values
|
.splash_screens | to_entries[] |
|
||||||
do
|
select(
|
||||||
if [[ ! $start_date == "#"* ]] && [[ ! -z "$start_date" ]]; then
|
($current_day | tonumber) >= (.value.start_date | tonumber) and
|
||||||
if [[ "$((10#$current_day))" -ge "$((10#$start_date))" && "$((10#$current_day))" -le "$((10#$end_date))" && "$((10#$current_time))" -ge "$((10#$start_time))" && "$((10#$current_time))" -le "$((10#$end_time))" ]]; then # If current line specified date/time matches current date/time, set $splash_file to be deployed
|
($current_day | tonumber) <= (.value.end_date | tonumber) and
|
||||||
new_splash_file="$splashscreen_dir/$splash_file"
|
($current_time | tonumber) >= (.value.start_time | tonumber) and
|
||||||
break
|
($current_time | tonumber) <= (.value.end_time | tonumber)
|
||||||
else # When there are no matches, the default splash screen is set to deploy
|
) | .value.filename' config/retrodeck/reference_lists/features.json)
|
||||||
new_splash_file="$default_splash_file"
|
|
||||||
fi
|
# Determine the splash file to use
|
||||||
fi
|
if [[ -n "$splash_screen" ]]; then
|
||||||
done < $easter_egg_checklist
|
new_splash_file="$splashscreen_dir/$splash_screen"
|
||||||
else
|
else
|
||||||
new_splash_file="$default_splash_file"
|
new_splash_file="$default_splash_file"
|
||||||
fi
|
fi
|
||||||
|
@ -770,7 +770,7 @@ quit_retrodeck() {
|
||||||
}
|
}
|
||||||
|
|
||||||
start_retrodeck() {
|
start_retrodeck() {
|
||||||
easter_eggs # Check if today has a surprise splashscreen and load it if so
|
splash_screen # Check if today has a surprise splashscreen and load it if so
|
||||||
ponzu
|
ponzu
|
||||||
log i "Starting RetroDECK v$version"
|
log i "Starting RetroDECK v$version"
|
||||||
es-de
|
es-de
|
||||||
|
|
Loading…
Reference in a new issue