diff --git a/download-yt-feeds b/download-yt-feeds index a1933cc..4c0d9aa 100644 --- a/download-yt-feeds +++ b/download-yt-feeds @@ -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 }