Write M3U playlist with new videos.

This commit is contained in:
tastytea 2020-12-16 17:54:13 +01:00
parent 9c083ec36e
commit 442e31d2fd
1 changed files with 7 additions and 0 deletions

View File

@ -54,6 +54,7 @@ function main()
[[ -z "${ytdl_format}" ]] && local ytdl_format="best"
mkdir -p "${download_dir}"
files_before="$(find "${download_dir}" -type f)"
local -a feedlist=("${(@Q)${(z)$(read_feedlist)}}")
for feed in ${feedlist}; do
youtube-dl \
@ -64,6 +65,12 @@ function main()
"${ytdl_extra_args}" \
"${feed}"
done
files_after="$(find "${download_dir}" -type f)"
while read file; do
if [[ ! "${files_before}" =~ "${file}" ]]; then
echo "${file}" >> "${download_dir}/New_$(date +'%F_%R').m3u"
fi
done <<<"${files_after}"
find "${download_dir}" -type f -mtime +"${keep_for_days}" -delete
}