Skip to content

Commit 600caf7

Browse files
authored
fix sorting (#35)
1 parent 179bfd8 commit 600caf7

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

dependencies/sorting.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,42 @@ function sortFiles {
66
# $1 is the argument passed using --sort=<Directory>. No trailing slash is needed
77
if [[ -n "$1" ]]; then
88
if [[ "$1" == "nosort" ]]; then
9-
echo "INFO: No sorting. Transferring to default complete directory: \"$ftpcomplete\""
9+
echo "INFO: No sorting. Transferring to default complete directory: \"$complete\""
1010
else
11-
ftpcomplete="${ftpcomplete}${1}/"
12-
echo "INFO: Sorted to ${ftpcomplete}"
11+
complete="${complete}${1}/"
12+
echo "INFO: Sorted to ${complete}"
1313
fi
1414
# Check file name patterns and sort accordingly
1515
elif [[ $orig_name =~ (\.(x86|x64|mac|android|iphone)) ]]; then
16-
ftpcomplete=$ftpcomplete"Appz/"
17-
echo "INFO: Sorted to ${ftpcomplete}"
16+
complete=$complete"Appz/"
17+
echo "INFO: Sorted to ${complete}"
1818
elif [[ $orig_name =~ (PAL|NTSC).+DVDR. ]]; then
19-
ftpcomplete=$ftpcomplete"DVD/"
20-
echo "INFO: Sorted to ${ftpcomplete}"
19+
complete=$complete"DVD/"
20+
echo "INFO: Sorted to ${complete}"
2121
elif [[ $orig_name =~ (BDRip|DVDRip).+(XviD|x264) ]] && [[ ! $orig_name =~ (S[0-9][0-9]) ]] && [[ ! $orig_name =~ (S[0-9][0-9]E[0-9][0-9]) ]] && [[ ! $orig_name =~ (E[0-9][0-9]) ]] && [[ ! $orig_name =~ (S[0-9][0-9]) ]] && [[ ! $orig_name =~ (\.(episode|ep|e|Part|pt)\.(([0-9][0-9]?)|(I|II|III|IV|V|VI|VII|VIII|IIX|IX|X|XI|XII))\.) ]] && [[ ! $orig_name =~ ([[:digit:]](x|of)[[:digit:]]) ]]; then
22-
ftpcomplete=$ftpcomplete"XViD/"
23-
echo "INFO: Sorted to ${ftpcomplete}"
22+
complete=$complete"XViD/"
23+
echo "INFO: Sorted to ${complete}"
2424
elif [[ $orig_name =~ (HDDVD|BluRay|WEB-DL|WEB).+(x264|x265|H264|H265) ]] && [[ ! $orig_name =~ (S[0-9][0-9]) ]]; then
25-
ftpcomplete=$ftpcomplete"HD/"
26-
echo "INFO: Sorted to ${ftpcomplete}"
25+
complete=$complete"HD/"
26+
echo "INFO: Sorted to ${complete}"
2727
elif [[ $orig_name =~ \.XXX\. ]]; then
28-
ftpcomplete=$ftpcomplete"XXX/"
29-
echo "INFO: Sorted to ${ftpcomplete}"
28+
complete=$complete"XXX/"
29+
echo "INFO: Sorted to ${complete}"
3030
elif [[ $orig_name =~ (S[0-9][0-9]E[0-9][0-9]) ]] || [[ $orig_name =~ (\.E[0-9][0-9]?[0-9]?\.) ]] || [[ $orig_name =~ (S[0-9][0-9]) ]] || [[ $orig_name =~ (\.(episode|ep|e|Part|pt)\.(([0-9][0-9]?)|(I|II|III|IV|V|VI|VII|VIII|IIX|IX|X|XI|XII))\.) ]] || [[ $orig_name =~ ([[:digit:]](x|of)[[:digit:]]) ]] || [[ $orig_name =~ ([[:digit:]]{4}.[[:digit:]]{2}.[[:digit:]]{2})|([[:digit:]]{2}.[[:digit:]]{2}.[[:digit:]]{4}) ]]; then
3131
# Sort to series folders if format matches
3232
local series_name="${orig_name%%.S[[:digit:]]*}"
3333
if [[ $orig_name == $series_name ]]; then
34-
ftpcomplete=$ftpcomplete"TV/"
34+
complete=$complete"TV/"
3535
echo "INFO: Series name could not be found"
36-
echo "INFO: Sorted to: ${ftpcomplete}"
36+
echo "INFO: Sorted to: ${complete}"
3737
else
3838
series_name="${series_name//./ }" # replace dots with spaces
3939
echo -e "\e[00;37mINFO: Series name: \e[00;32m$series_name\e[00m"
40-
ftpcomplete=$ftpcomplete"TV/$series_name/"
41-
echo "INFO: Sorted to: ${ftpcomplete}"
40+
complete=$complete"TV/$series_name/"
41+
echo "INFO: Sorted to: ${complete}"
4242
fi
4343
else
4444
echo -e "\e[00;33mINFO: Category could not be parsed\e[00m"
45-
echo "INFO: Moving files upon finish to default directory: \"$ftpcomplete\""
45+
echo "INFO: Moving files upon finish to default directory: \"$complete\""
4646
fi
4747
}

0 commit comments

Comments
 (0)