Used long argument names for xmlstarlet
This commit is contained in:
@@ -92,7 +92,7 @@ function program_checks() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
is_installed audio2image.bash awk base64 cat csvtojson curl date eval extract_images ffprobe ffmpeg file find fix_tags grep head jq kate magick mediainfo mv realpath remove-image.pl rsync seamonkey sed sed sort sponge ssh touch touch wget hpr-check-ccdn-links
|
is_installed audio2image.bash awk base64 cat csvtojson curl date eval extract_images ffprobe ffmpeg file find fix_tags grep head jq kate magick mediainfo mv realpath remove-image.pl rsync seamonkey sed sed sort sponge ssh touch touch wget hpr-check-ccdn-links xmlstarlet
|
||||||
|
|
||||||
for arg in $*
|
for arg in $*
|
||||||
do
|
do
|
||||||
@@ -870,7 +870,7 @@ function extract_images_brute_force() {
|
|||||||
echo -n "$image" | base64 -di > ${this_image}
|
echo -n "$image" | base64 -di > ${this_image}
|
||||||
this_ext="$( file --mime-type ${this_image} | awk -F '/' '{print $NF}' )"
|
this_ext="$( file --mime-type ${this_image} | awk -F '/' '{print $NF}' )"
|
||||||
mv -v "${this_image}" "${this_image}.${this_ext}"
|
mv -v "${this_image}" "${this_image}.${this_ext}"
|
||||||
this_width="$( mediainfo "${this_image}.${this_ext}" | grep Width | awk -F ': | pixels' '{print $2}' | sed 's/ //g' )"
|
this_width="$( mediainfo --Full --Output=XML "${this_image}.${this_ext}" | xmlstarlet sel --text --template --match '/_:MediaInfo/_:media/_:track[@type="Image"][1]' --value-of '_:Width' --nl - )"
|
||||||
if [ "${this_width}" -gt "400" ]
|
if [ "${this_width}" -gt "400" ]
|
||||||
then
|
then
|
||||||
echo_debug "Generating thumbnail for embedded image \"${this_image}.${this_ext}\"."
|
echo_debug "Generating thumbnail for embedded image \"${this_image}.${this_ext}\"."
|
||||||
@@ -890,7 +890,7 @@ function extract_images_brute_force() {
|
|||||||
then
|
then
|
||||||
this_ext="$( file --mime-type ${this_image} | awk -F '/' '{print $NF}' )"
|
this_ext="$( file --mime-type ${this_image} | awk -F '/' '{print $NF}' )"
|
||||||
mv -v "${this_image%.*}" "${this_image}.${this_ext}"
|
mv -v "${this_image%.*}" "${this_image}.${this_ext}"
|
||||||
this_width="$( mediainfo "${this_image}.${this_ext}" | grep Width | awk -F ': | pixels' '{print $2}' | sed 's/ //g' )"
|
this_width="$( mediainfo --Full --Output=XML "${this_image}.${this_ext}" | xmlstarlet sel --text --template --match '/_:MediaInfo/_:media/_:track[@type="Image"][1]' --value-of '_:Width' --nl - )"
|
||||||
if [ "${this_width}" -gt "400" ]
|
if [ "${this_width}" -gt "400" ]
|
||||||
then
|
then
|
||||||
echo_debug "Generating thumbnail for external image \"${this_image}.${this_ext}\"."
|
echo_debug "Generating thumbnail for external image \"${this_image}.${this_ext}\"."
|
||||||
@@ -1556,10 +1556,9 @@ function generate_derived_media() {
|
|||||||
|
|
||||||
check_variable_is_correct episode_intro_flac outro_flac media duration
|
check_variable_is_correct episode_intro_flac outro_flac media duration
|
||||||
|
|
||||||
|
intro_duration="$( mediainfo --Output=XML --Full "${episode_intro_flac}" | xmlstarlet sel --text --template --match '/_:MediaInfo/_:media/_:track[@type="Audio"]' --value-of '_:Duration' --nl | awk -F '.' '{print $1}' )"
|
||||||
intro_duration="$( mediainfo --Output=XML --Full "${episode_intro_flac}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )"
|
outro_duration="$( mediainfo --Output=XML --Full "${outro_flac}" | xmlstarlet sel --text --template --match '/_:MediaInfo/_:media/_:track[@type="Audio"]' --value-of '_:Duration' --nl | awk -F '.' '{print $1}' )"
|
||||||
outro_duration="$( mediainfo --Output=XML --Full "${outro_flac}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )"
|
source_duration="$( mediainfo --Output=XML --Full "${media}" | xmlstarlet sel --text --template --match '/_:MediaInfo/_:media/_:track[@type="Audio"]' --value-of '_:Duration' --nl | awk -F '.' '{print $1}' )"
|
||||||
source_duration="$( mediainfo --Output=XML --Full "${media}" | xmlstarlet sel -T -t -m '/_:MediaInfo/_:media/_:track[@type="Audio"]' -v '_:Duration' -n | awk -F '.' '{print $1}' )"
|
|
||||||
expected_duration=$(( ${intro_duration} + ${duration} + ${outro_duration} ))
|
expected_duration=$(( ${intro_duration} + ${duration} + ${outro_duration} ))
|
||||||
check_variable_is_correct intro_duration outro_duration source_duration expected_duration
|
check_variable_is_correct intro_duration outro_duration source_duration expected_duration
|
||||||
|
|
||||||
@@ -1567,7 +1566,7 @@ function generate_derived_media() {
|
|||||||
|
|
||||||
for extension in "${audio_formats[@]}"
|
for extension in "${audio_formats[@]}"
|
||||||
do
|
do
|
||||||
this_duration=$( mediainfo --full --Output=XML "${working_dir}/hpr${ep_num}.${extension}" | xmlstarlet sel -T -t -m "_:MediaInfo/_:media/_:track[@type='Audio']/_:Duration[1]" -v "." -n - | awk -F '.' '{print $1}' )
|
this_duration=$( mediainfo --full --Output=XML "${working_dir}/hpr${ep_num}.${extension}" | xmlstarlet sel --text --template --match "_:MediaInfo/_:media/_:track[@type='Audio']/_:Duration[1]" --value-of "." --nl - | awk -F '.' '{print $1}' )
|
||||||
if [ $( abs_diff "${this_duration}" "${expected_duration}" ) -le "${acceptable_duration_difference}" ]
|
if [ $( abs_diff "${this_duration}" "${expected_duration}" ) -le "${acceptable_duration_difference}" ]
|
||||||
then
|
then
|
||||||
echo_debug "The file \"hpr${ep_num}.${extension}\" duration of ${this_duration} is close enough to ${expected_duration}"
|
echo_debug "The file \"hpr${ep_num}.${extension}\" duration of ${this_duration} is close enough to ${expected_duration}"
|
||||||
@@ -2197,7 +2196,7 @@ function upload_files_to_the_internet_archive() {
|
|||||||
for this_file in $( jq --raw-output ".hpr${ep_num} | keys | @tsv" "${files_json}" )
|
for this_file in $( jq --raw-output ".hpr${ep_num} | keys | @tsv" "${files_json}" )
|
||||||
do
|
do
|
||||||
db_file_info="$( jq --raw-output ".hpr${ep_num}.[] | select(.filename==\"${this_file}\") | [ .filename, .size, .sha1sum ] | @tsv" "${files_json}" )"
|
db_file_info="$( jq --raw-output ".hpr${ep_num}.[] | select(.filename==\"${this_file}\") | [ .filename, .size, .sha1sum ] | @tsv" "${files_json}" )"
|
||||||
ia_file_info="$( xmlstarlet sel -T -t -m "/files/file[@name=\"${this_file}\"]" -v "concat(@name, '→', size, '→', sha1)" -n "${files_xml}" | sed 's/→/\t/g' )"
|
ia_file_info="$( xmlstarlet sel --text --template --match "/files/file[@name=\"${this_file}\"]" --value-of "concat(@name, '→', size, '→', sha1)" --nl "${files_xml}" | sed 's/→/\t/g' )"
|
||||||
if [ -z "${db_file_info}" ]
|
if [ -z "${db_file_info}" ]
|
||||||
then
|
then
|
||||||
echo_error "The information for \"${this_file}\" could not be found in \"${files_json}\""
|
echo_error "The information for \"${this_file}\" could not be found in \"${files_json}\""
|
||||||
|
|||||||
Reference in New Issue
Block a user