2025-05-21_08-24-14Z_Wednesday
This commit is contained in:
parent
e8c203debf
commit
b84ff7a4c8
@ -290,6 +290,12 @@ function check_variable_is_correct() {
|
|||||||
echo_error "The \"license_url\" variable is missing."
|
echo_error "The \"license_url\" variable is missing."
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
media)
|
||||||
|
if [ -z "${media}" ]
|
||||||
|
then
|
||||||
|
echo_error "The \"media\" variable is missing."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
outro_flac)
|
outro_flac)
|
||||||
if [[ ! -d "${outro_flac}" || -z "${outro_flac}" ]]
|
if [[ ! -d "${outro_flac}" || -z "${outro_flac}" ]]
|
||||||
then
|
then
|
||||||
@ -571,7 +577,7 @@ function get_episode_metadata() {
|
|||||||
shownotes_edited="${working_dir}/shownotes_edited.html"
|
shownotes_edited="${working_dir}/shownotes_edited.html"
|
||||||
|
|
||||||
hostid="$( jq --raw-output '.host.Host_ID' ${shownotes_json} )"
|
hostid="$( jq --raw-output '.host.Host_ID' ${shownotes_json} )"
|
||||||
host_name="$( jq --raw-output '.host.Host_Name' ${shownotes_json} )"
|
artist="$( jq --raw-output '.host.Host_Name' ${shownotes_json} )"
|
||||||
email="$( jq --raw-output '.host.Host_Email' ${shownotes_json} )"
|
email="$( jq --raw-output '.host.Host_Email' ${shownotes_json} )"
|
||||||
email_padded="$( echo $email | sed 's/@/.nospam@nospam./g' )"
|
email_padded="$( echo $email | sed 's/@/.nospam@nospam./g' )"
|
||||||
title="$( jq --raw-output '.episode.Title' ${shownotes_json} )"
|
title="$( jq --raw-output '.episode.Title' ${shownotes_json} )"
|
||||||
@ -579,7 +585,7 @@ function get_episode_metadata() {
|
|||||||
series_id="$( jq --raw-output '.episode.Series' ${shownotes_json} )"
|
series_id="$( jq --raw-output '.episode.Series' ${shownotes_json} )"
|
||||||
series_name="$( jq --raw-output '.episode.Series_Name' ${shownotes_json} )"
|
series_name="$( jq --raw-output '.episode.Series_Name' ${shownotes_json} )"
|
||||||
explicit="$( jq --raw-output '.episode.Explicit' ${shownotes_json} )"
|
explicit="$( jq --raw-output '.episode.Explicit' ${shownotes_json} )"
|
||||||
episode_license="$( jq --raw-output '.episode.Show_License' ${shownotes_json} )"
|
license="$( jq --raw-output '.episode.Show_License' ${shownotes_json} )"
|
||||||
ep_date="$( jq --raw-output '.metadata.Episode_Date' ${shownotes_json} )"
|
ep_date="$( jq --raw-output '.metadata.Episode_Date' ${shownotes_json} )"
|
||||||
ep_num="$( jq --raw-output '.metadata.Episode_Number' ${shownotes_json} )"
|
ep_num="$( jq --raw-output '.metadata.Episode_Number' ${shownotes_json} )"
|
||||||
key="$( jq --raw-output '.metadata.Key' ${shownotes_json} )"
|
key="$( jq --raw-output '.metadata.Key' ${shownotes_json} )"
|
||||||
@ -604,7 +610,7 @@ function get_episode_metadata() {
|
|||||||
</html>'
|
</html>'
|
||||||
) | sponge "${shownotes_html}"
|
) | sponge "${shownotes_html}"
|
||||||
|
|
||||||
episode_variables=( shownotes_json shownotes_html hostid host_name email title summary series_id series_name explicit episode_license ep_date ep_num tags host_license host_profile remote_media shownotes_json_sanatised )
|
episode_variables=( shownotes_json shownotes_html hostid artist email title summary series_id series_name explicit license ep_date ep_num tags host_license host_profile remote_media shownotes_json_sanatised )
|
||||||
|
|
||||||
for episode_variable in "${episode_variables[@]}"
|
for episode_variable in "${episode_variables[@]}"
|
||||||
do
|
do
|
||||||
@ -932,13 +938,13 @@ function generate_initial_report() {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><th>hostid</th><td>${hostid}</td></tr>
|
<tr><th>hostid</th><td>${hostid}</td></tr>
|
||||||
<tr><th>host_name</th><td>${host_name}</td></tr>
|
<tr><th>host_name</th><td>${artist}</td></tr>
|
||||||
<tr><th>title</th><td>${title}</td></tr>
|
<tr><th>title</th><td>${title}</td></tr>
|
||||||
<tr><th>summary</th><td>${summary}</td></tr>
|
<tr><th>summary</th><td>${summary}</td></tr>
|
||||||
<tr><th>series_id</th><td>${series_id}</td></tr>
|
<tr><th>series_id</th><td>${series_id}</td></tr>
|
||||||
<tr><th>series_name</th><td>${series_name}</td></tr>
|
<tr><th>series_name</th><td>${series_name}</td></tr>
|
||||||
<tr><th>explicit</th><td>${explicit}</td></tr>
|
<tr><th>explicit</th><td>${explicit}</td></tr>
|
||||||
<tr><th>episode_license</th><td>${episode_license}</td></tr>
|
<tr><th>episode_license</th><td>${license}</td></tr>
|
||||||
<tr><th>tags</th><td>${tags}</td></tr>
|
<tr><th>tags</th><td>${tags}</td></tr>
|
||||||
<tr><th>host_license</th><td>${host_license}</td></tr>
|
<tr><th>host_license</th><td>${host_license}</td></tr>
|
||||||
<tr><th>host_profile</th><td>${host_profile}</td></tr>
|
<tr><th>host_profile</th><td>${host_profile}</td></tr>
|
||||||
@ -1091,10 +1097,10 @@ function post_show_to_hpr_db() {
|
|||||||
series_id=${series_id}
|
series_id=${series_id}
|
||||||
series_name=${series_name}
|
series_name=${series_name}
|
||||||
explicit=${explicit}
|
explicit=${explicit}
|
||||||
episode_license=${episode_license}
|
episode_license=${license}
|
||||||
tags=${tags}
|
tags=${tags}
|
||||||
hostid=${hostid}
|
hostid=${hostid}
|
||||||
host_name=${host_name}
|
host_name=${artist}
|
||||||
host_license=${host_license}
|
host_license=${host_license}
|
||||||
host_profile=${host_profile_encoded}
|
host_profile=${host_profile_encoded}
|
||||||
notes=REMOVED"
|
notes=REMOVED"
|
||||||
@ -1110,10 +1116,10 @@ function post_show_to_hpr_db() {
|
|||||||
\"series_id\": \"${series_id}\",
|
\"series_id\": \"${series_id}\",
|
||||||
\"series_name\": \"${series_name}\",
|
\"series_name\": \"${series_name}\",
|
||||||
\"explicit\": \"${explicit}\",
|
\"explicit\": \"${explicit}\",
|
||||||
\"episode_license\": \"${episode_license}\",
|
\"episode_license\": \"${license}\",
|
||||||
\"tags\": \"${tags}\",
|
\"tags\": \"${tags}\",
|
||||||
\"hostid\": \"${hostid}\",
|
\"hostid\": \"${hostid}\",
|
||||||
\"host_name\": \"${host_name}\",
|
\"host_name\": \"${artist}\",
|
||||||
\"host_license\": \"${host_license}\",
|
\"host_license\": \"${host_license}\",
|
||||||
\"host_profile\": \"${host_profile_encoded}\",
|
\"host_profile\": \"${host_profile_encoded}\",
|
||||||
\"notes\": \"${notes}\"
|
\"notes\": \"${notes}\"
|
||||||
@ -1252,6 +1258,8 @@ function generate_parent_audio() {
|
|||||||
function generate_derived_media() {
|
function generate_derived_media() {
|
||||||
|
|
||||||
echo_debug "Generating derived audio. generate_derived_media()"
|
echo_debug "Generating derived audio. generate_derived_media()"
|
||||||
|
|
||||||
|
check_variable_is_correct media working_dir ep_num title artist license
|
||||||
|
|
||||||
if [[ ! -s "${working_dir}/processing/episode_final.flac" ]]
|
if [[ ! -s "${working_dir}/processing/episode_final.flac" ]]
|
||||||
then
|
then
|
||||||
@ -1259,8 +1267,10 @@ function generate_derived_media() {
|
|||||||
echo_error "The final cut is not available."
|
echo_error "The final cut is not available."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
episode_comment="$( jq --raw-output '.comment' "${episode_summary_json}" )"
|
comment="$( jq --raw-output '.comment' "${episode_summary_json}" )"
|
||||||
episode_year="$( echo "${ep_date}" | cut -c -4 )"
|
year="$( echo "${ep_date}" | cut -c -4 )"
|
||||||
|
|
||||||
|
check_variable_is_correct comment year
|
||||||
|
|
||||||
# https://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata
|
# https://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata
|
||||||
|
|
||||||
@ -1269,18 +1279,18 @@ function generate_derived_media() {
|
|||||||
echo_debug "Generating \"hpr${ep_num}.${extension}\"."
|
echo_debug "Generating \"hpr${ep_num}.${extension}\"."
|
||||||
ffmpeg -hide_banner -loglevel error -y -i "${working_dir}/processing/episode_final.flac" \
|
ffmpeg -hide_banner -loglevel error -y -i "${working_dir}/processing/episode_final.flac" \
|
||||||
-metadata title="${title}" \
|
-metadata title="${title}" \
|
||||||
-metadata artist="${host_name}" \
|
-metadata artist="${artist}" \
|
||||||
-metadata author="${host_name}" \
|
-metadata author="${artist}" \
|
||||||
-metadata album="Hacker Public Radio" \
|
-metadata album="Hacker Public Radio" \
|
||||||
-metadata comment="${episode_comment} The license is ${episode_license}" \
|
-metadata comment="${comment} The license is ${license}" \
|
||||||
-metadata year="${episode_year}" \
|
-metadata year="${year}" \
|
||||||
-metadata track="${ep_num}" \
|
-metadata track="${ep_num}" \
|
||||||
-metadata genre="Podcast" \
|
-metadata genre="Podcast" \
|
||||||
-metadata language="English" \
|
-metadata language="English" \
|
||||||
-metadata copyright="${episode_license}" \
|
-metadata copyright="${license}" \
|
||||||
"${working_dir}/hpr${ep_num}.${extension}"
|
"${working_dir}/hpr${ep_num}.${extension}"
|
||||||
|
|
||||||
fix_tags -album="Hacker Public Radio" -artist="${host_name}" -comment="${episode_comment} The license is ${episode_license}" -genre="Podcast" -title="${title}" -track="${ep_num}" -year="${episode_year}" "${working_dir}/hpr${ep_num}.${extension}"
|
fix_tags -album="Hacker Public Radio" -artist="${artist}" -comment="${comment} The license is ${license}" -genre="Podcast" -title="${title}" -track="${ep_num}" -year="${year}" "${working_dir}/hpr${ep_num}.${extension}"
|
||||||
|
|
||||||
if [[ ! -s "${working_dir}/hpr${ep_num}.${extension}" ]]
|
if [[ ! -s "${working_dir}/hpr${ep_num}.${extension}" ]]
|
||||||
then
|
then
|
||||||
@ -1290,12 +1300,21 @@ function generate_derived_media() {
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
lengths=$( for extension in flac wav mp3 ogg opus
|
||||||
|
do
|
||||||
|
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}'
|
||||||
|
done | sort | uniq | wc -l )
|
||||||
|
if [ "${lengths}" -ne "1" ]
|
||||||
|
then
|
||||||
|
echo_error "The duration of the derived media is not correct."
|
||||||
|
fi
|
||||||
|
|
||||||
cp -v "${media}" "${working_dir}/hpr${ep_num}_source.${media##*.}"
|
cp -v "${media}" "${working_dir}/hpr${ep_num}_source.${media##*.}"
|
||||||
|
|
||||||
if [[ ! -s "${working_dir}/hpr${ep_num}_source.${media##*.}" ]]
|
if [[ ! -s "${working_dir}/hpr${ep_num}_source.${media##*.}" ]]
|
||||||
then
|
then
|
||||||
echo_error "Failed to copy \"${working_dir}/hpr${ep_num}_source.${media##*.}\"."
|
|
||||||
ls -al "${working_dir}/hpr${ep_num}_source.${media##*.}"
|
ls -al "${working_dir}/hpr${ep_num}_source.${media##*.}"
|
||||||
|
echo_error "Failed to copy \"${working_dir}/hpr${ep_num}_source.${media##*.}\"."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user