diff --git a/youtube-download-channel.sh b/youtube-download-channel.sh index d9e7cb7..57ddbd8 100755 --- a/youtube-download-channel.sh +++ b/youtube-download-channel.sh @@ -75,7 +75,7 @@ fi find . -type f -iname "*.info.json" -exec ls -t {} + | while read -r xp; do x="${xp##./}" df=$(jq -rc '.timestamp' "${subfolder}/${x}") - touch "${subfolder}/${x}" -d "@${df}" + touch "${subfolder}/${x}" -d "${df}" #TODO: Read the date directly #df=$(jq -rc '.timestamp' "${subfolder}/${x}") #if [[ "${breaktime}" =~ ^[0-9]+$ ]]; then @@ -120,6 +120,10 @@ if [[ ${enablecsv} = "1" || ${enabledb} = "1" ]]; then rm "${file}" fi fi + if [[ "${channel}" != "subscriptions" && $(jq -rc ".uploader_id" "${file}") != "@${channel}" ]]; then + echo "Video ${file} not uploaded from ${channel}, removing..." + rm "${file}" + fi if [[ ${enabledb} = "1" ]]; then if [[ -f "${file}" ]]; then jq -c "{\"videoId\": .id, \"title\": .title, \"author\": .uploader, \"authorId\": .channel_id, \"lengthSeconds\": .duration, \"published\": ( .timestamp * 1000 ), \"timeAdded\": $(date +%s)$(date +%N | cut -c-3), \"playlistItemId\": \"$(cat /proc/sys/kernel/random/uuid)\", \"type\": \"video\"}" "${subfolder}/${file}" | tee -a "/tmp/${channel}.db"