Not Escaped Correctly

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Not Escaped Correctly

Post by Amishman »

Everything was working great until I added Ithiel's 3D script portion. This script works great in uTorrent but not in CLI. I know it's not escaped right but I'm not sure where the issue lies. I tried the escape tool but I still couldn't get it to work properly.

Thank you Ithiel for the script. I ran into an issue where the 3D version would be renamed the same as the normal (non 3D) and copy over it.

Here is my script:

Code: Select all

def watchman = args.watch { changes ->
   execute('''filebot -script fn:amc -non-strict --output "G:/" "G:/Watched" --log-file amc.log --action move --conflict override --def "seriesFormat=TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}" "movieFormat=New Movies/{n} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \" \") + ')'} ({y}) {[vf]}/{n} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\"\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \" \") + ')'} ({y})" "musicFormat=H:/Music/{n}/{$album/}{${pi.pad(2)}. } {t}" --def clean=y --def plex=localhost --def deleteAfterExtract=y''')
}
Here is the amc.log results:
Mar 27, 2014 3:34:20 PM net.sourceforge.filebot.cli.ArgumentBean getFiles
WARNING: Invalid argument
Mar 27, 2014 3:34:20 PM net.sourceforge.filebot.cli.ArgumentBean getFiles
WARNING: The filename, directory name, or volume label syntax is incorrect
Parameter: seriesFormat = TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}
Parameter: movieFormat = New Movies/{n} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/,
Parameter: clean = y
Parameter: plex = localhost
Parameter: deleteAfterExtract = y
Argument: G:\Watched
Argument: C:\Scripts\) + ')'} ({y}) {[vf]}\{n} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':"}{' (' + fn.matchAll(\extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition\)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(\[._]\,
Argument: C:\Scripts\) + ')'} ({y})
Argument: C:\Scripts\musicFormat=H:\Music\{n}\{$album\}{${pi.pad(2)}. } {t}
Exception: File not found: G:\Watched
Failure (°_°)
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Not Escaped Correctly

Post by Amishman »

