From 442e31d2fdd6dfb1060a6f3d9f99f70a407d0143 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 16 Dec 2020 17:54:13 +0100 Subject: [PATCH] Write M3U playlist with new videos. --- download-yt-feeds | 7 +++++++ 1 file changed, 7 insertions(+) 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 }