Advertisement
Guest User

Untitled

a guest
Sep 7th, 2023
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. # filebot-watcher
  2. #
  3. # Usage:
  4. # .\filebot-watcher.ps1 X:\Input --output X:\Output
  5. #
  6.  
  7.  
  8. $input = "Z:\Downloads\deluge"
  9. $global:options = "--output Z:\Downloads.tmp"
  10. Write-Host "Watch Folder: $input"
  11.  
  12.  
  13. $onChange = {
  14. $path = $Event.SourceEventArgs.FullPath
  15. $type = $Event.SourceEventArgs.ChangeType
  16. Write-Host "[$type] $path"
  17. & filebot $path -script fn:amc `
  18. -rename `
  19. --conflict skip `
  20. --output "Z:\Downloads.tmp" `
  21. -non-strict `
  22. --def storeReport=Z:\BackUp\AMC `
  23. --def clean=n `
  24. --def skipExtract=y `
  25. --def excludeLink=y `
  26. --def minFileSize=5m `
  27. --def minLengthMS=300000 `
  28. --def unsorted=y `
  29. --def plex=<Plex Info> `
  30. --def seriesFormat="Z:\Series\{n}\Season {s}\{n} - {s00e00} - {t} - {vf}" `
  31. --def seriesDB=TheTVDB `
  32. --def animeFormat="Z:\Anime\ASeries\{n}\Season {s}\{n} - {s00e00} - {t} - {vf}" `
  33. --def animeDB=TVMaze `
  34. --def movieFormat="Z:\{ if (fn =~ /3D/) 'Movies3D' else { if (height > 2000) 'Movies4K' else 'Movies'}}\{n} - ({y})\{n} ({y}) - {vf}" `
  35. --def movieDB=TheMovieDB `
  36. --def unsortedFormat="Z:\Downloads.tmp\deluge\unsorted\{fn} - {vf}" `
  37. --def music=n `
  38. --file-filter "f.video" `
  39. --log-file c:\temp\amc.log `
  40. --def excludeList="excludes.txt" `
  41. --def gmail=*`
  42. --def mailto=* `
  43. --def reportError=y | Write-Host
  44. }
  45.  
  46.  
  47. $watcher = New-Object System.IO.FileSystemWatcher
  48. $watcher.Path = $input
  49. $watcher.Filter = ""
  50. $watcher.IncludeSubdirectories = $true
  51. $watcher.EnableRaisingEvents = $true
  52.  
  53.  
  54. Register-ObjectEvent $watcher "Created" -Action $onChange
  55. # Register-ObjectEvent $watcher "Changed" -Action $onChange
  56. # Register-ObjectEvent $watcher "Renamed" -Action $onChange
  57.  
  58.  
  59. try {
  60. while ($true) {
  61. Start-Sleep -Seconds 1
  62. }
  63. }
  64. finally {
  65. $watcher.Dispose()
  66. Write-Host "Stop Watcher"
  67. }
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement