Added SQL rss feed, Fixed regex for image, and scp files to hpr server
This commit is contained in:
		| @@ -869,7 +869,7 @@ function extract_images_brute_force() { | ||||
|   # Download referenced images | ||||
|   image_count_external="1" | ||||
|  | ||||
|   for image in $( grep --color=never --perl-regexp --only-matching '<img.*src.*http.*>' "${shownotes_html}" | awk -F 'src=' '{print $2}' | awk -F '"' '{print $2}' ) | ||||
|   for image in $( grep --color=never --perl-regexp --only-matching '<img.*src.*http.*://.*>' "${shownotes_html}" | awk -F 'src=' '{print $2}' | awk -F '"' '{print $2}' ) | ||||
|   do | ||||
|     this_image="${working_dir}/hpr${ep_num}_image_ext_${image_count_external}" | ||||
|     wget "${image}" --output-document=${this_image} | ||||
| @@ -1967,7 +1967,7 @@ function register_assets() { | ||||
| } | ||||
|  | ||||
| ################################################# | ||||
| # Register the assets with the hpr database | ||||
| # Copy the files to the origin server | ||||
|  | ||||
| function copy_files_to_origin_server() { | ||||
|  | ||||
| @@ -2013,6 +2013,48 @@ function copy_files_to_origin_server() { | ||||
|   done | ||||
| } | ||||
|  | ||||
| ################################################# | ||||
| # Copy the images to the hpr server | ||||
|  | ||||
| function copy_files_to_hpr_server() { | ||||
|  | ||||
|   echo_debug "Copying the files to the hpr server. copy_files_to_hpr_server()" | ||||
|  | ||||
|   check_variable_is_correct working_dir ep_num | ||||
|  | ||||
|   # Get the file list from the HPR db | ||||
|   if [ -z "${files_json}" ] | ||||
|   then | ||||
|     files_json="${working_dir}/hpr${ep_num}_files.json" | ||||
|   fi | ||||
|  | ||||
|   if [ -s "${files_json}" ] | ||||
|   then | ||||
|     echo_debug "Removing stale \"files_json\" file \"${files_json}\"." | ||||
|     rm -v "${files_json}" | ||||
|   fi | ||||
|    | ||||
|   echo_debug "Getting the \"files_json\" file from the HPR site." | ||||
|   if [ "$( curl --silent --netrc --write-out '%{http_code}'  https://hub.hackerpublicradio.org/cms/assets.php?id=${ep_num} --output "${files_json}" )" != 200 ] | ||||
|   then | ||||
|     echo_error "The Episode hpr${ep_num} has not been posted" | ||||
|   fi | ||||
|   check_variable_is_correct files_json | ||||
|  | ||||
|   ssh hpr -t "mkdir -v hackerpublicradio.org/public_html/eps/hpr${ep_num}" | ||||
|    | ||||
|   for this_file in $( jq --raw-output ".hpr${ep_num} | keys | @tsv" "${files_json}" ) | ||||
|   do | ||||
|     skip_file="$( echo "$this_file" | grep --count --perl-regexp "hpr${ep_num}.flac|hpr${ep_num}.mp3|hpr${ep_num}.ogg|hpr${ep_num}.opus|hpr${ep_num}.spx|hpr${ep_num}.srt|hpr${ep_num}.txt|hpr${ep_num}.wav" )" | ||||
|     if [ "${skip_file}" -eq "1" ] | ||||
|     then | ||||
|       continue | ||||
|     fi | ||||
|     scp "$this_file" hpr:hackerpublicradio.org/public_html/eps/hpr${ep_num}/ | ||||
|   done | ||||
|  | ||||
| } | ||||
|  | ||||
| ################################################# | ||||
| # Send the derived files to the server borg to be sent to borg | ||||
|  | ||||
| @@ -2334,6 +2376,8 @@ copy_files_to_origin_server | ||||
|  | ||||
| check_variable_is_correct working_dir ep_num shownotes_edited | ||||
|  | ||||
| copy_files_to_hpr_server | ||||
|  | ||||
| copy_derived_files_to_borg | ||||
|  | ||||
| create_item_on_the_internet_archive | ||||
|   | ||||
		Reference in New Issue
	
	Block a user