fix: Prevent loss of data already downloaded if interrupted
This commit is contained in:
parent
c67577c624
commit
ddb309d21a
1 changed files with 8 additions and 4 deletions
|
@ -111,7 +111,6 @@ find "${temporary}" -type f -iname "*.info.json" | while read -r x; do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -f "${x}" ]]; then
|
if [[ -f "${x}" ]]; then
|
||||||
echo "youtube $(jq -cr '.id' "${x}")" >>"${archive}"
|
|
||||||
if [[ ${enablecsv} = "1" ]]; then
|
if [[ ${enablecsv} = "1" ]]; then
|
||||||
jq -c '[.upload_date, .timestamp, .uploader , .title, .webpage_url]' "${x}" | while read -r i; do
|
jq -c '[.upload_date, .timestamp, .uploader , .title, .webpage_url]' "${x}" | while read -r i; do
|
||||||
echo "${i}" | sed -e "s/^\[//g" -e "s/\]$//g" -e "s/\\\\\"/"/g" >>"${csv}"
|
echo "${i}" | sed -e "s/^\[//g" -e "s/\]$//g" -e "s/\\\\\"/"/g" >>"${csv}"
|
||||||
|
@ -161,7 +160,12 @@ if [[ ${enablecsv} = "1" ]]; then
|
||||||
mv "/tmp/${channel}.csv" "${csv}"
|
mv "/tmp/${channel}.csv" "${csv}"
|
||||||
rm "/tmp/${channel}-without-header.csv"
|
rm "/tmp/${channel}-without-header.csv"
|
||||||
fi
|
fi
|
||||||
sort "${archive}" | uniq >"/tmp/${channel}.txt"
|
|
||||||
mv "/tmp/${channel}.txt" "${archive}"
|
|
||||||
cd "${temporary}" || exit
|
cd "${temporary}" || exit
|
||||||
tar -cvp -I "zstd -T0" -f "${subfolder}/${channel}.tar.zst" -- *.info.json && rm -- *.info.json && rm -rf "${temporary}"
|
tar -cvp -I "zstd -T0" -f "${subfolder}/${channel}.tar.zst" -- *.info.json
|
||||||
|
find "${temporary}" -type f -iname "*.info.json" | while read -r x; do
|
||||||
|
if [[ -f "${x}" ]]; then
|
||||||
|
echo "youtube $(jq -cr '.id' "${x}")" >>"${archive}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sort "${archive}" | uniq >"/tmp/${channel}.txt" && mv "/tmp/${channel}.txt" "${archive}"
|
||||||
|
rm -rf "${temporary}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue