fix: Remove leftover videos from other channels

This commit is contained in:
Carlos Solís 2025-06-08 22:29:52 +00:00
parent f301b3ecb8
commit b91694e1cf

View file

@ -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"