Skip to content

Commit

Permalink
Fixes paths for files when running cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbc committed Apr 21, 2023
1 parent f677284 commit 221bb03
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plexorcist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
"""Main Plexorcist execution file!"""

import os
import configparser
import functools
from datetime import datetime, timedelta
Expand All @@ -10,6 +11,12 @@
import requests
import xmltodict

# Get the absolute path of the directory containing the script
script_dir = os.path.dirname(os.path.abspath(__file__))

# Construct the absolute path of the INI file
config_file_path = os.path.join(script_dir, "plexorcist.ini")

# Read the config file
config = configparser.ConfigParser()
config.read("plexorcist.ini")
Expand All @@ -31,7 +38,8 @@
I18N[option] = config.get("i18n", option)

# Set the log file name
LOG_FILE = "plexorcist.log"
log_file_path = os.path.join(script_dir, "plexorcist.log")
LOG_FILE = log_file_path

# Create a rotating file handler with a maximum size of 1 MB
handler = RotatingFileHandler(LOG_FILE, maxBytes=1024 * 1024, backupCount=2)
Expand Down

0 comments on commit 221bb03

Please sign in to comment.