INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Auto Import: What does it 'look' for?  (Read 708 times)

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 865
Auto Import: What does it 'look' for?
« on: May 07, 2021, 09:10:24 am »

How does Auto Import know that there are new files?  A while ago I moved my entire music library to the cloud in Google Drive.  Using the Google Drive software, auto-import seemed to work just fine.  I then moved to using an rclone mount instead of the native Drive client, which gained me quite a bit of flexibility.  The downside though is that rclone doesn't seem to trigger whatever it is that MC expects to get about new files.  If I add something, it's not auto-imported unless I "Run Auto-Import Now."  If I can get the right detail, perhaps I can investigate this from the rclone side.

Thanks!
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10925
Re: Auto Import: What does it 'look' for?
« Reply #1 on: May 07, 2021, 12:29:13 pm »

Auto-Import uses the OS provided monitoring functions to listen for file changes. Its quite likely that such a virtual file system doesn't trigger the appropriate hooks in the OS.
Logged
~ nevcairiel
~ Author of LAV Filters

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 865
Re: Auto Import: What does it 'look' for?
« Reply #2 on: May 07, 2021, 03:09:34 pm »

Auto-Import uses the OS provided monitoring functions to listen for file changes. Its quite likely that such a virtual file system doesn't trigger the appropriate hooks in the OS.

Yeah, seems that way.  The Google Drive client does trigger whatever it is. 

I found a few examples of people that have created python scripts to watch for new directories and then tell Plex to import those.  I'm sure I can take one of these and adapt it to MC using the /import/ api:

https://github.com/stokkes/plex_rcs

I'll work on that this weekend.  Seems like a basic enough idea.  Watch a log file, when certain words show up, call the MCWS API to import that directory.  My initial look at this means it'll be a little ugly because the log file outputs the directory relative to rclone, not to my install (which happens to be on Windows).  So I see something like this:

2021/05/07 09:54:04 INFO  : 00_test folder/New Text Document.txt: vfs cache: queuing for upload in 5s
2021/05/07 09:54:12 INFO  : 00_test folder/New Text Document.txt: Copied (new)
2021/05/07 09:54:12 INFO  : 00_test folder/New Text Document.txt: vfs cache: upload succeeded try #1

And I need to tell MCWS to import like this:

/MCWS/v1/Library/Import?Block=0&path=z%3A%5C00_test%20folder

Not the most elegant solution, but it'll at least get me something to use as a signal that I have a new folder to import.
Logged
Pages: [1]   Go Up