I tried again using what the escape tool showed and it worked once but didn't clean up all the left over files and folder. I tested with another movie I had and bad things happened. It did move and rename the movie and a subtitle but left the previous folder and extra filles.
C:\Scripts>filebot -script C:\Scripts\folder_watcher.groovy G:/Watched
Waiting for events
Locking C:\Users\Amishman\AppData\Roaming\FileBot\logs\amc.log
Parameter: seriesFormat = TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}
Parameter: movieFormat = New Movies/{n} {fn.contains('3D') || fn.contains('3-D')
? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut
|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ')
.replaceAll(/[._]/, " ") + ')'} ({y}) {[vf]}/{n} {fn.contains('3D') || fn.contai
ns('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unra
ted|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().j
oin(', ').replaceAll(/[._]/, " ") + ')'} ({y})
Parameter: musicFormat = H:/Music/{n}/{$album/}{${pi.pad(2)}. } {t}
Parameter: clean = y
Parameter: plex = localhost
Parameter: deleteAfterExtract = y
Parameter: pushbullet = *****
Argument: G:\Watched
Input: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\Escape from Planet Earth 3D
(2013).srt
Input: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\Escape.from.Planet.Earth.3D
.(2013).mp4
Exclude: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\about.jpg
Exclude: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\Escape from Planet Earth
3D (2013).mp4.tgmd
Escape from Planet Earth 3D (2013).srt [series: Planet Earth, movie: Escape from
Planet Earth (2013)]
Exclude Series: Planet Earth
Escape.from.Planet.Earth.3D.(2013).mp4 [series: Planet Earth, movie: Escape from
Planet Earth (2013)]
Exclude Series: Planet Earth
Group: [tvs:null, mov:escape from planet earth 2013, anime:null] => [Escape from
Planet Earth 3D (2013).srt, Escape.from.Planet.Earth.3D.(2013).mp4]
Rename movies using [TheMovieDB]
Auto-detect movie from context: [G:\Watched\Escape.from.Planet.Earth.3D.(2013)\E
scape.from.Planet.Earth.3D.(2013).mp4]
Auto-detect movie from context: [G:\Watched\Escape.from.Planet.Earth.3D.(2013)\E
scape from Planet Earth 3D (2013).srt]
[MOVE] Rename [G:\Watched\Escape.from.Planet.Earth.3D.(2013)\Escape.from.Planet.
Earth.3D.(2013).mp4] to [G:\New Movies\Escape from Planet Earth 3D (2013) [1080
p]\Escape from Planet Earth 3D (2013).mp4]
[MOVE] Rename [G:\Watched\Escape.from.Planet.Earth.3D.(2013)\Escape from Planet
Earth 3D (2013).srt] to [G:\New Movies\Escape from Planet Earth 3D (2013) [1080
p]\Escape from Planet Earth 3D (2013).srt]
Processed 2 files
Notify Plex: localhost
Saving report as C:\Users\Amishman\AppData\Roaming\FileBot\reports\AMC [2014-03-
27 22h00m] .html
Sending PushBullet report
MissingMethodException: No signature of method: java.net.URL.post() is applicabl
e for argument types: (java.lang.String, java.lang.String, java.lang.String, jav
a.util.LinkedHashMap) values: [------------------------------a1134e1059ac
Content-Disposition: form-data; name="device_iden"

Failure (┬░_┬░)ujBQHQSJR8KdjzWIEVDzOK

------------------------------a1134e1059ac
Content-Disposition: form-data; name="type"

file
------------------------------a1134e1059ac
Content-Disposition: form-data; name="file"; filename="[FileBot] "
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'></meta>
<style>
p{font-family:Arial,Helvetica,sans-serif
}
p b{color:#07a}
hr{border-style:dashed;border-width:1px
0 0 0;border-color:lightgray}
small{color:#d3d3d3;font-size:xx-small;f
ont-weight:normal;font-family:Arial,Helvetica,sans-serif}
table a:link{color:#666;font-weight:bold
;text-decoration:none}
table a:visited{color:#999;font-weight:b
old;text-decoration:none}
table a:active,table a:hover{color:#bd5a
35;text-decoration:underline}
table{font-family:Arial,Helvetica,sans-s
erif;color:#666;background:#eaebec;margin:15px;border:#ccc 1px solid;border-radi
us:3px;box-shadow:0 1px 2px #d1d1d1}
table th{padding:15px;border-top:1px sol
id #fafafa;border-bottom:1px solid #e0e0e0;background:#ededed}
table th{text-align:center;padding-left:
20px}
table tr:first-child th:first-child{bord
er-top-left-radius:3px}
table tr:first-child th:last-child{borde
r-top-right-radius:3px}
table tr{text-align:left;padding-left:20
px}
table td:first-child{text-align:left;pad
ding-left:20px;border-left:0}
table td{padding:15px;border-top:1px sol
id #fff;border-bottom:1px solid #e0e0e0;border-left:1px solid #e0e0e0;background
:#fafafa;white-space:nowrap}
table tr.even td{background:#f6f6f6}
table tr:last-child td{border-bottom:0}
table tr:last-child td:first-child{borde
r-bottom-left-radius:3px}
table tr:last-child td:last-child{border
-bottom-right-radius:3px}
table tr:hover td{background:#f2f2f2}
</style>
<title>[FileBot] </title>
</head>
<body>
<p>FileBot finished processing
<b></b> (2 files).
</p>
<hr></hr>
<table>
<tr>
<th>Original Name</th>
<th>New Name</th>
<th>New Location</th>
</tr>
<tr>
<td>Escape.from.Planet.Earth.3D.(2013).mp4</td>
<td>Escape from Planet Earth 3D (2013).mp4</td>
<td>G:\New Movies\Escape from Planet Earth 3D (2013) [1080p]</td>
</tr>
<tr>
<td>Escape from Planet Earth 3D (2013).srt</td>
<td>Escape from Planet Earth 3D (2013).srt</td>
<td>G:\New Movies\Escape from Planet Earth 3D (2013) [1080p]</td>
</tr>
</table>
<hr></hr>
<small>// Generated by FileBot 4.0 (r2082) on Mule at 3/27/14 10:00:36 PM</s
mall>
</body>
</html>
------------------------------a1134e1059ac--
, ...]
Possible solutions: post(java.lang.String, java.lang.Object, java.lang.Object),
post(java.lang.String), post(java.lang.String, java.lang.Object), get(), wait(),
post(java.util.Map)
groovy.lang.MissingMethodException: No signature of method: java.net.URL.post()
is applicable for argument types: (java.lang.String, java.lang.String, java.lang
.String, java.util.LinkedHashMap) values: [------------------------------a1134e1
059ac
Content-Disposition: form-data; name="device_iden"

ujBQHQSJR8KdjzWIEVDzOK
------------------------------a1134e1059ac
Content-Disposition: form-data; name="type"

file
------------------------------a1134e1059ac
Content-Disposition: form-data; name="file"; filename="[FileBot] "
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'></meta>
<style>
p{font-family:Arial,Helvetica,sans-serif
}
p b{color:#07a}
hr{border-style:dashed;border-width:1px
0 0 0;border-color:lightgray}
small{color:#d3d3d3;font-size:xx-small;f
ont-weight:normal;font-family:Arial,Helvetica,sans-serif}
table a:link{color:#666;font-weight:bold
;text-decoration:none}
table a:visited{color:#999;font-weight:b
old;text-decoration:none}
table a:active,table a:hover{color:#bd5a
35;text-decoration:underline}
table{font-family:Arial,Helvetica,sans-s
erif;color:#666;background:#eaebec;margin:15px;border:#ccc 1px solid;border-radi
us:3px;box-shadow:0 1px 2px #d1d1d1}
table th{padding:15px;border-top:1px sol
id #fafafa;border-bottom:1px solid #e0e0e0;background:#ededed}
table th{text-align:center;padding-left:
20px}
table tr:first-child th:first-child{bord
er-top-left-radius:3px}
table tr:first-child th:last-child{borde
r-top-right-radius:3px}
table tr{text-align:left;padding-left:20
px}
table td:first-child{text-align:left;pad
ding-left:20px;border-left:0}
table td{padding:15px;border-top:1px sol
id #fff;border-bottom:1px solid #e0e0e0;border-left:1px solid #e0e0e0;background
:#fafafa;white-space:nowrap}
table tr.even td{background:#f6f6f6}
table tr:last-child td{border-bottom:0}
table tr:last-child td:first-child{borde
r-bottom-left-radius:3px}
table tr:last-child td:last-child{border
-bottom-right-radius:3px}
table tr:hover td{background:#f2f2f2}
</style>
<title>[FileBot] </title>
</head>
<body>
<p>FileBot finished processing
<b></b> (2 files).
</p>
<hr></hr>
<table>
<tr>
<th>Original Name</th>
<th>New Name</th>
<th>New Location</th>
</tr>
<tr>
<td>Escape.from.Planet.Earth.3D.(2013).mp4</td>
<td>Escape from Planet Earth 3D (2013).mp4</td>
<td>G:\New Movies\Escape from Planet Earth 3D (2013) [1080p]</td>
</tr>
<tr>
<td>Escape from Planet Earth 3D (2013).srt</td>
<td>Escape from Planet Earth 3D (2013).srt</td>
<td>G:\New Movies\Escape from Planet Earth 3D (2013) [1080p]</td>
</tr>
</table>
<hr></hr>
<small>// Generated by FileBot 4.0 (r2082) on Mule at 3/27/14 10:00:36 PM</s
mall>
</body>
</html>
------------------------------a1134e1059ac--
, ...]
Possible solutions: post(java.lang.String, java.lang.Object, java.lang.Object),
post(java.lang.String), post(java.lang.String, java.lang.Object), get(), wait(),
post(java.util.Map)
at PushBulletClient$_closure1_closure4.doCall(Script5.groovy:94)
at PushBulletClient$_closure1.doCall(Script5.groovy:76)
at Script3.run(Script3.groovy:412)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(ScriptShell.java:91)

at net.sourceforge.filebot.cli.ScriptShell.runScript(ScriptShell.java:85
)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(ArgumentProcess
or.java:123)
at net.sourceforge.filebot.Main.main(Main.java:192)
Launch4j: Failed to run the given command.
Locking C:\Users\Amishman\AppData\Roaming\FileBot\logs\amc.log
Parameter: seriesFormat = TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}
Parameter: movieFormat = New Movies/{n} {fn.contains('3D') || fn.contains('3-D')
? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut
|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ')
.replaceAll(/[._]/, " ") + ')'} ({y}) {[vf]}/{n} {fn.contains('3D') || fn.contai
ns('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unra
ted|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().j
oin(', ').replaceAll(/[._]/, " ") + ')'} ({y})
Parameter: musicFormat = H:/Music/{n}/{$album/}{${pi.pad(2)}. } {t}
Parameter: clean = y
Parameter: plex = localhost
Parameter: deleteAfterExtract = y
Parameter: pushbullet = *****
Argument: G:\Watched
Exclude: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\about.jpg
Exclude: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\Escape from Planet Earth
3D (2013).mp4.tgmd
Exclude: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\folder.jpg
Exclude: G:\Watched\Escape.from.Planet.Earth.3D.(2013)\mediainfo.data
Done ヾ(@⌒ー⌒@)ノ
Here is the script that I used:

Code: Select all

def watchman = args.watch { changes ->
   execute('''filebot -script fn:amc -non-strict --output "G:/" "G:/Watched" --log-file amc.log --action move --conflict override --def \"seriesFormat=TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}\" \"movieFormat=New Movies/{n} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\\\"\\\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \\\" \\\") + ')'} ({y}) {[vf]}/{n} {fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\\\"\\\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \\\" \\\") + ')'} ({y})\" \"musicFormat=H:/Music/{n}/{\$album/}{\${pi.pad(2)}. } {t}\" --def clean=y --def plex=localhost --def deleteAfterExtract=y --def pushbullet=******''')
}

watchman.commitDelay = 5 * 1000
watchman.commitPerFolder = false

println "Waiting for events"
if (console) { console.readLine() } else { sleep(Long.MAX_VALUE) } // keep running and watch for changes
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Not Escaped Correctly

Post by rednoah »

Seems like it's not backwards-compatible with 4.0, I guess you'll need at least FileBot r2105.
:idea: Please read the FAQ and How to Request Help.
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Not Escaped Correctly

Post by Amishman »

I updated to r2105 and that seemed to help. Now it keeps watching the folder and will process more movies. before it would only do one then stop. For some reason it does not clean up all of the files. It renames the movie and .srt and moves it to the proper place. Any .jpg, .png, or .srt is deleted but it excludes the following types everytime.
Exclude: G:\Watched\Frankenweenie (2012) [3D]\Frankenweenie (2012) [3D].mp4.tgmd
Exclude: G:\Watched\Frankenweenie (2012) [3D]\MBMovie.json
Exclude: G:\Watched\Frankenweenie (2012) [3D]\mediainfo.data
So, it leaves a folder with those files in it.


Also, why does FileBot save a report?
Saving report as C:\Users\Amishman\AppData\Roaming\FileBot\reports\AMC [2014-03-28 07h58m] .html
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Not Escaped Correctly

Post by rednoah »

1.
Added tgmd|json|data to the cleaner extension blacklist.

2.
Why not? Don't like it?
:idea: Please read the FAQ and How to Request Help.
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Not Escaped Correctly

Post by Amishman »

I just wasn't sure what it was and didn't remember seeing it before. Is that sent to PushBullet?
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Not Escaped Correctly

Post by Amishman »

Everything runs great when I run 1 movie, although it did not delete the mediainfo.data file. It did delete the others.

When I put another movie into the watched folder this error happened and would not process another movie.
Mar 28, 2014 2:46:00 PM net.sourceforge.filebot.cli.FolderWatchService$FolderWatcher run
WARNING: null
java.lang.NullPointerException
at net.sourceforge.filebot.cli.FolderWatchService.watchFolderTree(FolderWatchService.java:126)
at net.sourceforge.filebot.cli.FolderWatchService.watchFolder(FolderWatchService.java:121)
at net.sourceforge.filebot.cli.FolderWatchService$3.created(FolderWatchService.java:162)
at net.sourceforge.filebot.cli.FolderWatchService$FolderWatcher.processEvents(FolderWatchService.java:246)
at net.sourceforge.filebot.cli.FolderWatchService$3.processEvents(FolderWatchService.java:145)
at net.sourceforge.filebot.cli.FolderWatchService$FolderWatcher.watch(FolderWatchService.java:229)
at net.sourceforge.filebot.cli.FolderWatchService$FolderWatcher.run(FolderWatchService.java:215)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Not Escaped Correctly

Post by rednoah »

1.
No, it's saved to %APPDATA%\FileBot\reports

2.
Looks like watcher-amc-cleaner don't play well together. Just put a try-catch around the execute call and ignore the errors. Or don't do --def clean=y

e.g.

Code: Select all

_guarded {
   execute(...)
}
:idea: Please read the FAQ and How to Request Help.
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Not Escaped Correctly

Post by Amishman »

When I do the:

Code: Select all

def watchman = args.watch _guarded { changes ->
   execute(...)
}
it no longer watches the folder. I have to manually run the script and it will then process the movie in that folder correctly.

Out of curiosity, if this report is not for PushBullet what's it for?
C:\Users\Amishman\AppData\Roaming\FileBot\reports\AMC [2014-03-28 07h58m] .html
Also, is there away to change the what is sent to PushBullet? When I receive the notification on my phone, the notification just says "[FileBot] .html" then below that "Tap to open" I would like it to say the finished name of the movie/show but I don't know if that's possible.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Not Escaped Correctly

Post by rednoah »

1.
Only wrap the execute(...) block:

Code: Select all

def watchman = args.watch { changes ->
   _guarded {
      execute(...)
   }
}
2.
Normally it would, it's just the way you're calling it breaks that logic. Like I said, watcher+amc doesn't play well together. You can set the title yourself by passing --def "ut_title=My Message" and of course you have the input fileset changes that you can create that message from.
:idea: Please read the FAQ and How to Request Help.
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Not Escaped Correctly

Post by Amishman »

It now works correctly.

Code: Select all

def watchman = args.watch { changes ->
   _guarded {
      execute(...)
   }
}
It now cleans, renames, and watches the folder with no errors.

Thank you very much!

Could you elaborate a little more about how to set the message as the movie/show title? I don't quite understand.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Not Escaped Correctly

Post by rednoah »

If you call amc script, and you pass in the script variable ut_title then the message sent will use whatever you specified in ut_title.

Here's some more hand-holding:

Code: Select all

execute(..., '--def', 'ut_title', changes*.getNameWithoutExtension().sort().join(', '))
:idea: Please read the FAQ and How to Request Help.
Post Reply