Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • chris/dotfiles
1 result
Select Git revision
Loading items
Show changes
Commits on Source (3)
...@@ -32,7 +32,7 @@ alias timezone='date +"%Z (GMT %:z)"' ...@@ -32,7 +32,7 @@ alias timezone='date +"%Z (GMT %:z)"'
alias week='date +%V' alias week='date +%V'
# IP address # IP address
alias ip='dig +short myip.opendns.com @resolver1.opendns.com' alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
# Enable aliases to be sudo'ed # Enable aliases to be sudo'ed
alias sudo='sudo ' alias sudo='sudo '
......
...@@ -36,8 +36,11 @@ Options: ...@@ -36,8 +36,11 @@ Options:
-f -f
This script will attempt to fix any issues it finds. This script will attempt to fix any issues it finds.
-t
Consider a title that don't match the recommended title as an issue.
-b <bts-prefix> -b <bts-prefix>
This allows you to specify a prefix to prepend to the names of "Behind the This allows you to specify a prefix to prepend to the title of "Behind the
Scenes" files. Scenes" files.
-d -d
...@@ -55,14 +58,18 @@ EOF ...@@ -55,14 +58,18 @@ EOF
# Parse command options # Parse command options
flag_f=0 flag_f=0
flag_t=0
flag_d=0 flag_d=0
flag_p=0 flag_p=0
bts_prefix='' bts_prefix=''
while getopts 'fb:dph' flag; do while getopts 'ftb:dph' flag; do
case "${flag}" in case "${flag}" in
f) f)
flag_f=1 flag_f=1
;; ;;
t)
flag_t=1
;;
b) b)
bts_prefix="$OPTARG" bts_prefix="$OPTARG"
;; ;;
...@@ -115,10 +122,13 @@ while IFS= read -rd '' file <&3; do ...@@ -115,10 +122,13 @@ while IFS= read -rd '' file <&3; do
# Check title # Check title
title=$(echo "$file_info" | grep 'Title:' | sed 's/.* Title: \(.*\)$/\1/') title=$(echo "$file_info" | grep 'Title:' | sed 's/.* Title: \(.*\)$/\1/')
if [[ -z "$title" || $flag_t -eq 1 ]]; then
if [[ -z "$title" ]]; then if [[ -z "$title" ]]; then
print_filename_once print_filename_once
echo "Title Missing" echo "Title Missing"
if [[ $flag_f -eq 1 ]]; then fi
# Generate a new title to recommend
new_title="$(basename "$file")" # get the filename new_title="$(basename "$file")" # get the filename
new_title="${new_title%.*}" # remove the extension new_title="${new_title%.*}" # remove the extension
new_title="${new_title/% ([0-9][0-9][0-9][0-9])/}" # remove the year new_title="${new_title/% ([0-9][0-9][0-9][0-9])/}" # remove the year
...@@ -128,6 +138,18 @@ while IFS= read -rd '' file <&3; do ...@@ -128,6 +138,18 @@ while IFS= read -rd '' file <&3; do
new_title="$bts_prefix$new_title" new_title="$bts_prefix$new_title"
fi fi
# If this is a TV episode, remove the show name and season/episode
# number
if [[ "$new_title" =~ S[0-9]+E[0-9]+ ]]; then
new_title="${new_title##*S[0-9][0-9]E[0-9][0-9] - }"
fi
if [[ $flag_t -eq 1 && "$title" != "$new_title" ]]; then
print_filename_once
echo "Title does not match recommended title [$new_title]"
fi
if [[ $flag_f -eq 1 ]]; then
echo -n "Enter a title, or s to skip [$new_title]: " echo -n "Enter a title, or s to skip [$new_title]: "
read -e user_title read -e user_title
new_title="${user_title:-$new_title}" new_title="${user_title:-$new_title}"
......