From 529bf22ba38931474a68881b5e28bc537e32cfd3 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 22 Jan 2023 12:38:26 -0700 Subject: [PATCH] fix Inappropriate ioctl for device --- Example systemd Service.md | 12 ++++++++++-- downloader.py | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Example systemd Service.md b/Example systemd Service.md index 3853718..77d14a2 100644 --- a/Example systemd Service.md +++ b/Example systemd Service.md @@ -16,9 +16,17 @@ Group=user WantedBy=multi-user.target ``` -Now start the service +Now start the service: ```bash -chmod +x /home/user/youtubedl-daemon.sh sudo systemctl daemon-reload sudo systemctl enable --now youtube-dl ``` + + + +You can watch the process with: + +```bash +sudo journalctl -b -u youtube-dl.service +``` + diff --git a/downloader.py b/downloader.py index cf42cb2..6127f11 100755 --- a/downloader.py +++ b/downloader.py @@ -229,7 +229,9 @@ while True: if len(download_queue): # Don't mess with multiprocessing if all videos are already downloaded with Pool(processes=args.threads) as pool: - status_bar.set_description_str('=' * os.get_terminal_size()[0]) + # Doesn't work if not connected to a terminal + if sys.stdout.isatty(): + status_bar.set_description_str('=' * os.get_terminal_size()[0]) # OSError: [Errno 25] Inappropriate ioctl for device logger.info('Starting downloads...') for result in pool.imap_unordered(download_video, ((video, {