Skip to content
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.

Releases: MurdoMaclachlan/oscr

2.2.0

07 Mar 16:50
Compare
Choose a tag to compare

I have never forgotten to publish release notes.

Functionality

  • Change default regex to allow saving of a claim/done comment. (#161, #162)
  • Make Globals.config use proper encapsulation. (#151, #175)

Cleanup/Optimisation

  • Blacken all modules. (#152)
  • Divide globals.py into two modules; classes.py, containing all classes, and globals.py, containing all global variables. (#153, #168)

Documentation

  • Change function/variable naming from camelCase to snake_case. (#154, #160)
  • Change config keys from camelCase to snake_case. (#168, #169, #176)
  • Add docstrings to all modules. (#155, #158)
  • Rename ini.py to creds.py. (#156, #168)

Bug Fixes

  • Fix crash due to misnamed attribute on fetch_stats() failing to find stats.json. (#157, #160)
  • Fix refresh token not being properly saved to praw.ini. (#163, #170)
  • Fix possible reference before assignment if praw.ini is not found in edit_credentials(). (#164, #171)
  • Fix crash when editing arrays in edit_config() due to old variable naming references. (#165, #172)
  • Change default argument for update_log() to None. (#166, #173)
  • Fix unfilled argument when calling dump_credentials() in edit_credentials(). (#167, #174)

2.1.1

01 Nov 23:56
78368fb
Compare
Choose a tag to compare

As expected, 2.1.0 crashed and burned, so here are the bug fixes I find that should make it not crash or burn quite as much.

Bug Fixes

  • Fixed a crash when using regexes due to a type mismatch in the checkRegex() method.
  • Fixed a crash on attempting to handle AttributeErrors in comment checking due to not specifying a dataset to call from.
  • Fixed a crash on attempting to dumpStats due to an attribute naming mismatch.

2.1.0

01 Nov 14:37
0a65950
Compare
Choose a tag to compare

Finally bringing refresh token support, this release should hopefully not crash and burn instantly, but absolutely will. Apart from the big refresh token feature, this is mostly a minor release with a few improvements here and there and a couple of bug fixes.

Functionality

  • Added refresh token support. (#33, #139)
  • Added "dibs" to the default blacklist and regexBlacklist. (#140, #141)
  • Removed --format-old runtime argument. (#105, #131)

Cleanup/Optimisation

  • Deferred various functionalities in main.py to functions in other modules. (#128, #145)
  • Optimised the settings menu to allow for easier addition of new config and ini options. (#127, #139, #142)
  • Combined Log.clear() and Log.get() into Log.request(). (#125, #130)
  • Other general cleanup, readability and optimisation improvements. (#136, #137, #139, #142, #145)

Documentation/Logs

  • Changed "core" folder to "oscrcore" to avoid issues with pip. (#138, #139)

Bug Fixes

  • Fixed a crash on calling resetConfig(). (#132, #134)
  • Fixed a crash on passing an unknown run-time argument. (#133, #135)

2.0.0

28 Jul 16:55
dc92001
Compare
Choose a tag to compare

After way too long, it's finally here! 2.0.0! And it doesn't have any GUI. This isn't to say I haven't done much work, it's actually to say I got too carried away with backend. This update includes a major refactor of basically all of the code, along with a few new config options and runtime arguments.

Note: --format-old is a very precarious function that will be deprecated in 2.1.0. It might work, it might not. It's probably safer to manually move over your praw.ini and config.json settings to the new locations.

Functionality

  • Added --clean-hunt runtime argument to remove comments containing "treasure hunt". (#48, #87, #115)
  • Added caseSensitive config key. Determines whether or not OSCR is case sensitive when matching regexes or blacklisted comments. Set to False by default. (#57, #69)
  • Added printLogs config key and --print-logs runtime argument to override the config. Determines whether or not OSCR prints the log to the console. (#70, #71)
  • Added reportTotals config key and --report-totals runtime argument to override the config. Determines whether or not OSCR prints total statistics to the console. (#65, #72)
  • Added "unclaiming" to the default blacklist. (#69, nice)
  • OSCR now ignores punctuation when matching comments to blacklist entries. (#80, #83)
  • Added userList config key. If any users are specified in the list, OSCR will only check comments that are in reply to those users.(#85, #87)
  • Added ability to leave subredditList (and new userList key) empty, which will disable them, letting OSCR check comments on any subreddit or in reply to any user.
  • OSCR now collects global variables at program initialisation (in the oscr script) and not main.py. (#49, #75)
  • Contained all code in main.py within an oscr() function for the purpose of the above change. (#50, #75)

Cleanup/Optimisation

  • Refactored entire program with a much stronger object-oriented focus. This opens the door for a lot of backend improvements and optimisation. (#108, #109)
  • Re-wrote stats handling to use JSON and classes, making statistics.py a much neater module. (#106, #109)
  • Moved arguments checking to its own module, arguments.py. (#52, #75)
  • Moved comment handling to its own module, comment.py. (#81, #82)
  • Added type hinting. (#101, #103)
  • Staticised constant variables. (#97, #96, #98)
  • Optimised generation of config.json and praw.ini. (#51, #66, #67)
  • Optimised handling of praw.ini, including updating & formatting from CDRemover to OSCR. (#76, #84)
  • calculateEssentials() is no longer called unnecessarily. (#53, #59)
  • Combined default regexBlacklist items into one regex. (#117, #118)
  • Moved the default config variable to globals.py. (#56, #66)
  • Made many miscellaneous optimisation and readability improvements. (#77, #78, #79, #84, #96, #104, #109, #112, #114, #118, #120, #121)

Dependencies

  • Added colored for coloured console output. (#94)
  • Updated Python requirement to >= 3.5 for type hinting. (#107)

Documentation/Logs

  • Moved documentation to readthedocs. (#93, #99)
  • Renamed oscrmodules to core. (#110, #111)
  • Moved config.json to ~/.config/oscr on Linux and Mac, and AppData\\Roaming\\oscr on Windows. (#54, #64)
  • Changed how praw.ini is read and moved file to ~/.config/oscr on Linux and Mac, and AppData\\Roaming\\oscr on Windows. (#55, #84)
  • Improved log output surrounding comment retrieval & checking. (#60, #68)
  • Added license specification to setup.py. (#73, #74)
  • Changed config guide from bullet point list to table. (#83)
  • Added colouring to logs, currently only on warnings. (#91, #94)
  • Generally improved log handling. (#95, #96)
  • Renamed gvars to Globals. (#100, #102)

Bug Fixes

  • #45: Crash on attempting to use --show-config due to accidentally assigning Globals() instance to gvars.config. (fixed in #58)
  • #61: Attempting to update integer or boolean keys in the settings menu causes an infinite loop. (fixed in #63)
  • #86: Regexes may delete comments that are not bot interactions. (fixed in #87)
  • #88: Runtime arguments are not processed in the correct priority order. (fixed in #90)
  • #89: Crash on passing conflicting arguments. (fixed in #90)
  • #92: Potential crash on failing to update a statistic. (fixed in #94)

v1.2.1

05 Feb 20:22
4542f5e
Compare
Choose a tag to compare

Cleanup/Optimisation

  • Minor optimisation improvements in log.py, misc.py and statistics.py
  • update() now uses smaller None-type instead of needlessly initialising an empty array
  • Removed time.sleep() statement from comment checker (see note 1)

Documentation

  • Added --version option to print the currently installed version.
  • Removed credits from start of main.py (see note 2)

Dependencies

  • praw; require >= 7.1.2.
  • alive_progress; require >= 1.6.1.

Bug Fixes

  • #16: Recursion error on initialising Reddit instance with empty Redditor (fixed upstream in either PRAW 7.1.1)

Notes

  1. This was only there to slow down comment checking for debugging purposes.
  2. This should have been committed in 1.2.0, but I somehow didn't.

v1.2.0

02 Feb 14:17
ebfd670
Compare
Choose a tag to compare

Functionality

  • Added support for regexes (big thanks to /u/metaquarx and /u/Tim3303 for their help with this; also, see note 1).
    • For this purpose, added:
      • regex config key that tells the program whether or not to check comments using regexes, by default set to False.
      • regexBlacklist config key, to contain the regexes to check comments against, by default excludes anything with "treasure hunt".
    • Added re import to main.py.
  • Added a progress bar to console output (not saved to log file).
  • Added new subredditList config key, containing a whitelist of subreddits the program is allowed to search through; contains only "transcribersofreddit" by default.
  • Removed torOnly config key as of above change.
  • Added a "-e" option to the settings menu, allowing users to escape to the main menu if they accidentally chose the incorrect key.
  • Added a --show-config option to print the contents of the config file.

Cleanup/Optimisation

  • Condensed comment search function thanks to new subredditList config key.
  • Removed unnecessary failedStats check in fetch() (see note 2).
  • Changed initialiseGlobals() to no longer unnecessarily pass empty lists.
  • Removed unused import.
  • Removed python3 env in main.py (see note 3).

Documentation

  • Added a "How to use this menu" option to the settings menu.
  • Clarified log messages for when OSCR counts less comments than the set limit.
  • Added a log message to --format-cdr to indicate when praw.ini is already formatted to OSCR.
  • When encountering a JSONDecodeError in getConfig(), OSCR now logs what the error was.
  • Added copyright notices to the beginnings of all files except setup.py and init.py
  • Added a note giving a minimum recommended cutoff of 15 minutes.
  • Corrected a spelling error in README.md.
  • Readibility improvements in settings.py.
  • Moved credits from main.py to CREDITS.md
  • Added a --credits option to print the credits in the console.

Dependencies

  • alive_progress; added.

Bug Fixes

  • Fixed int and boolean based keys not being updated by the settings menu.

Notes

  1. Using regexes is HEAVILY DISCOURAGED for those who do not have a clear understanding of how they work. Incorrect regexes can delete A LOT more than what you might want to. For this reason, useRegex is set to False by default.
  2. fetch() is only ever called once per run-time, so this piece of code would never run.
  3. This forces the program to run in Python 3. It was an old catch for systems that still defaulted to Python 2, and I'm fairly sure it only affected Linux; more importantly, it should be redundant if the program is being run through pip or is run as python3 oscr instead of just python oscr.

v1.1.1

02 Jan 11:05
df49073
Compare
Choose a tag to compare

Cleanup:

  • Removed lingering debug print() statement.

Documentation:

  • Added copyright notices;
    • One at the beginning of the code in the oscr script file,
    • One to be printed when the program is run.
  • Added repository badges/information to README.md

Bug Fixes:

  • Fixed #34: Crash caused by comparing None to int() after settings module output None-type to "limit" in config.json.
  • Fixed #35: Converts all numerical limits to None-type.
  • Fixed #36: Misleading logs could suggest a bug if available comments are less than the user's limit

v1.1.0

30 Nov 20:39
9b21ba0
Compare
Choose a tag to compare

Name:

  • Changed the name of the project from ClaimDoneRemover to OSCR (Open Source Caretaker for Reddit), lovingly nicknamed Oscar.
    • As a part of this, the pip package is now located at https://pypi.org/project/oscr/

Functionality:

  • Added a settings menu from which you can edit config.json and praw.ini (see note 1).
  • Added several arguments that can be passed to oscr console command;
    • --format-cdr renames .cdremover and [cdrcredentials] to .oscr and [oscr], !! ADVISED TO RUN THIS BEFORE ANYTHING ELSE IF UPDATING FROM AN OLD VERSION !!
    • --help displays a list of commands,
    • --no-recur forces the program to run only one cycle regardless of 'recur' configuration,
    • --reset-config resets the config file to defaults (useful if you irreparably break something like I did),
    • --settings runs the settings menu.
  • Added capability to stop attempting to update each statistic after a failure to do so (see note 2).
  • Now defaults non-numeric instances of config["limit"] to None type (see note 3).
  • Switched from .format() to fstrings for more succinct string formatting.
  • Global variables are now contained in gvars class, passed into all necessary functions (see note 4).
  • config is now a global variable.

Cleanup:

  • setup.py now imports version from oscrmodules.gvars, avoiding the need to declare the variable twice.
  • Squashed some code verbosity; unnecessary variable declarations, if statements with longer conditions than neeeded, etc.
  • Removed unnecessary imports.
  • fetch() and update() no longer unnecessarily globalise variables.

Documentation:

  • Replaced the Notes section in README.md with a more informative Additional Help and FAQ section.
  • Corrected minor spelling errors in log output and commenting.
  • Avoided potential double timestamp in log noting failure to decode config.json.
  • createIni() now logs its attempts to create praw.ini

Bug Fixes:

  • #26: New "deleted" lines are appended to stats.txt rather than just updating one line as was intended.
  • #27: Potential error with displaying log message in the format "X/None comments checked successfully".
  • #28: Potential error with displaying log message in the format "X/Y comments checked successfully" where X is greater than Y (see note 5).
  • #29: Incorrect INI Path for Windows (thanks to /u/--B_L_A_N_K--)
  • #31: Program crash on attempting to fetch config.json if the parent directory is missing (see note 6).
  • #32: Potential crash if config['logUpdates'] configuration was set to false.

Notes:

  1. The code for this is god-awful, but it does the job and I won't be touching it for a while since I've already had far too much of it, plus, other hardships mean I haven't the mental capacity to work it out right now. If you like my r/badcode flair you can take a look but expect to be disgusted.
  2. Added new global list failedStats for this purpose.
  3. This was in the changelog for v1.0.0, but apparently I forgot to actually make the commit.
  4. As much as I hated having to do this, sharing the global variables across files doesn't work with a program this complex.
  5. This would have occurred where a limit was set that was not a mulitple of 25.
  6. The new dumpConfig() function aids this.

v1.0.0

02 Nov 21:14
4b74751
Compare
Choose a tag to compare

Announcement!

This project is now a PyPi package!

Find it here: https://pypi.org/project/cdremover/1.0.0/
Install using pip3 install cdremover and update with pip3 install --update cdremover

Next stop, GUI! (probably during the Christmas holidays, unfortunately; uni is busy)

Functionality:

  • Restructured program in preperation for pip package;
    • Log and statistics are now found in home/.cdremover/data.
    • Config file is now found in home/.cdremover.
    • libcdr module is now named cdrmodules, and includes main.py.
    • Program is now run through cdremover script (can be used a console command if installed through pip).
  • Program now creates praw.ini if it cannot be found (fix for #23s, see note 1 for limitations).
  • Optimisation improvements for both increased speed and reduced file size (see note 2 for details).
  • Added new cutoffUnit config variable, which is the unit of time the cutoff is measured in in seconds (see note 3 for details).
  • Program now resets any search limit value greater than or equal to 1000 to "None", rather than allowing values greater than 1000 to go unchanged, which could have potentially caused issues with Reddit's API.
  • Made home, log and version variables global throughout all files and functions (see note 4 for details).

Bug Fixes:

  • #23: Crash if praw.ini is missing or exists without "cdrcredentials" section.
  • #24: Crash due to getTime() being declared after the import of a function that attempts to import it.

Dependencies:

  • Removed requirements.txt, as dependencies are now stated in the new setup.py file and should be auto-installed by pip.
  • configparser finally added to requirement list after being a dependency since the config file was changed to .json format.

Documentation:

  • Changed/added some log messages;
    • Some ambiguities have been clarified.
    • Program now logs every time it intentionally exits.
    • Now logs output related to praw.ini handling.
    • Now logs a check for each 25 comments successfully checked (see note 5 for use).
  • misc.py functions now log console output.
  • Re-wrote README.md to faciliate new installation instructions and other information..
  • Began recording release candidate versions during development (only relevant for contributors or users following development).
  • Added/clarified some commenting.

Notes:

  1. This functionality currently has limitations due to limitations within PRAW itself. Currently, a restart is required to take into effect any changes to the praw.ini file, and additionally, if your praw.ini "cdrcredentials" section becomes corrupted, or if you enter the wrong information, you will need to fix the issue manually. I'm working on a script to try and fix the second issue, but the first will persist until more flexibility in this area can be added to PRAW.
  2. This includes improvements such as doing some one-time calculations on program start rather than performing them each cycle as was previously being done, as well as replacing "if [variable] == True" with simply "if [variable]" and so on.
  3. This allows for the user to use their preferred unit of time for the cutoff, rather than being forced to use hours. It is the value of 1 of the unit converted into seconds (e.g. hours would be 3600), and, if left blank or given as a non-numerical variable, will be defaulted to 3600 by the program.
  4. This removes the need for function calls with large numbers of variables being passed/returned, which improves the program readibility. The global variables are declared in gvars.py and imported into all the files that make use them.
  5. This could be very helpful for diagnosing at what point during the checking an error may have occurred.
  6. Technically the current version is 1.0.1 (as can be seen in the files), becuase I uploaded the wrong README.md to PyPi. If there is another patch for 1.0, it will be labelled 1.0.2 to keep version numbers synchronised.

v0.4.5

30 Oct 12:44
0321518
Compare
Choose a tag to compare

Changes:

  • Added handling for JSONDecodeError, allowing to give meaningful log on failure to decode config.json
  • Moved updateLog() from main.py to log.py
  • Moved getDate() from main.py to misc.py
  • Program now logs what version it is being run with.

Notes

  • I'm still planning to get a GUI done for this, although it's obviously taken a lot longer than I'd like. I'm hoping the Christmas holiday, whcih in university is about twice as long as I'm used to from school, will give me ample time to get that working. For now, this patch just tidies up a couple of very small things.