From 84aeafa0488a3fb68e786c63124dc52fad155f2d Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 22 Jan 2023 12:29:44 -0700 Subject: [PATCH] show warning msg if in daemon and silent mode --- Example systemd Service.md | 13 +++---------- downloader.py | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Example systemd Service.md b/Example systemd Service.md index 16f646a..3853718 100644 --- a/Example systemd Service.md +++ b/Example systemd Service.md @@ -1,21 +1,14 @@ # Example systemd Service -`/home/user/youtubedl-daemon.sh` -```bash -#!/bin/bash -/usr/bin/python3 /home/user/automated-youtube-dl/downloader.py --daemon --silence-errors --sleep 60 "https://www.youtube.com/playlist?list=example12345" "/mnt/nfs/archive/YouTube/Example Playlist/" -``` +`/etc/systemd/system/youtube-dl.service` - - -`/lib/systemd/system/youtubedl.service` ```systemd [Unit] Description=Youtube-DL Daemon After=network-online.target [Service] -ExecStart=/home/user/youtubedl-daemon.sh +ExecStart=/usr/bin/python3 /home/user/automated-youtube-dl/downloader.py --daemon --silence-errors --sleep 60 "https://www.youtube.com/playlist?list=example12345" "/mnt/nfs/archive/YouTube/Example Playlist/" User=user Group=user @@ -27,5 +20,5 @@ Now start the service ```bash chmod +x /home/user/youtubedl-daemon.sh sudo systemctl daemon-reload -sudo systemctl enable --now youtubedl +sudo systemctl enable --now youtube-dl ``` diff --git a/downloader.py b/downloader.py index f668f04..cf42cb2 100755 --- a/downloader.py +++ b/downloader.py @@ -251,11 +251,11 @@ while True: logger.error(line) else: playlist_bar.write(line) - elif not args.silence_errors and args.daemon: - logger.error(f"{result['video_id']} failed due to error.") if len(result['video_error_logger_msg']): errored_videos += 1 + if args.silence_errors and args.daemon: + logger.error(f"{result['video_id']} failed due to error.") # for line in result['status_msg']: # playlist_bar.write(line)