From c57facbdc27e7a096dcd056a95d3d0c692543090 Mon Sep 17 00:00:00 2001 From: Pablo Yaniz Date: Thu, 22 Dec 2022 20:34:50 -0600 Subject: [PATCH 1/3] added optional date to log file --- rffmpeg | 5 +++++ rffmpeg.yml.sample | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rffmpeg b/rffmpeg index 60d769b..ec7dc9e 100755 --- a/rffmpeg +++ b/rffmpeg @@ -108,6 +108,11 @@ def load_config(): # Parse the keys from the logging group config["log_to_file"] = config_logging.get("log_to_file", True) config["logfile"] = config_logging.get("logfile", "/var/log/jellyfin/rffmpeg.log") + config["logfiledated"] = config_logging.get("logfiledated", False) + if config["logfiledated"] is True: + config["logfile"] = config_logging.get("logfile", "/var/log/jellyfin/"+ (datetime.today()).strftime('%Y%m%d') +"_rffmpeg.log") + else: + config["logfile"] = config_logging.get("logfile", "/var/log/jellyfin/rffmpeg.log") config["logdebug"] = config_logging.get("debug", False) # Parse the keys from the state group diff --git a/rffmpeg.yml.sample b/rffmpeg.yml.sample index d5b4602..21aaf8b 100644 --- a/rffmpeg.yml.sample +++ b/rffmpeg.yml.sample @@ -15,7 +15,10 @@ rffmpeg: # Log messages to this file. # Ensure the user running rffmpeg can write to this directory. #logfile: "/var/log/jellyfin/rffmpeg.log" - + + # You can add the date to the logfile if you prefer to have one file per day. + #logfiledated: false + # Show debugging messages #debug: false From 9b2ab0c59a64e53fa8f88e5c9d21418922eebe2d Mon Sep 17 00:00:00 2001 From: Pablo Yaniz Date: Thu, 22 Dec 2022 21:05:54 -0600 Subject: [PATCH 2/3] added dated log functionality --- rffmpeg | 1 + 1 file changed, 1 insertion(+) diff --git a/rffmpeg b/rffmpeg index ec7dc9e..bf1f2b5 100755 --- a/rffmpeg +++ b/rffmpeg @@ -35,6 +35,7 @@ from re import search from sqlite3 import connect as sqlite_connect from subprocess import run, PIPE from time import sleep +from datetime import datetime # Set up the logger From 45f43353f5db7dc72b2785f0ffe2445b888f4b4e Mon Sep 17 00:00:00 2001 From: Pablo Yaniz Date: Fri, 23 Dec 2022 11:33:28 -0600 Subject: [PATCH 3/3] Reviewed functionality and implemented quality of code changes --- rffmpeg | 9 ++++----- rffmpeg.yml.sample | 9 +++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/rffmpeg b/rffmpeg index bf1f2b5..5010282 100755 --- a/rffmpeg +++ b/rffmpeg @@ -109,11 +109,10 @@ def load_config(): # Parse the keys from the logging group config["log_to_file"] = config_logging.get("log_to_file", True) config["logfile"] = config_logging.get("logfile", "/var/log/jellyfin/rffmpeg.log") - config["logfiledated"] = config_logging.get("logfiledated", False) - if config["logfiledated"] is True: - config["logfile"] = config_logging.get("logfile", "/var/log/jellyfin/"+ (datetime.today()).strftime('%Y%m%d') +"_rffmpeg.log") - else: - config["logfile"] = config_logging.get("logfile", "/var/log/jellyfin/rffmpeg.log") + config["datedlogfiles"] = config_logging.get("datedlogfiles", False) + if config["datedlogfiles"] is True: + config["datedlogdir"] = config_logging.get("datedlogdir", "/var/log/jellyfin") + config["logfile"] = f"{config['datedlogdir']}/{datetime.today().strftime('%Y%m%d')}_rffmpeg.log" config["logdebug"] = config_logging.get("debug", False) # Parse the keys from the state group diff --git a/rffmpeg.yml.sample b/rffmpeg.yml.sample index 21aaf8b..840c048 100644 --- a/rffmpeg.yml.sample +++ b/rffmpeg.yml.sample @@ -16,9 +16,14 @@ rffmpeg: # Ensure the user running rffmpeg can write to this directory. #logfile: "/var/log/jellyfin/rffmpeg.log" - # You can add the date to the logfile if you prefer to have one file per day. - #logfiledated: false + # Use a Jellyfin-logging compatible dated log format, e.g. "20221223_rffmpeg.log" + # Supersedes the "logfile" directive above + #datedlogfiles: false + # Use this base directory for Jellyfin-logging compatible dated log files if you enable "datedlogfiles" + # Set this to your Jellyfin logging directory if it differs from the default + #datedlogdir: /var/log/jellyfin + # Show debugging messages #debug: false