Added option for audio manual.
This commit is contained in:
parent
9fbc149e19
commit
e0e240848d
@ -32,6 +32,58 @@ speak() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
audio_manual() {
|
||||||
|
if command -v mpv &> /dev/null ; then
|
||||||
|
mediaPlayer=("mpv" "--really-quiet" "--no-video")
|
||||||
|
else
|
||||||
|
mediaPlayer=("play" "-qV0")
|
||||||
|
fi
|
||||||
|
local manualPath="${gamePath}/Manual"
|
||||||
|
declare -a menuList
|
||||||
|
for i in "${manualPath}"/*/ ; do
|
||||||
|
local path="${i%/}"
|
||||||
|
local name="${i/${manualPath}\//}"
|
||||||
|
local name="${name% *}"
|
||||||
|
menuList+=("$path" "$name")
|
||||||
|
done
|
||||||
|
manualPath="$(dialog --backtitle "Select a Manual" \
|
||||||
|
--clear \
|
||||||
|
--no-tags \
|
||||||
|
--menu "Please select one" 0 0 0 "${menuList[@]}" --stdout)"
|
||||||
|
[[ $? -ne 0 ]] && exit 0
|
||||||
|
# If user selected a manual, show the audio file menu
|
||||||
|
if [[ -n "$manualPath" ]]; then
|
||||||
|
declare -a audioList=("all" "Play All") # Start with "All" option
|
||||||
|
# Add all mp3 files to the menu
|
||||||
|
while IFS= read -r file; do
|
||||||
|
local filename="${file##*/}"
|
||||||
|
local menuname="${filename%.mp3}"
|
||||||
|
audioList+=("$file" "$menuname")
|
||||||
|
done < <(find "$manualPath" -name "*.mp3" | sort)
|
||||||
|
local selection
|
||||||
|
selection="$(dialog --backtitle "Select Audio Track" \
|
||||||
|
--clear \
|
||||||
|
--no-tags \
|
||||||
|
--menu "Please select one" 0 0 0 "${audioList[@]}" --stdout)"
|
||||||
|
[[ $? -ne 0 ]] && exit 0
|
||||||
|
if [[ -n "$selection" ]]; then
|
||||||
|
if [[ "$selection" == "all" ]]; then
|
||||||
|
# Play all files in order
|
||||||
|
find "$manualPath" -name "*.mp3" -print0 | sort -z | \
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
"${mediaPlayer[@]}" "$file"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# Play selected file
|
||||||
|
"${mediaPlayer[@]}" "$selection"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Dialog setup:
|
# Dialog setup:
|
||||||
DIALOG_ITEM_HELP=""
|
DIALOG_ITEM_HELP=""
|
||||||
export DIALOGOPTS='--no-lines --visit-items'
|
export DIALOGOPTS='--no-lines --visit-items'
|
||||||
@ -180,17 +232,23 @@ if [[ "$doomLanguage" != "en" ]]; then
|
|||||||
init_translation_db
|
init_translation_db
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gameOption="$(dialog --backtitle "Select your Doom!" \
|
doomGames+=("manual" "Audio Manual")
|
||||||
--clear \
|
while [[ -z "${gameOption}" ]] || [[ "${gameOption}" == "manual" ]]; do
|
||||||
--no-tags \
|
gameOption="$(dialog --backtitle "Select your Doom!" \
|
||||||
--ok-label "Single Player" \
|
--clear \
|
||||||
--cancel-label "Death Match" \
|
--no-tags \
|
||||||
--extra-button \
|
--ok-label "Single Player" \
|
||||||
--extra-label "co-op" \
|
--cancel-label "Death Match" \
|
||||||
--help-button \
|
--extra-button \
|
||||||
--help-label "Exit" \
|
--extra-label "co-op" \
|
||||||
--menu "Please select one" 0 0 0 "${doomGames[@]}" --stdout)"
|
--help-button \
|
||||||
buttonCode=$?
|
--help-label "Exit" \
|
||||||
|
--menu "Please select one" 0 0 0 "${doomGames[@]}" --stdout)"
|
||||||
|
buttonCode=$?
|
||||||
|
if [[ "${gameOption}" == "manual" ]]; then
|
||||||
|
audio_manual
|
||||||
|
fi
|
||||||
|
done
|
||||||
if [[ -e "${gamePath}/DoomMetalVol7.wad" ]]; then
|
if [[ -e "${gamePath}/DoomMetalVol7.wad" ]]; then
|
||||||
gameOption+=" DoomMetalVol7.wad"
|
gameOption+=" DoomMetalVol7.wad"
|
||||||
elif [[ -e "${gamePath}/DoomMetalVol6.wad" ]]; then
|
elif [[ -e "${gamePath}/DoomMetalVol6.wad" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user