Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added plugin FileMonitor and updated RenameFile plugin #375

Merged
merged 16 commits into from
Jul 30, 2024

Conversation

David-Maisonave
Copy link
Contributor

@David-Maisonave David-Maisonave commented Jul 28, 2024

Plugin FileMonitor.

I found the stash-watcher script after I started implementing FileMonitor, but stash-watcher has some issues.

stash-watcher Issues

  • It doesn't work as-is. I had to make some changes in the code to get it working.
  • After fixing it, I notice that when a change occurs in the file system, stash-watcher performs a full scan on everything in the library, instead of just scanning the path (directory) with the change.
  • stash-watcher does NOT fetch the stash library content, and instead user has to populate a *.toml file with desired paths. If the library content changes, the user also has to change the *.toml file.
  • Can not start the script from the Stash GUI. Not user friendly since user has to be familiar with launching python scripts.

FileMonitor

FileMonitor is similar to the stash-watcher script, put it works like a Plugin.

  • The user can start it from the Stash UI in [Plugins Task]. And the user can kill it from the [Task Queue]
  • FileMonitor automatically gets all the Stash library paths, and monitors those paths.
  • When a change occurs, it calls stash.run_plugin_task with the directory of the changed file, so only the effected path is scanned.
  • FileMonitor runs out of the box without the user having to make any setting/configuration changes.
  • FileMonitor can also optionally run as a standalone script.
    • To start monitoring, call the script and pass any argument.
      • python filemonitor.py start
    • To stop FileMonitor, pass argument stop.
      • python filemonitor.py stop
      • After running above command line, FileMonitor will stop after the next file change occurs.
      • The stop command works to stop the standalone job and the Stash plugin task job.

Update to RenameFile plugin.

  • Added fields galleries, resolution, and width.
  • Fixed bug associated with studio.
  • Added logic to limit the log file size.
  • Added logic to only get [Change success] logging when no errors occurs.
  • Change default fields to include studio.
  • Added postfix styles, which was mainly needed to properly format resolution field, but can be used for the other fields.
  • Consolidated [Include Existing Key Field] options into one option.
  • Cleaned up code and updated version

Where's was an (if not) condition which should have been an (if) condition. This caused issues when renaming a file without populating the title field and with an associated performer.
Added new plugin ChangeFileMonitor.
Made following changes to RenameFile plugin.
	Added fields galleries, resolution, and width.
	Fixed bug associated with studio.
	Added logic to limit the log file size.
	Added logic to only get [Change success] logging when no errors occurs.
	Change default fields to include studio.
	Added postfix styles, which was mainly needed to properly format resolution field, but can be used for the other fields.
	Consolidated [Include Existing Key Field] options into one option.
	Cleaned up code and updated version
Added new plugin ChangeFileMonitor.
Made following changes to RenameFile plugin.
	Added fields galleries, resolution, and width.
	Fixed bug associated with studio.
	Added logic to limit the log file size.
	Added logic to only get [Change success] logging when no errors occurs.
	Change default fields to include studio.
	Added postfix styles, which was mainly needed to properly format resolution field, but can be used for the other fields.
	Consolidated [Include Existing Key Field] options into one option.
	Cleaned up code and updated version
Removed unused UI variable endpoint.
Added logic that allows ChangeFileMonitor to run as a script.
Updated README.md file to explain how to run it as a script.
@David-Maisonave David-Maisonave changed the title Added plugin ChangeFileMonitor and updated RenameFile plugin. Added plugin FileMonitor and updated RenameFile plugin. Jul 30, 2024
@DogmaDragon
Copy link
Contributor

Please remove manifest files. They will be generated by the build action. Also .gitignore seems to be related to debug/development, not relevant for regular users.

@DogmaDragon DogmaDragon changed the title Added plugin FileMonitor and updated RenameFile plugin. Added plugin FileMonitor and updated RenameFile plugin Jul 30, 2024
@DogmaDragon DogmaDragon merged commit 8280454 into stashapp:main Jul 30, 2024
2 checks passed
@David-Maisonave
Copy link
Contributor Author

Please remove manifest .... .gitignore .....

Removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants