Commit 9fadcbc8 authored by Vladislav's avatar Vladislav

Added make_abbreviation

parent 334b49cd
...@@ -38,6 +38,18 @@ print_wrapped () { ...@@ -38,6 +38,18 @@ print_wrapped () {
} }
export -f 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" ;} check_variables () { [[ -z ${!1} ]] && export $1="$2" ;}
add_to_var () { add_to_var () {
...@@ -2304,25 +2316,25 @@ pw_create_gui_png () { ...@@ -2304,25 +2316,25 @@ pw_create_gui_png () {
export name_desktop_png="bat" export name_desktop_png="bat"
return 0 return 0
fi fi
if [[ -z "$PORTPROTON_NAME" ]] \ if [[ -z "$PORTPROTON_NAME" ]] \
|| [[ -z "$FILE_DESCRIPTION" ]] \
|| [[ "$PW_NO_RESTART_PPDB" == "1" ]] || [[ "$PW_NO_RESTART_PPDB" == "1" ]]
then then
if [[ -n "${PORTWINE_CREATE_SHORTCUT_NAME}" ]] ; then if [[ -n "${PORTWINE_CREATE_SHORTCUT_NAME}" ]] ; then
PORTPROTON_NAME="${PORTWINE_CREATE_SHORTCUT_NAME}" PORTPROTON_NAME="${PORTWINE_CREATE_SHORTCUT_NAME}"
else else
if command -v exiftool &>/dev/null ; then 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!" print_error "exiftool - broken!"
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 exiftool -ProductName "${portwine_exe}"
debug_timer --end "exiftool"
fi
fi fi
else else
print_warning "use portable exiftool" 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 fi
if [[ "$PW_PRODUCTNAME" =~ (Launcher|RU) ]] if [[ "$PW_PRODUCTNAME" =~ (Launcher|RU) ]]
...@@ -2341,7 +2353,7 @@ pw_create_gui_png () { ...@@ -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")" PORTPROTON_NAME="$(echo "${PORTPROTON_NAME}" | sed "s/\`//g" | sed "s/\"//g" | sed "s/'//g" | sed "s/\!//g")"
export PORTPROTON_NAME export PORTPROTON_NAME
edit_db_from_gui PORTPROTON_NAME edit_db_from_gui PORTPROTON_NAME FILE_DESCRIPTION
fi fi
resize_png "$portwine_exe" "${PORTPROTON_NAME}" "128" resize_png "$portwine_exe" "${PORTPROTON_NAME}" "128"
...@@ -5398,11 +5410,6 @@ resize_png () { ...@@ -5398,11 +5410,6 @@ resize_png () {
&& [[ "$ALPINE_FP" != "1" ]] && [[ "$ALPINE_FP" != "1" ]]
then then
print_error "exe-thumbnailer - broken!" 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 fi
else else
print_warning "use portable exe-thumbnailer" print_warning "use portable exe-thumbnailer"
...@@ -5439,12 +5446,9 @@ portwine_create_shortcut () { ...@@ -5439,12 +5446,9 @@ portwine_create_shortcut () {
done done
fi fi
if [[ -z $name_desktop ]] ; then if [[ -z $name_desktop ]] ; then
if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] \ if [[ -n $PW_SHORTCUT_PROXY ]]
&& [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] then name_desktop="$PW_SHORTCUT_PROXY"
then else name_desktop="$PORTWINE_DB"
name_desktop="$PORTPROTON_NAME"
else
name_desktop="$PORTWINE_DB_NEW"
fi fi
fi fi
export name_desktop export name_desktop
...@@ -5622,11 +5626,6 @@ pw_auto_create_shortcut () { ...@@ -5622,11 +5626,6 @@ pw_auto_create_shortcut () {
link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp") link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp")
else else
print_error "exiftool - broken!" print_error "exiftool - broken!"
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 exiftool "$link_file"
debug_timer --end "exiftool"
fi
fi fi
else else
print_warning "use portable exiftool" print_warning "use portable exiftool"
......
...@@ -502,8 +502,17 @@ if [[ -f "${portwine_exe}" ]] ; then ...@@ -502,8 +502,17 @@ if [[ -f "${portwine_exe}" ]] ; then
[[ $DESKTOP_WITH_TIME == enabled ]] && search_desktop_file [[ $DESKTOP_WITH_TIME == enabled ]] && search_desktop_file
if [[ -z "${PW_COMMENT_DB}" ]] ; then if [[ -z "${PW_COMMENT_DB}" ]] ; then
if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] ; then unset PW_SHORTCUT_PROXY
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTPROTON_NAME}" "50")</b>$(seconds_to_time "$TIME_CURRENT")" 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 else
unset PORTWINE_DB_PROXY PORTWINE_DB_NEW unset PORTWINE_DB_PROXY PORTWINE_DB_NEW
PORTWINE_DB="${PORTWINE_DB//_/ }" PORTWINE_DB="${PORTWINE_DB//_/ }"
...@@ -511,7 +520,7 @@ if [[ -f "${portwine_exe}" ]] ; then ...@@ -511,7 +520,7 @@ if [[ -f "${portwine_exe}" ]] ; then
PORTWINE_DB_UPPER="${PORTWINE_DB^^}" PORTWINE_DB_UPPER="${PORTWINE_DB^^}"
PORTWINE_DB="${PORTWINE_DB_UPPER:0:1}${PORTWINE_DB:1}" PORTWINE_DB="${PORTWINE_DB_UPPER:0:1}${PORTWINE_DB:1}"
fi fi
if (( ${#PORTWINE_DB} > 2 )) ; then if (( ${#PORTWINE_DB} > 3 )) ; then
for ((i=0 ; i<${#PORTWINE_DB} ; i++)) ; do for ((i=0 ; i<${#PORTWINE_DB} ; i++)) ; do
if [[ ${PORTWINE_DB:i:2} =~ ([a-z][A-Z]|[a-z][0-9]) ]] \ 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 && [[ ! ${PORTWINE_DB:i:3} =~ ([a-z][A-Z]" "|[a-z][0-9]" ") ]] ; then
...@@ -535,7 +544,8 @@ if [[ -f "${portwine_exe}" ]] ; then ...@@ -535,7 +544,8 @@ if [[ -f "${portwine_exe}" ]] ; then
else else
PORTWINE_DB_NEW="$PORTWINE_DB" PORTWINE_DB_NEW="$PORTWINE_DB"
fi 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 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")"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment