Skip to content

Commit

Permalink
completion: Only move data downloaded to the default directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pyroscope committed Aug 19, 2017
1 parent 043effb commit 560581c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/examples/completion-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ set_target_path() {
target_base=$(command cd $(dirname "$base_path")/.. >/dev/null && pwd)"/done"
month=$(date +'%Y-%m')

# Only move data downloaded to the default directory
egrep >/dev/null "^${default%/}/" <<<"${base_path}/" || return

# Move by label
test -n "$target" || case $(tr A-Z' ' a-z_ <<<"${label:-NOT_SET}") in
tv|hdtv) target="TV" ;;
movie*) target="Movies/$month" ;;
esac

# Move by name patterns
test -n "$target" || case $(tr A-Z' ' a-z. <<<"${name:-EMPTY}") in
*hdtv*|*pdtv*) target="TV" ;;
*.s[0-9][0-9].*) target="TV" ;;
Expand Down

0 comments on commit 560581c

Please sign in to comment.