Page 1 of 1

Pushover notifications error

Posted: 07 Mar 2016, 01:27
by Dieguinho10
Hello!

Filebot is like MESSI, incredible!

I will send a donation! I only need a help with pushover notifications... i create a simply groovy... with this:

include('fn:lib/ws')
Pushover('MY_KEY').send('Hello World')

When I execute with this command:

Code: Select all

/Applications/Filebot.app/Contents/MacOS/filebot.sh -script /Users/dieguinhoMacMini/Desktop/notification.groovy 
I get this error:

Code: Select all

FileNotFoundException: https://raw.githubusercontent.com/filebot/scripts/v4.5/lib/ws.groovy
java.io.FileNotFoundException: https://raw.githubusercontent.com/filebot/scripts/v4.5/lib/ws.groovy
	at net.filebot.web.WebRequest.fetch(WebRequest.java:126)
	at net.filebot.web.WebRequest.fetchIfModified(WebRequest.java:101)
	at net.filebot.web.CachedResource.fetchData(CachedResource.java:32)
	at net.filebot.web.CachedResource.fetchData(CachedResource.java:11)
	at net.filebot.web.AbstractCachedResource.fetch(AbstractCachedResource.java:133)
	at net.filebot.web.AbstractCachedResource.get(AbstractCachedResource.java:78)
	at net.filebot.cli.ArgumentProcessor$DefaultScriptProvider.fetchScript(ArgumentProcessor.java:206)
	at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
	at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:78)
	at net.filebot.cli.ScriptShellBaseClass.executeScript(ScriptShellBaseClass.java:114)
	at net.filebot.cli.ScriptShellBaseClass.include(ScriptShellBaseClass.java:80)
	at Script1.run(Script1.groovy:1)
	at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:61)
	at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
	at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:112)
	at net.filebot.Main.main(Main.java:170)
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/filebot/scripts/v4.5/lib/ws.groovy
	at net.filebot.web.WebRequest.fetch(WebRequest.java:123)
	... 15 more
MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.Pushover() is applicable for argument types: (java.lang.String) values: [uv2VkWh7nv2tnYSB27kyJhRzTnmEEW]
groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.Pushover() is applicable for argument types: (java.lang.String) values: [uv2VkWh7nv2tnYSB27kyJhRzTnmEEW]
	at Script1.run(Script1.groovy:2)
	at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:61)
	at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
	at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:112)
	at net.filebot.Main.main(Main.java:170)
Failure (°_°)
Can somebody help me?

Thanks in advance.

Re: Pushover notifications error

Posted: 07 Mar 2016, 05:39
by rednoah
You're using an old version of FileBot. Please use the latest version of FileBot.

Re: Pushover notifications error

Posted: 07 Mar 2016, 12:31
by Dieguinho10
Thanks for your answer... Im using this:

Diegos-Mac-mini:MacOS dieguinhoMacMini$ filebot -version
FileBot 4.6.1 (r3315) / Java(TM) SE Runtime Environment 1.8.0_74

Is that version outdated?

I have a workaroud this problem, calling directly to the pushover rest api:

Code: Select all

import groovy.json.JsonSlurper
import groovy.json.StreamingJsonBuilder

def url = "http://api.pushover.net/1/messages.json?user=YOUR_USER_CODE&token=YOUR_APP_CODE&title=THE_TITLE_YOU_WANT&message="
def pushoverBody = "THE DINAMIC MESSAGE YOU WANT" + currentTitleDownload

url += java.net.URLEncoder.encode(pushoverBody)

def url2 = new URL(url)

def wine_resp = url2.openConnection().with {
    requestMethod = "POST"
    doOutput = true
    setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
    outputStream.withWriter("UTF-8") { new StreamingJsonBuilder(it) }
    new JsonSlurper().parse(inputStream.newReader("UTF-8"))
} 
Thats work, but the first solution I post is more elegant.

In the variable currentTitleDownload I want to put the series name downloaded with season and epidsode... how can I call from a groovy script a function that can return me a string like: The Blacklist S01E05

Thanks.

Re: Pushover notifications error

Posted: 07 Mar 2016, 16:25
by rednoah
This means that you're using a build from before 2014-07-30 and NOT r3315 or above:

Code: Select all

FileNotFoundException: https://raw.githubusercontent.com/filebot/scripts/v4.5/lib/ws.groovy
Please figure out your own setup.