Fixes bugs ..
This commit is contained in:
parent
0b963639b7
commit
8eb41a0118
@ -779,8 +779,9 @@ debug_timer () {
|
|||||||
search_desktop_file () {
|
search_desktop_file () {
|
||||||
# Поиск нужного .desktop файла по $portwine_exe, чтобы внести изменения в него.
|
# Поиск нужного .desktop файла по $portwine_exe, чтобы внести изменения в него.
|
||||||
for desktop_file in "${PORT_WINE_PATH}"/* ; do
|
for desktop_file in "${PORT_WINE_PATH}"/* ; do
|
||||||
if [[ $desktop_file =~ .desktop ]] ; then
|
desktop_file_new="${desktop_file//"${PORT_WINE_PATH}/"/}"
|
||||||
if [[ ! $desktop_file =~ (/PortProton|/readme) ]] ; then
|
if [[ $desktop_file_new =~ .desktop ]] ; then
|
||||||
|
if [[ ! $desktop_file_new =~ (PortProton|readme) ]] ; then
|
||||||
while IFS= read -r line ; do
|
while IFS= read -r line ; do
|
||||||
if [[ $line =~ ^Exec= ]] ; then
|
if [[ $line =~ ^Exec= ]] ; then
|
||||||
if check_flatpak ; then
|
if check_flatpak ; then
|
||||||
@ -794,18 +795,20 @@ search_desktop_file () {
|
|||||||
if [[ $line =~ ^#Time= ]] ; then
|
if [[ $line =~ ^#Time= ]] ; then
|
||||||
if [[ $portwine_exe == "$EXEC_DESKTOP_NEW" ]] ; then
|
if [[ $portwine_exe == "$EXEC_DESKTOP_NEW" ]] ; then
|
||||||
TIME_CURRENT=${line//#Time=/}
|
TIME_CURRENT=${line//#Time=/}
|
||||||
if [[ ! $TIME_CURRENT =~ [0-9]+ ]] ; then
|
|
||||||
TIME_CURRENT="0"
|
|
||||||
sed -i '/^#Time=/d' "$desktop_file"
|
|
||||||
echo "#Time=0" >> "$desktop_file"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < "$desktop_file"
|
done < "$desktop_file"
|
||||||
if [[ -n $PW_TIME_IN_GAME ]] ; then
|
if [[ $portwine_exe == "$EXEC_DESKTOP_NEW" ]] ; then
|
||||||
TIME_TOTAL=$(( TIME_CURRENT + PW_TIME_IN_GAME ))
|
if [[ ! $TIME_CURRENT =~ [0-9]+ ]] ; then
|
||||||
sed -i '/^#Time=/d' "$desktop_file"
|
TIME_CURRENT="0"
|
||||||
echo "#Time=$TIME_TOTAL" >> "$desktop_file"
|
sed -i '/^#Time=/d' "$desktop_file"
|
||||||
|
echo "#Time=0" >> "$desktop_file"
|
||||||
|
fi
|
||||||
|
if [[ -n $PW_TIME_IN_GAME ]] ; then
|
||||||
|
TIME_TOTAL=$(( TIME_CURRENT + PW_TIME_IN_GAME ))
|
||||||
|
sed -i '/^#Time=/d' "$desktop_file"
|
||||||
|
echo "#Time=$TIME_TOTAL" >> "$desktop_file"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -814,51 +817,57 @@ search_desktop_file () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
seconds_to_time () {
|
seconds_to_time () {
|
||||||
[[ -z $1 ]] && return 1
|
[[ -z $1 ]] && return 0
|
||||||
local seconds=$1
|
local seconds=$1
|
||||||
|
|
||||||
|
# Calculate days
|
||||||
|
local days=$((seconds / (60 * 60 * 24)))
|
||||||
|
local seconds=$((seconds % (60 * 60 * 24)))
|
||||||
|
|
||||||
|
# Calculate hours
|
||||||
|
local hours=$((seconds / (60 * 60)))
|
||||||
|
local seconds=$((seconds % (60 * 60)))
|
||||||
|
|
||||||
|
# Calculate minutes
|
||||||
local minutes=$((seconds / 60))
|
local minutes=$((seconds / 60))
|
||||||
local hours=$((minutes / 60))
|
local seconds=$((seconds % 60))
|
||||||
local days=$((hours / 24))
|
|
||||||
local remaining_minutes=$((minutes % 60))
|
|
||||||
local remaining_hours=$((hours % 24))
|
|
||||||
|
|
||||||
if [[ $days =~ ^0$ ]] ; then
|
if [[ $days =~ ^0$ ]] ; then
|
||||||
local remaining_days=
|
local days=
|
||||||
elif [[ $days =~ ^1$ ]] ; then
|
elif [[ $days =~ ^1$ ]] ; then
|
||||||
local remaining_days="$days ${translations[day]}, "
|
local days="$days ${translations[day]}, "
|
||||||
elif [[ $days =~ ^([2-9]1|[1-9][0-9]+1)$ ]] && [[ $LANGUAGE = ru ]] ; then
|
elif [[ $days =~ ^([2-9]1|[1-9][0-9]+1)$ ]] && [[ $LANGUAGE = ru ]] ; then
|
||||||
local remaining_days="$days ${translations[day]}, "
|
local days="$days ${translations[day]}, "
|
||||||
elif [[ $days =~ ^(2|3|4|[2-9]2|[2-9]3|[2-9]4|[1-9][0-9]+2|[1-9][0-9]+3|[1-9][0-9]+4)$ ]] \
|
elif [[ $days =~ ^([2-4]|[2-9][2-4]|[1-9][0-9]+[2-4])$ ]] \
|
||||||
&& [[ $LANGUAGE = ru ]] ; then
|
&& [[ $LANGUAGE = ru ]] ; then
|
||||||
local remaining_days="$days дня, "
|
local days="$days дня, "
|
||||||
else
|
else
|
||||||
local remaining_days="$days ${translations[days]}, "
|
local days="$days ${translations[days]}, "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $remaining_hours =~ ^0$ ]] ; then
|
if [[ $hours =~ ^0$ ]] ; then
|
||||||
local remaining_hours=
|
local hours=
|
||||||
elif [[ $remaining_hours =~ ^1$ ]] ; then
|
elif [[ $hours =~ ^1$ ]] ; then
|
||||||
local remaining_hours="$hours ${translations[hour]} ${translations[and]} "
|
local hours="$hours ${translations[hour]} ${translations[and]} "
|
||||||
elif [[ $remaining_hours =~ ^(2|3|4|22|23|24)$ ]] && [[ $LANGUAGE = ru ]] ; then
|
elif [[ $hours =~ ^([2-4]|2[2-4])$ ]] && [[ $LANGUAGE = ru ]] ; then
|
||||||
local remaining_hours="$hours часа ${translations[and]} "
|
local hours="$hours часа ${translations[and]} "
|
||||||
elif [[ $remaining_hours =~ ^21$ ]] && [[ $LANGUAGE = ru ]] ; then
|
elif [[ $hours =~ ^21$ ]] && [[ $LANGUAGE = ru ]] ; then
|
||||||
local remaining_hours="$hours час ${translations[and]} "
|
local hours="$hours ${translations[hour]} ${translations[and]} "
|
||||||
else
|
else
|
||||||
local remaining_hours="$hours ${translations[hours]} ${translations[and]} "
|
local hours="$hours ${translations[hours]} ${translations[and]} "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $remaining_minutes =~ ^1$ ]] ; then
|
if [[ $minutes =~ ^1$ ]] ; then
|
||||||
local remaining_minutes="$remaining_minutes ${translations[minute]}"
|
local minutes="$minutes ${translations[minute]}"
|
||||||
elif [[ $remaining_minutes =~ ^[2-5]1$ ]] && [[ $LANGUAGE = ru ]] ; then
|
elif [[ $minutes =~ ^[2-5]1$ ]] && [[ $LANGUAGE = ru ]] ; then
|
||||||
local remaining_minutes="$remaining_minutes ${translations[minute]}"
|
local minutes="$minutes ${translations[minute]}"
|
||||||
elif [[ $remaining_minutes =~ ^(2|3|4|[2-5]2|[2-5]3|[2-5]4)$ ]] && [[ $LANGUAGE = ru ]] ; then
|
elif [[ $minutes =~ ^([2-4]|[2-5][2-4])$ ]] && [[ $LANGUAGE = ru ]] ; then
|
||||||
local remaining_minutes="$remaining_minutes минуты"
|
local minutes="$minutes минуты"
|
||||||
else
|
else
|
||||||
local remaining_minutes="$remaining_minutes ${translations[minutes]}"
|
local minutes="$minutes ${translations[minutes]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\n${translations[Time spent]}: $remaining_days$remaining_hours$remaining_minutes"
|
echo -e "<b>\n${translations[Time spent]}: $days$hours$minutes</b>"
|
||||||
}
|
}
|
||||||
|
|
||||||
combobox_fix () {
|
combobox_fix () {
|
||||||
|
@ -502,12 +502,12 @@ if [[ -f "${portwine_exe}" ]] ; then
|
|||||||
fi
|
fi
|
||||||
if [[ -z "${PW_COMMENT_DB}" ]] ; then
|
if [[ -z "${PW_COMMENT_DB}" ]] ; then
|
||||||
if [[ -n "${PORTPROTON_NAME}" ]] ; then
|
if [[ -n "${PORTPROTON_NAME}" ]] ; then
|
||||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTPROTON_NAME}" "50")$(seconds_to_time $TIME_CURRENT)</b>"
|
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTPROTON_NAME}" "50")$(seconds_to_time "$TIME_CURRENT")</b>"
|
||||||
else
|
else
|
||||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTWINE_DB}" "50")$(seconds_to_time $TIME_CURRENT)</b>"
|
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTWINE_DB}" "50")$(seconds_to_time "$TIME_CURRENT")</b>"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time $TIME_CURRENT)"
|
PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export KEY_START="$RANDOM"
|
export KEY_START="$RANDOM"
|
||||||
@ -612,8 +612,6 @@ else
|
|||||||
gui_userconf
|
gui_userconf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug_timer --start # дропнуть и debug_timer --end ниже тоже
|
|
||||||
|
|
||||||
# Поиск .desktop файлов
|
# Поиск .desktop файлов
|
||||||
AMOUNT_GENERATE_BUTTONS="0"
|
AMOUNT_GENERATE_BUTTONS="0"
|
||||||
for desktop_file in "${PORT_WINE_PATH}"/* ; do
|
for desktop_file in "${PORT_WINE_PATH}"/* ; do
|
||||||
@ -806,7 +804,6 @@ else
|
|||||||
|
|
||||||
export AI_SKIP="1"
|
export AI_SKIP="1"
|
||||||
fi
|
fi
|
||||||
debug_timer --end
|
|
||||||
|
|
||||||
IFS="%"
|
IFS="%"
|
||||||
"${pw_yad}" --plug=$KEY_MENU --tabnum="${PW_GUI_SORT_TABS[1]}" --form --columns="$MAIN_GUI_ROWS_EMULS" --align-buttons --scroll --homogeneous-column \
|
"${pw_yad}" --plug=$KEY_MENU --tabnum="${PW_GUI_SORT_TABS[1]}" --form --columns="$MAIN_GUI_ROWS_EMULS" --align-buttons --scroll --homogeneous-column \
|
||||||
|
Loading…
Reference in New Issue
Block a user