Skip to content

Commit

Permalink
Merge pull request #226 from rbeer/feat/log-path-option
Browse files Browse the repository at this point in the history
Add: log_path option
  • Loading branch information
ThioJoe authored Dec 27, 2021
2 parents 2e72c27 + 8b0eeb7 commit 0b661a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
18 changes: 12 additions & 6 deletions YouTubeSpammerPurge.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
### IMPORTANT: I OFFER NO WARRANTY OR GUARANTEE FOR THIS SCRIPT. USE AT YOUR OWN RISK.
### I tested it on my own and implemented some failsafes as best as I could,
### but there could always be some kind of bug. You should inspect the code yourself.
version = "2.2.6"
configVersion = 10
version = "2.3.0"
configVersion = 11
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

# GUI Related
Expand Down Expand Up @@ -1447,8 +1447,8 @@ def load_config_file():
#configDictRaw = {s:dict(parser.items(s)) for s in parser.sections()}

# Convert raw config dictionary into easier to use dictionary
settingsToKeepCase = ["your_channel_id", "video_to_scan", "channel_ids_to_filter", "regex_to_filter", "channel_to_scan"]
validWordVars = ['ask', 'mine']
settingsToKeepCase = ["your_channel_id", "video_to_scan", "channel_ids_to_filter", "regex_to_filter", "channel_to_scan", "log_path"]
validWordVars = ['ask', 'mine', 'default']
configDict = {}
for section in parser.sections():
for setting in parser.items(section):
Expand Down Expand Up @@ -2517,8 +2517,14 @@ def scan_video(youtube, miscData, currentUser, filterMode, filterSubMode, videoI

if logMode == True:
global logFileName
logFileName = "Spam_Log_" + datetime.now().strftime("%Y-%m-%d_%H-%M-%S" + ".rtf")
print(f"Log file will be called {F.YELLOW}" + logFileName + f"{S.R}\n")
fileName = "Spam_Log_" + datetime.now().strftime("%Y-%m-%d_%H-%M-%S" + ".rtf")
if config and config['log_path'] and config['log_path'] != "default":
logFileName = os.path.normpath(config['log_path'] + "/" + fileName)
print(f"Log file will be located at {F.YELLOW}" + logFileName + f"{S.R}\n")
else:
logFileName = fileName
print(f"Log file will be called {F.YELLOW}" + logFileName + f"{S.R}\n")

if bypass == False:
input(f"Press {F.YELLOW}Enter{S.R} to display comments...")

Expand Down
10 changes: 7 additions & 3 deletions assets/default_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# • If you set a setting in here, the program will not Ask you to enter/confirm when your run it
# • If you leave the value as 'Ask', the program will Ask you for it as usual
# • Some settings might not be necessary depending on which modes you select
#
#
# • For 100% automatic usage of program, enter all values (or at least all for your scanning/filtering modes)
# • NOTE: Human confirmation is required for most settings to actually remove comments
# - If comment removal is automated, comments are marked as "held for review" and hidden
Expand All @@ -30,6 +30,10 @@ your_channel_id = Ask
# Default = Ask -- Possible Values: Ask | True | False
enable_logging = Ask

# Set the FULL folder path where log files will go (not including file name itself). Ensure write permissions to path.
# Default = Default (Sets to current directory) -- Example Values: C:\Users\wherever\ | /home/user/logfiles
log_path = Default

# Enables or disables silent checking of newer version when program runs. Only displays message if update is available
# This will not display errors if it cannot get version. To see any issues, use program's manual update check
# Default = True -- Possible Values: True | False
Expand Down Expand Up @@ -105,7 +109,7 @@ strings_to_filter = Ask
# Default = Ask -- Possible Values: Ask | [regex]
regex_to_filter = Ask


[removal]
#--------------------------------------------------------------------------------
# If 'False', behaves as normal. If 'True', simply skips deletion altogether and exits program, Good if you just want to collect logs.
Expand Down Expand Up @@ -133,4 +137,4 @@ removal_type = rejected

# Don't change anything below here!
[info]
config_version = 10
config_version = 11

0 comments on commit 0b661a5

Please sign in to comment.