JackGruber / joplin-plugin-hotfolder

A plugin to Monitor a locale folder and import the files as a new note.
46 stars 4 forks source link

Hotfolder is importing and feleting files before file content is written (zero KB) #38

Open tconnz opened 4 weeks ago

tconnz commented 4 weeks ago

Great plugin, appreciate the work you've put in and sharing it with the community.

Issue

When other applications create the initial file to write text into, Hotfolder imports the file into a note before the before the file contents is complete. The note in Joplin appears immediately on file creation, even with File Ready & Polling options set.

This results in an empty note, and the file being deleted before the content is imported.

Expected Result

File Ready setting ensures file is not 0KB, if it is, it waits for the next poll. If after (insert # cycles), the file is still not ready, exit/error.

Environment

Windows 11

Plugin Settings

File Ready set to 120 Polling is Checked Polling Interval is set to 120

Could be related to a difference in how Windows 11 reports files in Explorer as opposed to how Python sees it?

Appreciate your time & consideration of the issue.

JackGruber commented 4 weeks ago

Please set the Loglevel to Verbose under Advanced Settings in the plugin and upload the log file. How is the file created in the Hotfolder? By which program?

tconnz commented 4 weeks ago

Thanks Jack,

The program creating the .md file is Windows Subsystem Linux (WSL) on Win 11. This is running a Python version of Fabric (https://github.com/danielmiessler/fabric)

Essentially text is piped out from Fabric, inside WSL (running Debian Image) to that file on Windows.

Log is as follows, set to verbose, there's not a lot of detail sorry. I ran it ,multiple times, seems to overwrite.

[2024-06-27 18:02:46.442] [verbose] Register Hotfolders [2024-06-27 18:02:46.443] [info] Register Hotfolder (0) [2024-06-27 18:02:46.498] [verbose] Notebook: 0 - Inbox [2024-06-27 18:02:46.500] [verbose] Hotfolder (0): Setup chokidar C:\fabric\outputs\0 - Inbox\fabric [2024-06-27 18:02:46.501] [verbose] Hotfolder (0): usePolling: true [2024-06-27 18:02:46.501] [verbose] Hotfolder (0): interval: 120 [2024-06-27 18:02:46.501] [verbose] Hotfolder (0): Add chokidar [2024-06-27 18:02:46.502] [verbose] Hotfolder (0): Directory C:\fabric\outputs\0 - Inbox\fabric has been added [2024-06-27 18:02:46.504] [info] Hotfolder (0): Initial scan complete. Ready for changes [2024-06-27 18:02:59.947] [info] Hotfolder (0): File "C:\fabric\outputs\0 - Inbox\fabric\2024-06-27-Summary - Fabric2.md" (0) has been added [2024-06-27 18:02:59.956] [verbose] Check file finished: C:\fabric\outputs\0 - Inbox\fabric\2024-06-27-Summary - Fabric2.md [2024-06-27 18:02:59.956] [info] File "C:\fabric\outputs\0 - Inbox\fabric\2024-06-27-Summary - Fabric2.md" finished writing [2024-06-27 18:02:59.956] [verbose] processFile (Hotfolder 0): C:\fabric\outputs\0 - Inbox\fabric\2024-06-27-Summary - Fabric2.md [2024-06-27 18:02:59.962] [verbose] Import as Text [2024-06-27 18:02:59.962] [verbose] importAsText [2024-06-27 18:03:00.071] [verbose] Hotfolder (0): File C:\fabric\outputs\0 - Inbox\fabric\2024-06-27-Summary - Fabric2.md has been removed

JackGruber commented 3 weeks ago

Could you try the following build and uploade the complete log file. io.github.jackgruber.hotfolder.zip

kuz-z-zma commented 3 weeks ago

I think I had the same issue with html files in hotfolder, that had not yet finished downloading. Will check and report with log, if able to replicate.

tconnz commented 3 weeks ago

Could you try the following build and upload the complete log file. io.github.jackgruber.hotfolder.zip

Working well in this build, thank your for your efforts.

[2024-07-02 09:48:45.088] [verbose] Settings:
[2024-07-02 09:48:45.089] [verbose] hotfolderAnz:1
[2024-07-02 09:48:45.089] [verbose] =================
[2024-07-02 09:48:45.090] [verbose] Hotfolder (0): C:\fabric\outputs\0 - Inbox\fabric
[2024-07-02 09:48:45.118] [verbose] notebookId: ee13aa7a033c4f509139b46695073a4f
[2024-07-02 09:48:45.118] [verbose] importTags: fabric
[2024-07-02 09:48:45.119] [verbose] extensionsAddAsText: .txt, .md
[2024-07-02 09:48:45.119] [verbose] ignoreFiles: .*
[2024-07-02 09:48:45.119] [verbose] textAsTodo: false
[2024-07-02 09:48:45.119] [verbose] importNotebook: 0 - Inbox
[2024-07-02 09:48:45.119] [verbose] usePolling: true
[2024-07-02 09:48:45.119] [verbose] pollingIntervall: 120
[2024-07-02 09:48:45.120] [verbose] intervallFileFinished: 100
[2024-07-02 09:48:45.120] [verbose] =================
[2024-07-02 09:48:45.120] [verbose] Register Hotfolders
[2024-07-02 09:48:45.120] [info]  Register Hotfolder (0)
[2024-07-02 09:48:45.144] [verbose] Notebook: 0 - Inbox
[2024-07-02 09:48:45.146] [verbose] Hotfolder (0): Setup chokidar C:\fabric\outputs\0 - Inbox\fabric
[2024-07-02 09:48:45.147] [verbose] Hotfolder (0): usePolling: true
[2024-07-02 09:48:45.147] [verbose] Hotfolder (0): interval: 120
[2024-07-02 09:48:45.147] [verbose] Hotfolder (0): Add chokidar
[2024-07-02 09:48:45.148] [verbose] Hotfolder (0): Directory C:\fabric\outputs\0 - Inbox\fabric has been added
[2024-07-02 09:48:45.149] [info]  Hotfolder (0): File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md" (7778) has been added
[2024-07-02 09:48:45.149] [info]  Hotfolder (0): Initial scan complete. Ready for changes
[2024-07-02 09:48:45.152] [verbose] Check file finished: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md
[2024-07-02 09:48:45.152] [verbose] File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md" recheck in 100
[2024-07-02 09:50:25.189] [verbose] Check file finished: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md
[2024-07-02 09:50:25.190] [verbose] File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md" finished via stats
[2024-07-02 09:50:25.190] [info]  File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md" finished writing
[2024-07-02 09:50:25.190] [verbose] processFile (Hotfolder 0): C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md
[2024-07-02 09:50:25.193] [verbose] importAsText
[2024-07-02 09:50:25.222] [verbose] tagNote: 9c524324975d4af8b78e8dbc53cc32bd with fabric
[2024-07-02 09:50:25.240] [verbose] Remove: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md
[2024-07-02 09:50:25.246] [verbose] Hotfolder (0): File C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric6.md has been removed
[2024-07-02 09:50:36.577] [info]  Hotfolder (0): File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md" (0) has been added
[2024-07-02 09:50:36.581] [verbose] Check file finished: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md
[2024-07-02 09:50:36.582] [verbose] File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md" recheck in 100
[2024-07-02 09:50:54.987] [verbose] Hotfolder (0): File C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md (7218) has been changed
[2024-07-02 09:52:16.629] [verbose] Check file finished: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md
[2024-07-02 09:52:16.631] [verbose] File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md" recheck in 100
[2024-07-02 09:53:56.674] [verbose] Check file finished: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md
[2024-07-02 09:53:56.676] [verbose] File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md" finished via stats
[2024-07-02 09:53:56.677] [info]  File "C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md" finished writing
[2024-07-02 09:53:56.677] [verbose] processFile (Hotfolder 0): C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md
[2024-07-02 09:53:56.688] [verbose] importAsText
[2024-07-02 09:53:56.736] [verbose] tagNote: 8efd86fb254b4a028940d621c1ef449b with fabric
[2024-07-02 09:53:56.766] [verbose] Remove: C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md
[2024-07-02 09:53:56.855] [verbose] Hotfolder (0): File C:\fabric\outputs\0 - Inbox\fabric\2024-07-02-Summary - Fabric7.md has been removed