Added make_abbreviation
This commit is contained in:
parent
334b49cd01
commit
9fadcbc8e2
@ -38,6 +38,18 @@ print_wrapped () {
|
||||
}
|
||||
export -f print_wrapped
|
||||
|
||||
make_abbreviation () {
|
||||
local words new_word i
|
||||
words=($1)
|
||||
# Создаем новое слово, состоящее из начальных букв слов
|
||||
new_word="${words[0]:0:1}"
|
||||
for ((i=1 ; i<${#words[@]} ; i++)) ; do
|
||||
new_word+="${words[$i]:0:1}"
|
||||
done
|
||||
echo "$new_word"
|
||||
}
|
||||
export -f make_abbreviation
|
||||
|
||||
check_variables () { [[ -z ${!1} ]] && export $1="$2" ;}
|
||||
|
||||
add_to_var () {
|
||||
@ -2304,25 +2316,25 @@ pw_create_gui_png () {
|
||||
export name_desktop_png="bat"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ -z "$PORTPROTON_NAME" ]] \
|
||||
|| [[ -z "$FILE_DESCRIPTION" ]] \
|
||||
|| [[ "$PW_NO_RESTART_PPDB" == "1" ]]
|
||||
then
|
||||
if [[ -n "${PORTWINE_CREATE_SHORTCUT_NAME}" ]] ; then
|
||||
PORTPROTON_NAME="${PORTWINE_CREATE_SHORTCUT_NAME}"
|
||||
else
|
||||
if command -v exiftool &>/dev/null ; then
|
||||
if ! PW_PRODUCTNAME=$(timeout 3 exiftool -ProductName "${portwine_exe}" 2>/dev/null | sed -n 's/^Product Name\s*:\s*//p') ; then
|
||||
if timeout 3 exiftool "$portwine_exe" &> "${PW_TMPFS_PATH}/exiftool.tmp" ; then
|
||||
PW_PRODUCTNAME=$(sed -n 's/^Product Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp")
|
||||
FILE_DESCRIPTION=$(sed -n 's/^File Description\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp")
|
||||
else
|
||||
print_error "exiftool - broken!"
|
||||
if [[ -n "$PW_DEBUG" ]] ; then
|
||||
debug_timer --start
|
||||
timeout 5 exiftool -ProductName "${portwine_exe}"
|
||||
debug_timer --end "exiftool"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print_warning "use portable exiftool"
|
||||
PW_PRODUCTNAME=$(env PERL5LIB="${PW_PLUGINS_PATH}/portable/lib/perl5" "${PW_PLUGINS_PATH}/portable/bin/exiftool" -ProductName "${portwine_exe}" | sed -n 's/^Product Name\s*:\s*//p')
|
||||
env PERL5LIB="${PW_PLUGINS_PATH}/portable/lib/perl5" "${PW_PLUGINS_PATH}/portable/bin/exiftool" "$portwine_exe" &> "${PW_TMPFS_PATH}/exiftool.tmp"
|
||||
PW_PRODUCTNAME=$(sed -n 's/^Product Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp")
|
||||
FILE_DESCRIPTION=$(sed -n 's/^File Description\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp")
|
||||
fi
|
||||
|
||||
if [[ "$PW_PRODUCTNAME" =~ (Launcher|RU) ]]
|
||||
@ -2341,7 +2353,7 @@ pw_create_gui_png () {
|
||||
|
||||
PORTPROTON_NAME="$(echo "${PORTPROTON_NAME}" | sed "s/\`//g" | sed "s/\"//g" | sed "s/'//g" | sed "s/\!//g")"
|
||||
export PORTPROTON_NAME
|
||||
edit_db_from_gui PORTPROTON_NAME
|
||||
edit_db_from_gui PORTPROTON_NAME FILE_DESCRIPTION
|
||||
fi
|
||||
|
||||
resize_png "$portwine_exe" "${PORTPROTON_NAME}" "128"
|
||||
@ -5398,11 +5410,6 @@ resize_png () {
|
||||
&& [[ "$ALPINE_FP" != "1" ]]
|
||||
then
|
||||
print_error "exe-thumbnailer - broken!"
|
||||
if [[ -n "$PW_DEBUG" ]] ; then
|
||||
debug_timer --start
|
||||
timeout 5 exe-thumbnailer --force-resize -s "$RESIZE_TO" "$(readlink -f "${RESIZE_FILE}")" "${PORT_WINE_PATH}/data/img/${RESIZE_NAME_PNG}.png"
|
||||
debug_timer --end "exe-thumbnailer"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print_warning "use portable exe-thumbnailer"
|
||||
@ -5439,12 +5446,9 @@ portwine_create_shortcut () {
|
||||
done
|
||||
fi
|
||||
if [[ -z $name_desktop ]] ; then
|
||||
if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] \
|
||||
&& [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]]
|
||||
then
|
||||
name_desktop="$PORTPROTON_NAME"
|
||||
else
|
||||
name_desktop="$PORTWINE_DB_NEW"
|
||||
if [[ -n $PW_SHORTCUT_PROXY ]]
|
||||
then name_desktop="$PW_SHORTCUT_PROXY"
|
||||
else name_desktop="$PORTWINE_DB"
|
||||
fi
|
||||
fi
|
||||
export name_desktop
|
||||
@ -5622,11 +5626,6 @@ pw_auto_create_shortcut () {
|
||||
link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp")
|
||||
else
|
||||
print_error "exiftool - broken!"
|
||||
if [[ -n "$PW_DEBUG" ]] ; then
|
||||
debug_timer --start
|
||||
timeout 5 exiftool "$link_file"
|
||||
debug_timer --end "exiftool"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print_warning "use portable exiftool"
|
||||
|
@ -502,8 +502,17 @@ if [[ -f "${portwine_exe}" ]] ; then
|
||||
|
||||
[[ $DESKTOP_WITH_TIME == enabled ]] && search_desktop_file
|
||||
if [[ -z "${PW_COMMENT_DB}" ]] ; then
|
||||
if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] ; then
|
||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTPROTON_NAME}" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
|
||||
unset PW_SHORTCUT_PROXY
|
||||
FILE_DESCRIPTION_ABBR=$(make_abbreviation "$FILE_DESCRIPTION")
|
||||
PORTPROTON_NAME_ABBR=$(make_abbreviation "$PORTPROTON_NAME")
|
||||
if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] \
|
||||
|| (( ${#PORTPROTON_NAME_ABBR} > 2 )) && [[ ${PORTPROTON_NAME_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then
|
||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "$PORTPROTON_NAME" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
|
||||
PW_SHORTCUT_PROXY="$PORTPROTON_NAME"
|
||||
elif [[ ${FILE_DESCRIPTION^^} =~ ${PORTWINE_DB^^} ]] && [[ ${FILE_DESCRIPTION^^} != "${PORTWINE_DB^^}" ]] \
|
||||
|| (( ${#FILE_DESCRIPTION_ABBR} > 2 )) && [[ ${FILE_DESCRIPTION_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then
|
||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "$FILE_DESCRIPTION" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
|
||||
PW_SHORTCUT_PROXY="$FILE_DESCRIPTION"
|
||||
else
|
||||
unset PORTWINE_DB_PROXY PORTWINE_DB_NEW
|
||||
PORTWINE_DB="${PORTWINE_DB//_/ }"
|
||||
@ -511,7 +520,7 @@ if [[ -f "${portwine_exe}" ]] ; then
|
||||
PORTWINE_DB_UPPER="${PORTWINE_DB^^}"
|
||||
PORTWINE_DB="${PORTWINE_DB_UPPER:0:1}${PORTWINE_DB:1}"
|
||||
fi
|
||||
if (( ${#PORTWINE_DB} > 2 )) ; then
|
||||
if (( ${#PORTWINE_DB} > 3 )) ; then
|
||||
for ((i=0 ; i<${#PORTWINE_DB} ; i++)) ; do
|
||||
if [[ ${PORTWINE_DB:i:2} =~ ([a-z][A-Z]|[a-z][0-9]) ]] \
|
||||
&& [[ ! ${PORTWINE_DB:i:3} =~ ([a-z][A-Z]" "|[a-z][0-9]" ") ]] ; then
|
||||
@ -535,7 +544,8 @@ if [[ -f "${portwine_exe}" ]] ; then
|
||||
else
|
||||
PORTWINE_DB_NEW="$PORTWINE_DB"
|
||||
fi
|
||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTWINE_DB_NEW}" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
|
||||
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "$PORTWINE_DB_NEW" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
|
||||
PW_SHORTCUT_PROXY="$PORTWINE_DB_NEW"
|
||||
fi
|
||||
else
|
||||
PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")"
|
||||
|
Loading…
Reference in New Issue
Block a user