Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
Abbreviations support corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
TW committed Apr 19, 2014
1 parent 7220ba7 commit 7d361ef
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions napi.sh
Expand Up @@ -389,11 +389,19 @@ function download_subs
# input/output filename manipulation
local base=$(basename "$file")
local output_path=$(dirname "$file")
local output_file_noext="${base%.*}"

local output_file="${base%.*}.$g_DefaultExt"
# jezeli ustawiona wstawka, to dodaje
if [[ "$g_Abbrev" != "" ]]; then
echo "Dodaje '$g_Abbrev' do rozszerzenia"
output_file_noext="${output_file_noext}.${g_Abbrev}"
fi

local output_file="$output_file_noext.$g_DefaultExt"
local output="$output_path/$output_file"
local output_img="$output_path/${base%.*}.jpg"
local conv_output="$output_path/ORIG_$output_file"

local output_img="$output_path/${base%.*}.jpg"
local fExists=0

if [[ -e "$output" ]] || [[ -e "$conv_output" ]]; then
Expand Down Expand Up @@ -425,11 +433,11 @@ function download_subs
# if ext == $g_DefaultExt then copy the original with a ORIG_ prefix
case "$g_Format" in
"subrip")
outputSubs="$output_path/${base%.*}.srt"
outputSubs="$output_path/${output_file_noext}.srt"
;;

"subviewer")
outputSubs="$output_path/${base%.*}.sub"
outputSubs="$output_path/${output_file_noext}.sub"
;;

*)
Expand All @@ -456,15 +464,6 @@ function download_subs
output="$outputSubs"
fi

# jezeli ustawiona wstawka, to dodaje
if [[ "$g_Abbrev" != "" ]]; then
echo "Dodaje '$g_Abbrev' do rozszerzenia"
extension="${output##*.}"
file="${output%.*}"
newFile="${file}.${g_Abbrev}.${extension}"
mv "$output" "$newFile"
fi

else # [[ $napiStatus = "1" ]]
echo -e "[UNAV]\t[$base]:\tNapisy niedostepne !!!"
g_Unavailable=$(( $g_Unavailable + 1 ))
Expand Down

0 comments on commit 7d361ef

Please sign in to comment.