Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dotfiles
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Chris
dotfiles
Commits
2786e633
Commit
2786e633
authored
Nov 06, 2019
by
Chris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an option to the mkvanalyze tool to fix non-recommended titles
parent
95588a55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
18 deletions
+34
-18
bin/mkvanalyze
bin/mkvanalyze
+34
-18
No files found.
bin/mkvanalyze
View file @
2786e633
...
...
@@ -36,8 +36,11 @@ Options:
-f
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>
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.
-d
...
...
@@ -55,14 +58,18 @@ EOF
# Parse command options
flag_f
=
0
flag_t
=
0
flag_d
=
0
flag_p
=
0
bts_prefix
=
''
while
getopts
'fb:dph'
flag
;
do
while
getopts
'f
t
b:dph'
flag
;
do
case
"
${
flag
}
"
in
f
)
flag_f
=
1
;;
t
)
flag_t
=
1
;;
b
)
bts_prefix
=
"
$OPTARG
"
;;
...
...
@@ -115,25 +122,34 @@ while IFS= read -rd '' file <&3; do
# Check title
title
=
$(
echo
"
$file_info
"
|
grep
'Title:'
|
sed
's/.* Title: \(.*\)$/\1/'
)
if
[[
-z
"
$title
"
]]
;
then
print_filename_once
echo
"Title Missing"
if
[[
$flag_f
-eq
1
]]
;
then
new_title
=
"
$(
basename
"
$file
"
)
"
# get the filename
new_title
=
"
${
new_title
%.*
}
"
# remove the extension
new_title
=
"
${
new_title
/% ([0-9][0-9][0-9][0-9])/
}
"
# remove the year
if
[[
-z
"
$title
"
||
$flag_t
-eq
1
]]
;
then
if
[[
-z
"
$title
"
]]
;
then
print_filename_once
echo
"Title Missing"
fi
# If this file is a 'Behind The Scenes' file add the prefix
if
[[
-n
$bts_prefix
&&
"
$(
dirname
"
$file
"
)
"
=
~
[
Bb]ehind
\
[
Tt]he
\
[
Ss]cenes
$
]]
;
then
new_title
=
"
$bts_prefix$new_title
"
fi
# Generate a new title to recommend
new_title
=
"
$(
basename
"
$file
"
)
"
# get the filename
new_title
=
"
${
new_title
%.*
}
"
# remove the extension
new_title
=
"
${
new_title
/% ([0-9][0-9][0-9][0-9])/
}
"
# remove the year
# 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 this file is a 'Behind The Scenes' file add the prefix
if
[[
-n
$bts_prefix
&&
"
$(
dirname
"
$file
"
)
"
=
~
[
Bb]ehind
\
[
Tt]he
\
[
Ss]cenes
$
]]
;
then
new_title
=
"
$bts_prefix$new_title
"
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
]: "
read
-e
user_title
new_title
=
"
${
user_title
:-
$new_title
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment