41 lines
2.6 KiB
Bash
41 lines
2.6 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/
|
||
|
#============================================================
|
||
|
|
||
|
upload_dir="/home/hpr/upload"
|
||
|
reserve_dir="/home/hpr/reserve"
|
||
|
|
||
|
while read reserve_show_dir
|
||
|
do
|
||
|
echo "Processing \"${reserve_show_dir}\""
|
||
|
shownotes="${reserve_show_dir}/shownotes.json"
|
||
|
if [ ! -s "${shownotes}" ]
|
||
|
then
|
||
|
echo "ERROR: \"${shownotes}\" not found"
|
||
|
exit 1
|
||
|
fi
|
||
|
Host_ID="$( jq --raw-output '.host.Host_ID' "${shownotes}" )"
|
||
|
Host_Name="$( jq --raw-output '.host.Host_Name' "${shownotes}" | sed -e 's/[^A-Za-z0-9]/_/g' -e 's/__/_/g' )"
|
||
|
Key="$( jq --raw-output '.metadata.Key' "${shownotes}" )"
|
||
|
Timestamp="$( jq --raw-output '.metadata.Timestamp' "${shownotes}" )"
|
||
|
Title="$( jq --raw-output '.episode.Title' "${shownotes}" | sed -e 's/[^A-Za-z0-9]/_/g' -e 's/__/_/g')"
|
||
|
Timestamp_Epoch="$( \date -u +%s -d "${Timestamp}" )"
|
||
|
#hostid="$( jq --raw-output '.host.Host_ID + "_" + .metadata.Key + "_" + .episode.Title' "${shownotes}" )"
|
||
|
mv -v "${reserve_show_dir}" "${reserve_dir}/${Timestamp_Epoch}_${Host_ID}_${Key}_${Host_Name}_${Title}"
|
||
|
done < <( find "${upload_dir}" -type d -iname "*_9999_*" )
|
||
|
|
||
|
#ls -al "${reserve_dir}"
|
||
|
|
||
|
# drwxr-xr-x. 1 ken ken 136 Jul 2 19:33 1688318808_198_321136810af5473fb011ae91d0e8b49264a1b35871d65_Ahuka_Audacity-Update
|
||
|
# drwxr-xr-x. 1 ken ken 148 Jul 2 19:42 1688319300_198_562721ff5261ef02277be37ade18bae364a1b544c445e_Ahuka_Creative_Commons_Search_Engine
|
||
|
# drwxr-xr-x. 1 ken ken 84 Jul 3 22:54 1688416961_391_aaf8e86be56a78cfd60e611af93d9d2e64a332c1b9572_Sgoti_confuses_everyone_with_bash_nonsense
|
||
|
# drwxr-xr-x. 1 ken ken 84 Jul 5 20:58 1688583277_391_b04748b6e57e5f72c7853be33889f3ce64a5bc6dca8e5_Sgoti_talks_about_driving_in_the_state_of_Virginia
|
||
|
# drwxr-xr-x. 1 ken ken 84 Jul 6 00:34 1688595802_391_6dffbcaf766aedaffed2a61b6a648f3c64a5ed5ac6341_Sgoti_rambles_about_a_video_game_called_GrimDawn
|
||
|
# drwxr-xr-x. 1 ken ken 84 Jul 9 20:25 1688926358_391_1c3ffa201045c40311b536ee4ef4a62864aaf8961d692_Sgoti_My_road_recording_setup
|
||
|
# drwxr-xr-x. 1 ken ken 84 Sep 8 07:30 1694150656_391_8504d8543e1cc8760b76fff27c5d1f4b64fab00057c8e_Some_Guy_On_The_Internet_Sextortion_Good_Heavens
|
||
|
|
||
|
# drwxr-xr-x. 1 ken ken 98 Oct 24 16:22 1698156039_9999_1970-01-01_6c585b3db2bfb5fc70216620ac97c0d56537ce07155a4
|
||
|
# drwxr-xr-x. 1 ken ken 110 Oct 24 16:25 1698157365_9999_1970-01-01_f8d61b32850177939428764c53dfb2006537d3353a95e
|
||
|
# drwxr-xr-x. 1 ken ken 92 Oct 24 16:26 1698157513_9999_1970-01-01_a85b7a7febda983fdeb8ba1c165736146537d3c93d27d
|
||
|
# drwxr-xr-x. 1 ken ken 96 Oct 24 16:28 1698157609_9999_1970-01-01_a85414f9074042bf14db0e56f62cc25d6537d4293c86e
|