MissingMethodException.. someone mind helping me out?

Support for Windows users
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

So I decided to try and work my way through fixing up some stuff for my scripts, most notably Filebot to Sonarr/Radarr.. (Radarr is a fork of Sonarr but for movies, so everything that works on Sonarr works on Radarr as well) Now before you say anything yes I know that you can just use a simple "--def exec" with a HTTP request, but I'm stuck on something with that (getting jq to work the way it needs to, so that I can force a series rescan only for the series that downloaded instead of all of them) and haven't been able to move past it sadly since windows is crap (how I'd love to be able to use linux distro but I rely to much on windows for things) >.>

so I decided to fork the filebot-scripts repo and add sonarr/radarr to it, I pulled the sonarr stuff from a pretty old repo, but everything else is completely up to date with the main filebot-scripts repo..

So this is what I added --
In AMC.groovy:
I added sonarr/radarr to the log input parameters.

Code: Select all

_def.each{ n, v -> log.finest('Parameter: ' + [n, n =~ /plex|kodi|pushover|pushbullet|sonarr|radarr|mail|myepisodes/ ? '*****' : v].join(' = ')) }
Made a apiInfo definition

Code: Select all

def apiInfo = { url ->
	def match = ( url =~ /^(http[s]?\:\/\/)?([\w\.]+)?[\:]?([\d]{1,5})?([\/\w\d]+)?[\|]?([\w\d]+)?$/ )
	if (match.matches()) {
		match = match[0]
		try {
			def result = [type:match[1], host:match[2], port:match[3], path:match[4], token:match[5]]
			return result
		} catch (e) {}
	}
	return null
}
Added sonarr/radarr to the array of kodi/plex/emby hosts list

Code: Select all

sonarr = tryQuietly{ !'TEST'.equalsIgnoreCase(_args.action) ? apiInfo(sonarr.toString()) : null }
radarr = tryQuietly{ !'TEST'.equalsIgnoreCase(_args.action) ? apiInfo(radarr.toString()) : null }
Added sonarr/radarr to the artwork/nfo, pushover/pushbullet and ant utilities stuff

Code: Select all

if (artwork || kodi || plex || emby || sonarr || radarr) { include('lib/htpc') }
and then added sonarr/radarr scanning capabilities as the final thing in the AMC.groovy script

Code: Select all

// make Sonarr scan for new content
	if (sonarr) {
		log.info "Notify Sonarr: ${sonarr.host}:${sonarr.port}${sonarr.path}"
		tryLogCatch {
			refreshSonarrLibrary(sonarr.host, sonarr.port, sonarr.path, sonarr.token)
		}
	}

// make Radarr scan for new content
	if (radarr) {
		log.info "Notify Radarr: ${radarr.host}:${radarr.port}${radarr.path}"
		tryLogCatch {
			refreshRadarrLibrary(radarr.host, radarr.port, radarr.path, radarr.token)
		}
	}
Next thing I did was move over to htpc.groovy and added sonarr/radarr to it as well to finish things off..

Code: Select all

/**
 * Sonarr helpers
 */
def refreshSonarrLibrary(server, port = 8989, path = '', token = null) {
	tryLogCatch {
		def renameLog = getRenameLog()
		def idList = []

		if (renameLog){
			renameLog = renameLog.collect{ from, to -> to.parent}.unique()
			renameLog.each{ dir ->
				log.info 'Notifying Sonarr'
				def sonarrApiCall = { post, resource, data ->
					def headers = ["X-Api-Key":token]
					URL url = new URL("http://" + server + ':' + port + path + "/api/" + resource);
					println url.toString()
					def request = post ? WebRequest.post(url, data.getBytes(), 'application/json', headers) : WebRequest.fetch(url,0,headers,null)
					return (new groovy.json.JsonSlurper()).parseText(java.nio.charset.Charset.forName("UTF-8").decode(request).toString());
				}

				def rescan = []
				sonarrApiCall(false, 'Series', null).each{
					if (dir.contains(it.path)){
						println "Sonarr: Found matching series [$it.title] => [$it.id]"
						rescan += it.id
					}
				}

				rescan.unique().each{
					println "Sonarr: Force file rescan of [$it]"
					def output = sonarrApiCall(true, 'Command', '{"name": "rescanseries", "seriesId":"'+ it +'"}')
					println "Sonarr: $output"
				}
			}
		}
	}
}



/**
 * Radarr helpers
 */
def refreshRadarrLibrary(server, port = 7878, path = '', token = null) {
	tryLogCatch {
		def renameLog = getRenameLog()
		def idList = []

		if (renameLog){
			renameLog = renameLog.collect{ from, to -> to.parent}.unique()
			renameLog.each{ dir ->
				log.info 'Notifying Radarr'
				def radarrApiCall = { post, resource, data ->
					def headers = ["X-Api-Key":token]
					URL url = new URL("http://" + server + ':' + port + path + "/api/" + resource);
					println url.toString()
					def request = post ? WebRequest.post(url, data.getBytes(), 'application/json', headers) : WebRequest.fetch(url,0,headers,null)
					return (new groovy.json.JsonSlurper()).parseText(java.nio.charset.Charset.forName("UTF-8").decode(request).toString());
				}

				def rescan = []
				radarrApiCall(false, 'Movie', null).each{
					if (dir.contains(it.path)){
						println "Radarr: Found matching movie [$it.title] => [$it.id]"
						rescan += it.id
					}
				}

				rescan.unique().each{
					println "Radarr: Force file rescan of [$it]"
					def output = radarrApiCall(true, 'Command', '{"name": "rescanmovie", "movieId":"'+ it +'"}')
					println "Radarr: $output"
				}
			}
		}
	}
}
Now here is the issue that I am facing, and hopefully can get some help on possibly because I would like to get this fixed if at all possible.. Everything is pretty much perfect, once a file downloads and qbittorrent throws the OK for filebot to take over doing it's thing, it works like it should until it gets to the sonarr/radarr stuff. When ever it goes to request sonarr/radarr to do it's scan it ends up throwing an error out and doesn't end up sending the request at all, the error I am facing seems to do with webrequest.fetch..

Code: Select all

Notify Sonarr: localhost:8989/
Notifying Sonarr
MissingMethodException: No signature of method: static net.filebot.web.WebRequest.fetch() is applicable for argument types: (java.net.URL, java.lang.Integer, java.util.LinkedHashMap, null) values: [http://localhost:8989//api/Series, 0, [X-Api-Key:api key redacted], ...]
Possible solutions: fetch(java.net.URL), fetch(java.net.URL, long, java.lang.Object, java.util.Map, java.util.function.Consumer), find()
it does continue on cleaning the clutter and deleting the archives and moving the file to the correct place after it throws that error so everything else is working except for just that little bit. Now I know I probably won't get any help at all from anyone but I'd be grateful if someone came along and helped me out to fixing this up.. :/

This is the full logs if needed --

Code: Select all

Run script [C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff2\amc.groovy] at [Mon Feb 20 03:53:33 CST 2017]
Parameter: ut_dir = C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA
Parameter: ut_kind = multi
Parameter: ut_title = Family.Guy.S15E13.HDTV.x264-SVA
Parameter: excludeList = C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs/filebot-history.log
Parameter: music = false
Parameter: subtitles = en
Parameter: artwork = false
Parameter: extras = false
Parameter: plex = *****
Parameter: storeReport = false
Parameter: skipExtract = false
Parameter: clean = true
Parameter: deleteAfterExtract = true
Parameter: seriesFormat = /TV Shows/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: animeFormat = /Anime/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: movieFormat = /Movies/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]
Parameter: sonarr = *****
Use excludes: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\logs\filebot-history.log
Read archive [family.guy.s15e13.hdtv.x264-sva.rar] and extract to [C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva\Family.Guy.S15E13.HDTV.x264-SVA]
Extracting files [C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva\Family.Guy.S15E13.HDTV.x264-SVA\Family.Guy.S15E13.HDTV.x264-SVA.mkv]
Input: C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva\Family.Guy.S15E13.HDTV.x264-SVA\Family.Guy.S15E13.HDTV.x264-SVA.mkv
Group: [tvs:family guy] => [Family.Guy.S15E13.HDTV.x264-SVA.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
No matching subtitles found: C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva\Family.Guy.S15E13.HDTV.x264-SVA\Family.Guy.S15E13.HDTV.x264-SVA.mkv
Rename episodes using [TheTVDB]
Auto-detected query: [Family Guy]
Fetching episode data for [Family Guy]
Fetching episode data for [Family Guns]
Fetching episode data for [Family Game]
Fetching episode data for [Tuerkisch fuer Anfaenger]
Fetching episode data for [Family Man (2002)]
Apply Filter: {any{ age < 170 }{ airdate ? true : false }}
Include [Family Guy - 15x01 - The Boys in the Band]
Include [Family Guy - 15x02 - Bookie of the Year]
Include [Family Guy - 15x03 - American Gigg-olo]
Include [Family Guy - 15x04 - Inside Family Guy]
Include [Family Guy - 15x05 - Chris Has Got a Date, Date, Date, Date, Date]
Include [Family Guy - 15x06 - Hot Shots]
Include [Family Guy - 15x07 - High School English]
Include [Family Guy - 15x08 - Carter and Tricia]
Include [Family Guy - 15x09 - How the Griffin Stole Christmas]
Include [Family Guy - 15x10 - Passenger Fatty-Seven]
Include [Family Guy - 15x11 - Gronkowsbees]
Include [Family Guy - 15x12 - Peter's Def Jam]
Include [Family Guy - 15x13 - The Finer Strings]
Include [Family Guy - 15x14 - The Dating Game]
Include [Family Guy - 15x15 - Cop and a Half-wit]
[MOVE] Rename [C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva\Family.Guy.S15E13.HDTV.x264-SVA\Family.Guy.S15E13.HDTV.x264-SVA.mkv] to [D:\Shows\TV Shows\Family Guy\Season 15\Family Guy - S15E13 - The Finer Strings.mkv]
Processed 1 files
Notify Plex: [host:localhost, token:]
GET: http://localhost:32400/library/sections/all/refresh?X-Plex-Token=
Notify Sonarr: localhost:8989/
Notifying Sonarr
MissingMethodException: No signature of method: static net.filebot.web.WebRequest.fetch() is applicable for argument types: (java.net.URL, java.lang.Integer, java.util.LinkedHashMap, null) values: [http://localhost:8989//api/Series, 0, [X-Api-Key:api key redacted], ...]
Possible solutions: fetch(java.net.URL), fetch(java.net.URL, long, java.lang.Object, java.util.Map, java.util.function.Consumer), find()
Delete archive C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.rar
Delete archive volume C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.r00
Delete archive volume C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.r01
Delete archive volume C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.r02
Delete archive volume C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.r03
Delete archive volume C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.r04
Clean clutter files and empty folders
Delete C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva.sfv
Delete C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva\Family.Guy.S15E13.HDTV.x264-SVA
Delete C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA\family.guy.s15e13.hdtv.x264-sva
Delete C:\Users\JourneyOver\Desktop\QBT\Family.Guy.S15E13.HDTV.x264-SVA
Done ヾ(@⌒ー⌒@)ノ
and this is the sysinfo if needed

Code: Select all

FileBot 4.7.7 (r4752)
JNA Native: 5.1.0
MediaInfo: 0.7.92.1
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2017-02-10 (r480)
Groovy: 2.4.8
JRE: Java(TM) SE Runtime Environment 1.8.0_121
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 6 Core / 1 GB Max Memory / 23 MB Used Memory
OS: Windows 10 (amd64)
Package: PORTABLE
Data: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\data
uname: MSYS_NT-10.0-WOW DESKTOP-P1DM9DN 2.5.0(0.295/5/3) 2016-03-31 18:26 i686 Msys
Done ?(?????)?
Last edited by ZeroByDivide on 11 May 2018, 21:14, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

1.
Doing this with a standalone PowerShell or Groovy script called via --def exec shouldn't be too difficult. If you need the old or new path then you can just pass that along. That would also make it much easier for others to integrate your solution more easily with existing amc setups.

e.g.

Code: Select all

--def exec="synoindex -a '{folder}'"

2.
I recommend using Groovy APIs (so you can easily run your script with Groovy alone) or FileBot Script APIs. Internal FileBot APIs may change over time and without notice.

e.g.

Code: Select all

def url = new URL('...')
def bytes = url.get [Header: 'Value']
println bytes.text
@see URL.get(Map requestParameters)
@see ByteBuffer.getText()
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:1.
Doing this with a standalone PowerShell or Groovy script via called via --def exec shouldn't be too difficult. If you need the old or new path then you can just pass that along. That would also make it much easier for others to integrate your solution more easily with existing amc setups.

e.g.

Code: Select all

--def exec="synoindex -a '{folder}'"

2.
I recommend using Groovy APIs (so you can easily run your script with Groovy alone) or FileBot Script APIs. Internal FileBot APIs may change over time and without notice.

e.g.

Code: Select all

def url = new URL('...')
url.get [Header: 'Value']
@see URL.get(Map requestParameters)
So going by groovy method.. Would it be just changing these

Code: Select all

URL url = new URL("http://" + server + ':' + port + path + "/api/" + resource);
and

Code: Select all

WebRequest.fetch(url,0,headers,null)
to

Code: Select all

def url = new URL("http://" + server + ':' + port + path + "/api/" + resource);
and

Code: Select all

url.get [Header: "X-Api-Key":token]
or would it just condense

Code: Select all

def sonarrApiCall = { post, resource, data ->
               def headers = ["X-Api-Key":token]
               URL url = new URL("http://" + server + ':' + port + path + "/api/" + resource);
               println url.toString()
               def request = post ? WebRequest.post(url, data.getBytes(), 'application/json', headers) : WebRequest.fetch(url,0,headers,null)
               return (new groovy.json.JsonSlurper()).parseText(java.nio.charset.Charset.forName("UTF-8").decode(request).toString());
down to just

Code: Select all

def url = new URL("http://" + server + ':' + port + path + "/api/" + resource)
url.get [Header: "X-Api-Key":token]
?



This is honestly confusing me :/ hate how I'm not anywhere near good enough to do anything with this, and I've been at this for 2 days now.. All I am wanting is for filebot to get the TVDB ID while post-processing which then will push it through to get the ID of a series on sonarr and then to only update that series instead of how I have it right now where it updates every single series I have on sonarr which is pointless and taxing on read/writes when it happens sometimes between 4-6 times a day (and on upwards of like 100+ series)..
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

If you're hacking the amc script without prototyping your logic in a small unit tests first, it's not surprising that you're in over your head. I couldn't do it. ;)


1.
Write a standalone script so you can rapidly prototype and test everything.

I don't use Sonarr but here's a simple script with JSON get/post examples.

Usage:

Code: Select all

filebot -script update-sonarr.groovy --def ID=78874 KEY=XYZ123
Script:

Code: Select all

println "Update Sonarr"
println "ID = $ID"
println "KEY = $KEY"

def url = new URL('https://app.filebot.net/syno/index.json')

// read some JSON
def getResponse = url.get()
def json = new JsonSlurper().parseText(getResponse.text)
json.packages.each{
	println "Package: $it.dname"
}

// post some JSON
def requestHeaders = ['X-Api-Key': KEY]
def jsonObject = [action: 'refresh', type: 'series', id: ID as int]
def jsonText = JsonOutput.toJson(jsonObject)

println "POST = $jsonText"

def postResponse = url.post(jsonText.getBytes('UTF-8'), 'application/json', requestHeaders)
println postResponse.text

2.
Once your standalone script is working and well-tested. Try integrating it with the amc script:

Code: Select all

--def exec="filebot -script /path/to/update-sonarr.groovy --def ID={id} DB={series.database} KEY=XYZ123"
{id} can be the TheTVDB ID, AniDB or TheMovieDB ID so you might need the {series.database} information as well.

The APIKEY could be hardcoded in the exec call. Or in the script itself. Or via environment variables. Etc.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:If you're hacking the amc script without prototyping your logic in a small unit tests first, it's not surprising that you're in over your head. I couldn't do it. ;)


1.
Write a standalone script so you can rapidly prototype and test everything.

I don't use Sonarr but here's a simple script with JSON get/post examples.

Usage:

Code: Select all

filebot -script update-sonarr.groovy --def ID=78874 KEY=XYZ123
Script:

Code: Select all

println "Update Sonarr"
println "ID = $ID"
println "KEY = $KEY"

def url = new URL('https://app.filebot.net/syno/index.json')

// read some JSON
def getResponse = url.get()
def json = new JsonSlurper().parseText(getResponse.text)
json.packages.each{
	println "Package: $it.dname"
}

// post some JSON
def requestHeaders = ['X-Api-Key': KEY]
def jsonObject = [action: 'refresh', type: 'series', id: ID as int]
def jsonText = JsonOutput.toJson(jsonObject)

println "POST = $jsonText"

def postResponse = url.post(jsonText.getBytes('UTF-8'), 'application/json', requestHeaders)
println postResponse.text

2.
Once your standalone script is working and well-tested. Try integrating it with the amc script:

Code: Select all

--def exec="filebot -script /path/to/update-sonarr.groovy --def ID={id} DB={series.database} KEY=XYZ123"
{id} can be the TheTVDB ID, AniDB or TheMovieDB ID so you might need the {series.database} information as well.

The APIKEY could be hardcoded in the exec call. Or in the script itself. Or via environment variables. Etc.
Doing so

Code: Select all

filebot -script update-sonarr.groovy --def ID=78874 KEY=XYZ123
Script:

Code: Select all

println "Update Sonarr"
println "ID = $ID"
println "KEY = $KEY"

def url = new URL('https://app.filebot.net/syno/index.json')

// read some JSON
def getResponse = url.get()
def json = new JsonSlurper().parseText(getResponse.text)
json.packages.each{
	println "Package: $it.dname"
}

// post some JSON
def requestHeaders = ['X-Api-Key': KEY]
def jsonObject = [action: 'refresh', type: 'series', id: ID as int]
def jsonText = JsonOutput.toJson(jsonObject)

println "POST = $jsonText"

def postResponse = url.post(jsonText.getBytes('UTF-8'), 'application/json', requestHeaders)
println postResponse.text
Brings up a lot of stuff with it looking like it works, but if I go and try to switch it over to sonarrs url which is a http://localhost:8989/api/command type of deal..another thing, I don't think the above stuff even converts to the ID of what shows up on sonarr, the ID on sonarr would be different that what you would pull from TVDB and such.. for example with my sonarr say I download an episode of "the 100" the TVDB ID would come out as "268592" but to get it to refresh on sonarr I would have to have the script figure out in which position "the 100" is on my series list.. it's currently the first thing in my list right now so I would have to have the script somehow convert the "268592" to "1"..


I have been trying to set up a method with cURL and JQ instead as well, I've been getting close to getting it, but I can't seem to get a variable set correctly at all for it to possibly work..

It's through batch, but it's honestly the closest I have gotten to actually getting something close to what I am trying to accomplish vs the groovy stuff where I gotten semi-close but still super far away and it's more confusing to me than bat/sh/cmd/powershell..

Doing something like

Code: Select all

curl -s http://localhost:8989/api/series -H "X-Api-Key: api key redacted" --compressed | jq -s ".[]| .[] | select(.tvdbId=="268592") | .id "
would produce a 1 but if I do something like

Code: Select all

set seriesID=curl -s http://localhost:8989/api/series -H "X-Api-Key: api key redacted" --compressed | jq -s ".[]| .[] | select(.tvdbId=="268592") | .id "
and then do a

Code: Select all

echo %seriesID%
instead of it echoing a 1 it just echos %seriesID% like a fool :s if I could get it to actually echo the seriesID number instead, I could actually be done with this maybe.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

1.
My example just used this random json file:

Code: Select all

curl -s https://app.filebot.net/syno/index.json
You'll need to talk to Sonarr and I have absolutely no clue about that. That's for you to figure out. I just gave you the building blocks. ;)


2.
What does that json series index say? You can't do anything if you don't know what the json structure looks like:

Code: Select all

curl -s http://localhost:8989/api/series -H "X-Api-Key: api key redacted" --compressed
curl fetches the json. We use URL.get() for that. jq selects data from the json object tree. We do that with JsonSlurper and GPath.

In my example, we select all the dname values from each object in the packages list.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

This is just a snippit of the output of the curl command --

Code: Select all

[
  {
    "title": "The 100",
    "alternateTitles": [],
    "sortTitle": "100",
    "seasonCount": 4,
    "totalEpisodeCount": 48,
    "episodeCount": 16,
    "episodeFileCount": 13,
    "sizeOnDisk": 18648489871,
    "status": "continuing",
    "overview": "When nuclear Armageddon destroys civilization on Earth, the only survivors are those on the 12 international space stations in orbit at the time. Three generations later, the 4,000 survivors living on a space ark of linked stations see their resources dwindle and face draconian measures established to ensure humanity's future. Desperately looking for a solution, the ark's leaders send 100 juvenile prisoners back to the planet to test its habitability. Having always lived in space, the exiles find the planet fascinating and terrifying, but with the fate of the human race in their hands, they must forge a path into the unknown.",
    "nextAiring": "2017-02-23T02:00:00Z",
    "previousAiring": "2017-02-16T02:00:00Z",
    "network": "The CW",
    "airTime": "21:00",
    "images": [
      {
        "coverType": "fanart",
        "url": "/MediaCover/1/fanart.jpg?lastWrite=636208243235524452"
      },
      {
        "coverType": "banner",
        "url": "/MediaCover/1/banner.jpg?lastWrite=636230822012372314"
      },
      {
        "coverType": "poster",
        "url": "/MediaCover/1/poster.jpg?lastWrite=636208243246220786"
      }
    ],
    "seasons": [
      {
        "seasonNumber": 1,
        "monitored": false,
        "statistics": {
          "episodeFileCount": 0,
          "episodeCount": 0,
          "totalEpisodeCount": 13,
          "sizeOnDisk": 0,
          "percentOfEpisodes": 0.0
        }
      },
      {
        "seasonNumber": 2,
        "monitored": false,
        "statistics": {
          "episodeFileCount": 0,
          "episodeCount": 0,
          "totalEpisodeCount": 16,
          "sizeOnDisk": 0,
          "percentOfEpisodes": 0.0
        }
      },
      {
        "seasonNumber": 3,
        "monitored": true,
        "statistics": {
          "previousAiring": "2016-05-20T01:00:00Z",
          "episodeFileCount": 13,
          "episodeCount": 13,
          "totalEpisodeCount": 16,
          "sizeOnDisk": 18648489871,
          "percentOfEpisodes": 100.0
        }
      },
      {
        "seasonNumber": 4,
        "monitored": true,
        "statistics": {
          "nextAiring": "2017-02-23T02:00:00Z",
          "previousAiring": "2017-02-16T02:00:00Z",
          "episodeFileCount": 0,
          "episodeCount": 0,
          "totalEpisodeCount": 3,
          "sizeOnDisk": 0,
          "percentOfEpisodes": 0.0
        }
      }
    ],
    "year": 2014,
    "path": "D:\\Shows\\TV Shows\\The 100",
    "profileId": 3,
    "seasonFolder": true,
    "monitored": false,
    "useSceneNumbering": false,
    "runtime": 45,
    "tvdbId": 268592,
    "tvRageId": 34770,
    "tvMazeId": 6,
    "firstAired": "2014-03-19T05:00:00Z",
    "lastInfoSync": "2017-02-20T06:29:32.2569235Z",
    "seriesType": "standard",
    "cleanTitle": "the100",
    "imdbId": "tt2661044",
    "titleSlug": "the-100",
    "certification": "TV-14",
    "genres": [
      "Drama",
      "Science-Fiction",
      "Suspense",
      "Thriller"
    ],
    "tags": [],
    "added": "2016-06-06T22:41:43.4645583Z",
    "ratings": {
      "votes": 137,
      "value": 8.1
    },
    "qualityProfileId": 3,
    "id": 1
  },
this bit

Code: Select all

    "id": 1
is the bit that TVDB has to end of converting to somehow. I can get it with curl, but for some reason I can not for the life of me get it to set a variable for the curl command..
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

So I took the example data from here:

Code: Select all

https://github.com/Sonarr/Sonarr/wiki/Series
And here's an example on how to parse json and search for data:

Code: Select all

def seriesJsonText = new File('series.json').getText('UTF-8')

def seriesJson = new JsonSlurper().parseText(seriesJsonText)

def item = seriesJson.find{ it.tvdbId == 281662 }
println item.path
println item.id
Output:

Code: Select all

F:\TV_Shows\Marvels Daredevil
7
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

ZeroByDivide wrote:some reason I can not for the life of me get it to set a variable for the curl command...
It's almost funny that you think Windows CMD can do that. It can't. :lol:

:idea: Windows CMD is absolutely useless for anything but the most simple calls. It's not bash.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:
ZeroByDivide wrote:some reason I can not for the life of me get it to set a variable for the curl command...
It's almost funny that you think Windows CMD can do that. It can't. :lol:

:idea: Windows CMD is absolutely useless for anything but the most simple calls. It's not bash.
While that is true that CMD is shit, and windows is shit I'm stuck with it until I get a second computer to throw a linux distro on it and throw all my torrenting/filebot stuff on it instead though that won't be for a very long time .-. ... I don't even know how to implement
rednoah wrote:So I took the example data from here:

Code: Select all

https://github.com/Sonarr/Sonarr/wiki/Series
And here's an example on how to parse json and search for data:

Code: Select all

def seriesJsonText = new File('series.json').getText('UTF-8')

def seriesJson = new JsonSlurper().parseText(seriesJsonText)

def item = seriesJson.find{ it.tvdbId == 281662 }
println item.path
println item.id
Output:

Code: Select all

F:\TV_Shows\Marvels Daredevil
7
sadly right now either.. :s but guess that's what 0 sleep will do to ya..
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:
ZeroByDivide wrote:some reason I can not for the life of me get it to set a variable for the curl command...
It's almost funny that you think Windows CMD can do that. It can't. :lol:

:idea: Windows CMD is absolutely useless for anything but the most simple calls. It's not bash.

Hmm got an idea, output the variable from the curl to a text file and then import that variable in for the second part of my script.

^^^ Seems to work in bat... Think I finally got somewhere.. now to actually put some things to a test.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

Okay so I've gotten really close but still not gotten it yet :/

Running my current setup
[Main Script]

Code: Select all

:: Media file processing script for Filebot
:: This script gets triggered by some means (inotify, auditd, cron, etc.) and processes media files in some locations.
:: It will run the filebot amc.groovy script against these files and output them into user defined locations.
:: CLI Stuff http://www.filebot.net/cli.html
:: Format http://www.filebot.net/naming.html

:: Qbittorrent Call ---
:: "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff\Filebot_Wrapper.bat" "%N" "%F"

:: Set up some logging
set LOGDIR=C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs

:: Groovy Script Location
::set AMC=C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff2\amc.groovy

:: Base destinations to move files, no trailing slash. The subfolder is defined in the format string.
set DESTINATION=D:/Shows

:: Passing Args from Qbittorrent
set TORRENT_NAME=%1
set TORRENT_PATH=%2


:: Rename action i.e: move | copy | keeplink | symlink | hardlink
set ACTION=move

:: Conflict resolution i.e: override | skip | fail
set CONFLICT=override

:: Paths for format and filter
::set FILTERPATH="@/C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/MyStuff/Filter.txt"
set FORMATPATH="@/C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/MyStuff/Formatting.txt"

:: Old Filter Format
set FILTERPATH2="any{ age < 170 }{ airdate ? true : false }"

:: Process music files
set MUSIC=false

:: Download subtitles for the given languages i.e: en | de | fr
set SUBTITLES=en

:: Fetch artwork/nfo
set ARTWORK=false

:: Generate *.url files and fetch all available backdrops
set EXTRAS=false

:: Tell the given Kodi/XBMC instance to rescan it's library
::Set KODI=host[:port]

:: Tell the given Plex instance to rescan it's library. Plex Home instances require an authentication token
set PLEX=localhost:

:: Tell the given Emby instance to rescan it's library
::set EMBY=host:apikey

:: Save reports to local filesystem
set STOREREPORT=false

:: Do not extract archives
set SKIPEXTRACT=false

:: Automatically remove empty folders and clutter files that may be left behind after moving the video files, or temporary extracted files after copying
set CLEAN=true

:: Delete archives after extraction
set DELETEAFTEREXTRACT=true

:: Run filebot script
filebot -script fn:amc ^
		--output "%DESTINATION%" ^
		--log-file "%LOGDIR%/filebot-amc.log" ^
		--action %ACTION% ^
		--conflict %CONFLICT% ^
		-non-strict ^
		-no-xattr ^
		--filter ^
		%FILTERPATH2% ^
		--def ^
		ut_dir=%TORRENT_PATH% ^
		ut_kind=multi ^
		ut_title=%TORRENT_NAME% ^
		excludeList="%LOGDIR%/filebot-history.log" ^
		music=%MUSIC% ^
		subtitles=%SUBTITLES% ^
		artwork=%ARTWORK% ^
		extras=%EXTRAS% ^
		plex="%PLEX%" ^
		storeReport=%STOREREPORT% ^
		skipExtract=%SKIPEXTRACT% ^
		clean=%CLEAN% ^
		deleteAfterExtract=%DELETEAFTEREXTRACT% ^
		%FORMATPATH% ^
		"exec=C:\Users\JourneyOver\Desktop\Other2\sonarr.bat \"{info.id}\""
[sonarr.bat]

Code: Select all

:: Sets the path for cURL and JQ
SET PATH=%PATH%;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder\bin;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder\vendor\git-for-windows\usr\bin

::this is being passed in by the filebot.bat script.  It is the TVDB ID (if a tv show) or the TMDB (if a movie).
set infoId=%1
set sonarrAPIkey=

:: Below, we must first get 'seriesId' or 'movieId', which are the Sonarr/Radarr internal IDs from the TVDB or TMDB ID passed in by filebot.
:: The rest is responsible for calling the API to manually update the specific series/movie.

:: ------------- Sonarr ----------------

curl -s http://localhost:8989/api/series -H "X-Api-Key: %sonarrAPIkey%" --compressed | jq -s ".[]| .[] | select(.tvdbId=="%infoId%") | .id "  >> temp.txt

set /p seriesId=<temp.txt

del temp.txt

curl -s  http://localhost:8989/api/command -H "X-Api-Key: %sonarrAPIkey%" --data-binary '{ "name": "rescanSeries", "seriesId" : "'%seriesId%'" }'
It goes through it's normal stuff and reading the logs alone

Code: Select all

Run script [fn:amc] at [Mon Feb 20 12:26:45 CST 2017]
Parameter: ut_dir = C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS
Parameter: ut_kind = multi
Parameter: ut_title = The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS
Parameter: excludeList = C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs/filebot-history.log
Parameter: music = false
Parameter: subtitles = en
Parameter: artwork = false
Parameter: extras = false
Parameter: plex = *****
Parameter: storeReport = false
Parameter: skipExtract = false
Parameter: clean = true
Parameter: deleteAfterExtract = true
Parameter: seriesFormat = /TV Shows/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: animeFormat = /Anime/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: movieFormat = /Movies/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]
Parameter: exec = C:\Users\JourneyOver\Desktop\Other2\Untitled.bat "{info.id}"
Use excludes: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\logs\filebot-history.log
Input: C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS.mkv
Group: [tvs:the 100] => [The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
No matching subtitles found: C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS.mkv
Rename episodes using [TheTVDB]
Auto-detected query: [The 100]
Fetching episode data for [The 100]
Fetching episode data for [The 100 Scariest Movie Moments]
Fetching episode data for [The 100 Lives of Black Jack Savage]
Apply filter [any{ age < 170 }{ airdate ? true : false }] on [70] items
Include [The 100 - 4x01 - Echoes]
Include [The 100 - 4x02 - Heavy Lies the Crown]
Include [The 100 - 4x03 - The Four Horsemen]
Include [The 100 - 4x04 - A Lie Guarded]
Include [The 100 - 4x05 - The Tinder Box]
Include [The 100 - 4x06 - We Will Rise]
[MOVE] From [C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS.mkv] to [D:\Shows\TV Shows\The 100\Season 04\The 100 - S04E02 - Heavy Lies the Crown.mkv]
Processed 1 files
Execute: C:\Users\JourneyOver\Desktop\Other2\sonarr.bat "268592"
Notify Plex: [host:localhost, token:]
GET: http://localhost:32400/library/sections/all/refresh?X-Plex-Token=
Clean clutter files and empty folders
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\Screens\screen0001.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\Screens\screen0002.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\Screens\screen0003.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\Screens\screen0004.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS.nfo
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS\Screens
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E02.720p.WEB-DL.DD5.1.H264-LiGaS
Done ヾ(@⌒ー⌒@)ノ
would make it seem like everything went well, but sadly it did not.. It says it executed the sonarr.bat file but in reality it never did it once.. it's like the execute can't actually execute anything for some reason... if I was to put a output to logfile next to

Code: Select all

set infoId=%1
like so

Code: Select all

set infoId=%1 >>test.txt
it would always create a blank test.txt document so something is obviously happening but not in the way it should..

Someone mind helping me out here? :c
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

What's it say if you do this?

Code: Select all

--def exec="filebot -script fn:sysenv {id}"
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:What's it say if you do this?

Code: Select all

--def exec="filebot -script fn:sysenv {id}"
Ends up giving me this for a log

Code: Select all

Run script [fn:amc] at [Mon Feb 20 13:18:29 CST 2017]
Parameter: ut_dir = C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HDTV.x265.ShAaNiG.mkv
Parameter: ut_kind = multi
Parameter: ut_title = The.100.S04E03.720p.HDTV.x265.ShAaNiG.mkv
Parameter: excludeList = C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs/filebot-history.log
Parameter: music = false
Parameter: subtitles = en
Parameter: artwork = false
Parameter: extras = false
Parameter: plex = *****
Parameter: storeReport = false
Parameter: skipExtract = false
Parameter: clean = true
Parameter: deleteAfterExtract = true
Parameter: seriesFormat = /TV Shows/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: animeFormat = /Anime/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: movieFormat = /Movies/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]
Parameter: exec = filebot -script fn:sysenv {id}
Use excludes: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\logs\filebot-history.log
Input: C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HDTV.x265.ShAaNiG.mkv
Group: [tvs:the 100] => [The.100.S04E03.720p.HDTV.x265.ShAaNiG.mkv]
No missing subtitles
Rename episodes using [TheTVDB]
Auto-detected query: [The 100]
Fetching episode data for [The 100]
Fetching episode data for [The 100 Scariest Movie Moments]
Fetching episode data for [The 100 Lives of Black Jack Savage]
Apply filter [any{ age < 170 }{ airdate ? true : false }] on [70] items
Include [The 100 - 4x01 - Echoes]
Include [The 100 - 4x02 - Heavy Lies the Crown]
Include [The 100 - 4x03 - The Four Horsemen]
Include [The 100 - 4x04 - A Lie Guarded]
Include [The 100 - 4x05 - The Tinder Box]
Include [The 100 - 4x06 - We Will Rise]
[MOVE] From [C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HDTV.x265.ShAaNiG.mkv] to [D:\Shows\TV Shows\The 100\Season 04\The 100 - S04E03 - The Four Horsemen.mkv]
Processed 1 files
Execute: filebot -script fn:sysenv 268592
Notify Plex: [host:localhost, token:]
GET: http://localhost:32400/library/sections/all/refresh?X-Plex-Token=
Done ヾ(@⌒ー⌒@)ノ
that's running

Code: Select all

:: Media file processing script for Filebot
:: This script gets triggered by some means (inotify, auditd, cron, etc.) and processes media files in some locations.
:: It will run the filebot amc.groovy script against these files and output them into user defined locations.
:: CLI Stuff http://www.filebot.net/cli.html
:: Format http://www.filebot.net/naming.html

:: Qbittorrent Call ---
:: "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff\Filebot_Wrapper.bat" "%N" "%F"

:: Set up some logging
set LOGDIR=C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs

:: Groovy Script Location
::set AMC=C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff2\amc.groovy

:: Base destinations to move files, no trailing slash. The subfolder is defined in the format string.
set DESTINATION=D:/Shows

:: Passing Args from Qbittorrent
set TORRENT_NAME=%1
set TORRENT_PATH=%2
::set TORRENT_LABEL=%3

:: Rename action i.e: move | copy | keeplink | symlink | hardlink
set ACTION=move

:: Conflict resolution i.e: override | skip | fail
set CONFLICT=override

:: Paths for format and filter
::set FILTERPATH="@/C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/MyStuff/Filter.txt"
set FORMATPATH="@/C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/MyStuff/Formatting.txt"

:: Old Filter Format
set FILTERPATH2="any{ age < 170 }{ airdate ? true : false }"

:: Process music files
set MUSIC=false

:: Download subtitles for the given languages i.e: en | de | fr
set SUBTITLES=en

:: Fetch artwork/nfo
set ARTWORK=false

:: Generate *.url files and fetch all available backdrops
set EXTRAS=false

:: Tell the given Kodi/XBMC instance to rescan it's library
::Set KODI=host[:port]

:: Tell the given Plex instance to rescan it's library. Plex Home instances require an authentication token
set PLEX=localhost:

:: Tell the given Emby instance to rescan it's library
::set EMBY=host:apikey

:: Save reports to local filesystem
set STOREREPORT=false

:: Do not extract archives
set SKIPEXTRACT=false

:: Automatically remove empty folders and clutter files that may be left behind after moving the video files, or temporary extracted files after copying
set CLEAN=true

:: Delete archives after extraction
set DELETEAFTEREXTRACT=true

:: Run filebot script
filebot -script fn:amc ^
		--output "%DESTINATION%" ^
		--log-file "%LOGDIR%/filebot-amc.log" ^
		--action %ACTION% ^
		--conflict %CONFLICT% ^
		-non-strict ^
		-no-xattr ^
		--filter ^
		%FILTERPATH2% ^
		--def ^
		ut_dir=%TORRENT_PATH% ^
		ut_kind=multi ^
		ut_title=%TORRENT_NAME% ^
		excludeList="%LOGDIR%/filebot-history.log" ^
		music=%MUSIC% ^
		subtitles=%SUBTITLES% ^
		artwork=%ARTWORK% ^
		extras=%EXTRAS% ^
		plex="%PLEX%" ^
		storeReport=%STOREREPORT% ^
		skipExtract=%SKIPEXTRACT% ^
		clean=%CLEAN% ^
		deleteAfterExtract=%DELETEAFTEREXTRACT% ^
		%FORMATPATH% ^
		--def exec="filebot -script fn:sysenv {id}"
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

It does look like nothing is executed, but that's probably because you're looking at the filebot log file, and not the console output.

Are you testing by calling your bat script from CMD or PowerShell? Because if you don't, then you might miss important console output.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:It does look like nothing is executed, but that's probably because you're looking at the filebot log file, and not the console output.

Are you testing by calling your bat script from CMD or PowerShell? Because if you don't, then you might miss important console output.

I don't get any console output with how I ran the above (and how I normally run my scripts) since qbittorrent does it's whole running external program on completion thing and it's all silently run..

Did force it to do a run through outputting the whole script so here is a newer log with actually everything..

Code: Select all

Locking C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\logs\filebot-amc.log
Run script [fn:amc] at [Mon Feb 20 14:15:22 CST 2017]
Parameter: ut_dir = C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta
Parameter: ut_kind = multi
Parameter: ut_title = The.100.S04E03.720p.HEVC.x265-MeGusta
Parameter: excludeList = C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs/filebot-history.log
Parameter: music = false
Parameter: subtitles = en
Parameter: artwork = false
Parameter: extras = false
Parameter: plex = *****
Parameter: storeReport = false
Parameter: skipExtract = false
Parameter: clean = true
Parameter: deleteAfterExtract = true
Parameter: seriesFormat = /TV Shows/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: animeFormat = /Anime/{N}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}
Parameter: movieFormat = /Movies/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]/{N.replaceTrailingBrackets().replaceAll(/[!?.]+$/).replaceAll(/[\`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')} [{y}]
Parameter: exec = filebot -script fn:sysenv {id}
Use excludes: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\logs\filebot-history.log
Input: C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\The.100.S04E03.720p.HEVC.x265-MeGusta.mkv
Group: [tvs:the 100] => [The.100.S04E03.720p.HEVC.x265-MeGusta.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
Fetching [English] subtitles [The.100.S04E03.720p.HDTV.x264-SVA.srt] from [OpenSubtitles]
Export [The.100.S04E03.720p.HDTV.x264-SVA.srt] as [SubRip / UTF-8]
Writing [The.100.S04E03.720p.HDTV.x264-SVA.srt] to [The.100.S04E03.720p.HEVC.x265-MeGusta.eng.srt]
Rename episodes using [TheTVDB]
Auto-detected query: [The 100]
Fetching episode data for [The 100]
Fetching episode data for [The 100 Scariest Movie Moments]
Fetching episode data for [The 100 Lives of Black Jack Savage]
Apply filter [any{ age < 170 }{ airdate ? true : false }] on [70] items
Include [The 100 - 4x01 - Echoes]
Include [The 100 - 4x02 - Heavy Lies the Crown]
Include [The 100 - 4x03 - The Four Horsemen]
Include [The 100 - 4x04 - A Lie Guarded]
Include [The 100 - 4x05 - The Tinder Box]
Include [The 100 - 4x06 - We Will Rise]
Auto-detected query: [The 100]
Fetching episode data for [The 100]
Fetching episode data for [The 100 Scariest Movie Moments]
Fetching episode data for [The 100 Lives of Black Jack Savage]
Apply filter [any{ age < 170 }{ airdate ? true : false }] on [70] items
Include [The 100 - 4x01 - Echoes]
Include [The 100 - 4x02 - Heavy Lies the Crown]
Include [The 100 - 4x03 - The Four Horsemen]
Include [The 100 - 4x04 - A Lie Guarded]
Include [The 100 - 4x05 - The Tinder Box]
Include [The 100 - 4x06 - We Will Rise]
[MOVE] From [C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\The.100.S04E03.720p.HEVC.x265-MeGusta.eng.srt] to [D:\Shows\TV Shows\The 100\Season 04\The 100 - S04E03 - The Four Horsemen.srt]
[OVERRIDE] Delete [D:\Shows\TV Shows\The 100\Season 04\The 100 - S04E03 - The Four Horsemen.mkv]
[MOVE] From [C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\The.100.S04E03.720p.HEVC.x265-MeGusta.mkv] to [D:\Shows\TV Shows\The 100\Season 04\The 100 - S04E03 - The Four Horsemen.mkv]
Processed 2 files
Execute: filebot -script fn:sysenv 268592
# Environment Variables #
=::: ::\
USERDOMAIN_ROAMINGPROFILE: DESKTOP-P1DM9DN
PROCESSOR_LEVEL: 21
COMPUTERNAME: DESKTOP-P1DM9DN
ProgramW6432: C:\Program Files
CommonProgramFiles: C:\Program Files\Common Files
HOMEDRIVE: C:
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
PSExecutionPolicyPreference: Bypass
Path: C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Livestreamer;C:\Program Files\Process Lasso;C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder;C:\Program Files\Git\cmd;C:\Program Files (x86)\Streamlink\bin;C:\Users\JourneyOver\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin
MUSIC: false
SKIPEXTRACT: false
ComSpec: C:\Windows\system32\cmd.exe
NUMBER_OF_PROCESSORS: 6
SESSIONNAME: Console
HOMEPATH: \Users\JourneyOver
PROCESSOR_ARCHITECTURE: AMD64
TMP: C:\Users\JOURNE~1\AppData\Local\Temp
ACTION: move
PLEX: localhost:
LOCALAPPDATA: C:\Users\JourneyOver\AppData\Local
USERPROFILE: C:\Users\JourneyOver
DELETEAFTEREXTRACT: true
ARTWORK: false
ProgramFiles: C:\Program Files
ProgramFiles(x86): C:\Program Files (x86)
CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
windir: C:\Windows
PROCESSOR_IDENTIFIER: AMD64 Family 21 Model 2 Stepping 0, AuthenticAMD
CONFLICT: override
TORRENT_NAME: "The.100.S04E03.720p.HEVC.x265-MeGusta"
STOREREPORT: false
PROCESSOR_REVISION: 0200
FORMATPATH: "@/C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/MyStuff/Formatting.txt"
LOGONSERVER: \\DESKTOP-P1DM9DN
DESTINATION: D:/Shows
EXTRAS: false
SystemRoot: C:\Windows
USERDOMAIN: DESKTOP-P1DM9DN
CommonProgramW6432: C:\Program Files\Common Files
ALLUSERSPROFILE: C:\ProgramData
PUBLIC: C:\Users\Public
LOGDIR: C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/logs
SUBTITLES: en
TEMP: C:\Users\JOURNE~1\AppData\Local\Temp
=C:: C:\Windows\System32
OS: Windows_NT
TORRENT_PATH: "C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta"
CLEAN: true
ProgramData: C:\ProgramData
FILTERPATH2: "any{ age < 170 }{ airdate ? true : false }"
QT_BEARER_POLL_TIMEOUT: -1
QBITTORRENT: v3.3.10
PSModulePath: C:\Users\JourneyOver\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
OneDrive: C:\Users\JourneyOver\OneDrive
PROMPT: $P$G
SystemDrive: C:
USERNAME: JourneyOver
APPDATA: C:\Users\JourneyOver\AppData\Roaming


# Java System Properties #
path.separator: ;
jna.library.path: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\.
sun.desktop: windows
java.vm.name: Java HotSpot(TM) 64-Bit Server VM
java.io.tmpdir: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\data\tmp
user.country: US
sun.stderr.encoding: cp437
net.filebot.util.prefs.file: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\data\prefs.properties
user.home: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\data
useExtendedFileAttributes: true
org.apache.commons.logging.Log: org.apache.commons.logging.impl.NoOpLog
java.util.prefs.PreferencesFactory: net.filebot.util.prefs.FilePreferencesFactory
java.vm.vendor: Oracle Corporation
user.language: en
java.vendor: Oracle Corporation
java.vendor.url.bug: http://bugreport.sun.com/bugreport/
swing.crossplatformlaf: javax.swing.plaf.nimbus.NimbusLookAndFeel
sun.net.client.defaultReadTimeout: 60000
java.specification.name: Java Platform API Specification
jna.nosys: true
os.name: Windows 10
java.runtime.name: Java(TM) SE Runtime Environment
application.deployment: portable
file.separator: \
jna.boot.library.path: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\.
sun.net.client.defaultConnectTimeout: 10000
java.vm.specification.version: 1.8
sun.boot.class.path: C:\Program Files\Java\jre1.8.0_121\lib\resources.jar;C:\Program Files\Java\jre1.8.0_121\lib\rt.jar;C:\Program Files\Java\jre1.8.0_121\lib\sunrsasign.jar;C:\Program Files\Java\jre1.8.0_121\lib\jsse.jar;C:\Program Files\Java\jre1.8.0_121\lib\jce.jar;C:\Program Files\Java\jre1.8.0_121\lib\charsets.jar;C:\Program Files\Java\jre1.8.0_121\lib\jfr.jar;C:\Program Files\Java\jre1.8.0_121\classes
java.version: 1.8.0_121
http.agent: FileBot 4.7.8
java.library.path: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\.
awt.toolkit: sun.awt.windows.WToolkit
java.vm.specification.name: Java Virtual Machine Specification
os.version: 10.0
user.variant: 
useCreationDate: false
file.encoding: Cp1252
grape.root: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\data\grape
java.awt.printerjob: sun.awt.windows.WPrinterJob
java.class.version: 52.0
user.script: 
java.ext.dirs: C:\Program Files\Java\jre1.8.0_121\lib\ext;C:\Windows\Sun\Java\lib\ext
java.specification.version: 1.8
net.filebot.AcoustID.fpcalc: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\fpcalc.exe
java.vendor.url: http://java.oracle.com/
sun.os.patch.level: 
sun.java.launcher: SUN_STANDARD
os.arch: amd64
user.dir: C:\Windows\system32
user.timezone: 
line.separator: 

sun.cpu.endian: little
java.vm.specification.vendor: Oracle Corporation
java.home: C:\Program Files\Java\jre1.8.0_121
java.net.useSystemProxies: false
sun.management.compiler: HotSpot 64-Bit Tiered Compilers
sun.arch.data.model: 64
java.endorsed.dirs: C:\Program Files\Java\jre1.8.0_121\lib\endorsed
file.encoding.pkg: sun.io
java.specification.vendor: Oracle Corporation
sun.boot.library.path: C:\Program Files\Java\jre1.8.0_121\bin
sun.jnu.encoding: Cp1252
java.runtime.version: 1.8.0_121-b13
java.vm.info: mixed mode
java.vm.version: 25.121-b13
sun.io.unicode.encoding: UnicodeLittle
application.dir: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\data
java.awt.graphicsenv: sun.awt.Win32GraphicsEnvironment
sun.java.command: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\FileBot.jar -script fn:sysenv 268592
java.class.path: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\FileBot.jar
jna.nounpack: true
sun.cpu.isalist: amd64
user.name: JourneyOver


# Arguments #
args[0] = -script
args[1] = fn:sysenv
args[2] = 268592


Done ?(?????)?
Notify Plex: [host:localhost, token:]
GET: http://localhost:32400/library/sections/all/refresh?X-Plex-Token=
Clean clutter files and empty folders
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\Screens\screen0001.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\Screens\screen0002.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\Screens\screen0003.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\Screens\screen0004.png
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\The.100.S04E03.720p.HEVC.x265-MeGusta.nfo
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta\Screens
Delete C:\Users\JourneyOver\Desktop\QBT\The.100.S04E03.720p.HEVC.x265-MeGusta
Done ?(?????)?
Should I try with my old method but create a second filebot call in my script just for the ID and sonarr.bat execution and see if that works? :o
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

So might of figured out what is causing my sonarr.bat file to not execute fully.. for some reason having batch set temporary paths in the bat file for cURL and JQ ends up messing it up completely or something..

it goes through it's normal routine of everything and then once it goes to execute my sonarr.bat script it just does

Code: Select all

Execute: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff\T\Sonarr.bat "268592"
C:\Windows\system32>SET PATH=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Livestreamer;C:\Program Files\Process Lasso;C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder;C:\Program Files\Git\cmd;C:\Program Files (x86)\Streamlink\bin;C:\Users\JourneyOver\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder\bin;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder\vendor\git-for-windows\usr\bin
and doesn't produce anything else from my sonarr.bat script, when there should be at least several more lines produced for it.


Edit: Getting closer to solving this hopefully... I moved my path stuff down a bit and the script did a lot more this time around, I really dunno why it keeps trying to do everything in C:\Windows\system32 though for my sonarr.bat script.. Maybe that is what is messing it up in the end?

Edit2: well that was definitely not it.. various things and still haven't gotten it, this is about as close as I've gotten so far

Code: Select all

Execute: C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff\T\Sonarr.bat "268592"

C:\Windows\system32>cd C:\Users\JourneyOver\Desktop\Other2 

C:\Users\JourneyOver\Desktop\Other2>set infoId=268592 

C:\Users\JourneyOver\Desktop\Other2>set sonarrAPIkey=apikey

C:\Users\JourneyOver\Desktop\Other2>set path="C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder\bin;C:\Users\JourneyOver\Dropbox\Public\Folders\Cmder\vendor\git-for-windows\usr\bin" 

C:\Users\JourneyOver\Desktop\Other2>curl -s http://localhost:8989/api/series -H "X-Api-Key: apikey" --compressed   | jq -s ".[]| .[] | select(.tvdbId=="268592") | .id "   1>>temp.txt 
this bit here

Code: Select all

curl -s http://localhost:8989/api/series -H "X-Api-Key: apikey" --compressed   | jq -s ".[]| .[] | select(.tvdbId=="268592") | .id "   1>>temp.txt 
should create a temp.txt file in my other2 folder but it never does, it doesn't seem to be able to get past this part of my sonarr.bat script any and just continues finishing off notifying plex and cleaning up.

If I run

Code: Select all

curl -s http://localhost:8989/api/series -H "X-Api-Key: apikey" --compressed
   | jq -s ".[]| .[] | select(.tvdbId=="268592") | .id "   1>temp.txt
in just normal command prompt it outputs the correctly and makes the temp.txt document in my other2 folder, it's only when I am running it .bat wise and filebot wise that it seems to never create the file at all and get past that point.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

Gah this is so pissing me off.. no matter what I do or change I always get stuck on the

Code: Select all

curl -s http://localhost:8989/api/series -H "X-Api-Key: apikey" --compressed | jq -s ".[]| .[] | select(.tvdbId=="268592") | .id " >temp.txt
bit and it never goes past that for the sonarr bit of the script.. stressing me out way more than it should, going to cause me to have a panic attack.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

ZeroByDivide wrote:stressing me out way more than it should, going to cause me to have a panic attack.
You're yet you're still using CMD which is the cause of all that pain... That's the normal feeling when you try to do anything more complex than a one-liner in CMD...

:?: Why not use Groovy? You did that in the beginning and I basically gave you a near-complete solution already...
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:
ZeroByDivide wrote:stressing me out way more than it should, going to cause me to have a panic attack.
You're yet you're still using CMD which is the cause of all that pain... That's the normal feeling when you try to do anything more complex than a one-liner in CMD...

:?: Why not use Groovy? You did that in the beginning and I basically gave you a near-complete solution already...
because I don't understand the groovy language at all (i've tried and tried again to understand the language but have yet to understand it at all except for extremely basic things), like I said in my first post all I did was pull all the sonarr stuff from a pretty old repo (cowmix's repository). it looked like it was going to work becuase everything was pointing to the right stuff to get it to be correct but in the end it didn't, and your near-complete solution would of just caused the same outcome as how things are now where I just feel like giving up on life because I can never figure things out, all anything ever does anymore is just cause me stress to the point that I give up on everything.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

Here's a complete solution. Untested, but it's equivalent to what people in the Sonarr forums did:
https://forums.sonarr.tv/t/refreshserie ... d/10797/26

e.g.

Code: Select all

filebot -script update-sonarr.groovy --def id=281662

Code: Select all

// TheTVDB ID
def id = id as int

// API Configuration
def url = new URL('http://10.0.0.1:8989/api')
def header = ['X-Api-Key': '00000000']

def sonarrSeriesId = new JsonSlurper()
                         .parseText(new URL(url, 'series')
                         	            .get(header)
                         	            .text)
                         .find{ it.tvdbId == id }.id

println new URL(url, 'command').post(
	JsonOutput.toJson(
		[name: 'rescanSeries', seriesId: sonarrSeriesId]
	).getBytes('UTF-8'),
	'application/json',
	header
).text
You'll need to change the url and header variables for your sonarr instance.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:Here's a complete solution. Untested, but it's equivalent to what people in the Sonarr forums did:
https://forums.sonarr.tv/t/refreshserie ... d/10797/26

e.g.

Code: Select all

filebot -script update-sonarr.groovy --def id=281662

Code: Select all

// TheTVDB ID
def id = id as int

// API Configuration
def url = new URL('http://10.0.0.1:8989/api')
def header = ['X-Api-Key': '00000000']

def sonarrSeriesId = new JsonSlurper()
                         .parseText(new URL(url, 'series')
                         	            .get(header)
                         	            .text)
                         .find{ it.tvdbId == id }.id

println new URL(url, 'command').post(
	JsonOutput.toJson(
		[name: 'rescanSeries', seriesId: sonarrSeriesId]
	).getBytes('UTF-8'),
	'application/json',
	header
).text
You'll need to change the url and header variables for your sonarr instance.
Hmm will test out and see how it goes, hopefully everything works as it would be nice.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

Whenever I run the script either through testing phase or normal means I always seem to end up getting an error message in the end..

Code: Select all

Unable to determine the current character, it is not a string, number, array, or object

The current character read is '<' with an int value of 60
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
<!doctype html>
^
groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is '<' with an int value of 60
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
<!doctype html>
^
        at Script1.run(Script1.groovy:9)
        at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:64)
        at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:74)
        at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:122)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
        at net.filebot.Main.main(Main.java:115)

Failure (°_°)
running I test I am running the command

Code: Select all

filebot -script C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\MyStuff\T\update-sonarr.groovy --def id=268592
and the update-sonarr.groovy is this

Code: Select all

// TheTVDB ID
def id = id as int

// API Configuration
def url = new URL('http://localhost:8989/api')
def header = ['X-Api-Key': '91c2468dcb0a4f17a5cef20affb4d8be']

def sonarrSeriesId = new JsonSlurper()
                         .parseText(new URL(url, 'series')
                                        .get(header)
                                        .text)
                         .find{ it.tvdbId == id }.id

println new URL(url, 'command').post(
   JsonOutput.toJson(
      [name: 'rescanSeries', seriesId: sonarrSeriesId]
   ).getBytes('UTF-8'),
   'application/json',
   header
).text
I left a API key in there (with a few numbers changed to not match my own API but to show you what the sonarr API tends to be like), I tried with both localhost and my normal IP address and both of them come out to the same problem.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: MissingMethodException.. someone mind helping me out?

Post by rednoah »

Run this and post what it says:

Code: Select all

def url = new URL('http://localhost:8989/api')
def header = ['X-Api-Key': '91c2468dcb0a4f17a5cef20affb4d8be']

println new URL(url, 'series').get(header).text
You're seem to be getting back a HTML website when you should be getting JSON data.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: MissingMethodException.. someone mind helping me out?

Post by ZeroByDivide »

rednoah wrote:Run this and post what it says:

Code: Select all

def url = new URL('http://localhost:8989/api')
def header = ['X-Api-Key': '91c2468dcb0a4f17a5cef20affb4d8be']

println new URL(url, 'series').get(header).text
You're seem to be getting back a HTML website when you should be getting JSON data.
Getting this here when running

Code: Select all

<!doctype html>
<html>
<head>
    <title>Sonarr</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>

    <!-- Chrome, Opera, and Firefox OS -->
    <meta name="theme-color" content="#272727"/>
    <!-- Windows Phone -->
    <meta name="msapplication-navbutton-color" content="#272727"/>

    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>

    <link href="/Content/bootstrap.css?h=wcqjGP+NXU6zQB710jaZYA" rel='stylesheet' type='text/css'/>
    <link href="/Content/bootstrap.toggle-switch.css?h=zOaXXVYFa3wIaWmeJ2sr4g" rel='stylesheet' type='text/css'/>
    <link href="/Content/Messenger/messenger.css?h=qO6BkYDBjiMimxVChpoknA" rel='stylesheet' type='text/css'/>
    <link href="/Content/Messenger/messenger.flat.css?h=uXfH5hwpPgS6GV/TDVEpRw" rel='stylesheet' type='text/css'/>
    <link href="/Content/fullcalendar.css?h=SiHzEsP4NnnZIBo7IUDQnw" rel='stylesheet' type='text/css'>
    <link href="/Content/theme.css?h=lSePGUnTKxKSR5K4YxSzag" rel='stylesheet' type='text/css'/>
    <link href="/Content/cells.css?h=Ho/Q+SOyD7biS9YFK8ijvQ" rel='stylesheet' type='text/css'>
    <link href="/Content/series.css?h=IU/N0gS+iRHOd9kvKvimYw" rel='stylesheet' type='text/css'/>
    <link href="/Content/activity.css?h=qGb/lr8wlOFjP6ojdT/Fkg" rel='stylesheet' type='text/css'/>
    <link href="/Content/logs.css?h=DHA5Xdi32cMm+arZUwDTsQ" rel='stylesheet' type='text/css'/>
    <link href="/Content/settings.css?h=DwEuq9KRAHbuGST49xIOQg" rel='stylesheet' type='text/css'/>
    <link href="/Content/addSeries.css?h=MZh65ykhNcJhLqVkNSWvjQ" rel='stylesheet' type='text/css'/>
    <link href="/Content/calendar.css?h=0sc2cQoyh2GXxsdc1slapA" rel='stylesheet' type='text/css'/>
    <link href="/Content/update.css?h=y1X/Ux4RQDePx6ayJkGoIQ" rel='stylesheet' type='text/css'/>
    <link href="/Content/overrides.css?h=otCHWxvtUl/dtV42bX5a/w" rel='stylesheet' type='text/css'/>
    <link href="/Content/info.css?h=jf+rPHdtcdGib5t0QUZUIQ" rel='stylesheet' type='text/css'/>

    <link rel="apple-touch-icon" href="/Content/Images/touch/57.png?h=cYW4iAoiF8Umm1DHSzinJA"/>
    <link rel="apple-touch-icon" sizes="72x72" href="/Content/Images/touch/72.png?h=8iKZ1Ip3YAXGoD7q/n82Uw"/>
    <link rel="apple-touch-icon" sizes="114x114" href="/Content/Images/touch/114.png?h=9tDnXMrTFbU2OW5+X8wTkw"/>
    <link rel="apple-touch-icon" sizes="144x144" href="/Content/Images/touch/144.png?h=UFS9RLRUFxgLXaIGUYrQEg"/>
    <link rel="mask-icon" href="/Content/Images/safari/logo.svg" color="#35c5f4">
    <link rel="icon" type="image/ico" href="/Content/Images/favicon.ico?h=hnQH4IZszkSOw1Uy6Oe9Aw"/>

    <link rel="alternate" type="text/calendar" title="iCalendar feed for Sonarr" href="/feed/calendar/NzbDrone.ics"/>
</head>
<body>
<div class="container">
    <div id="nav-region"></div>
</div>
<div id="page">
    <div class="page-container">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12" id="notification-region"></div>
            </div>
            <div class="container-fluid main-region" id="main-region">
                <div id="followingBalls">
                    <div id="ball-1" class="ball"></div>
                    <div id="ball-2" class="ball"></div>
                    <div id="ball-3" class="ball"></div>
                    <div id="ball-4" class="ball"></div>
                </div>
            </div>
            <div id="modal-region"></div>
            <div id="modal-region2"></div>
        </div>
    </div>
    <div id="scroll-up">
        <i class="icon-sonarr-back-to-top visible-lg-inline" title="Back to the top!"></i>
    </div>
</div>
<div class="footer">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div id="footer-region">
                    Sonarr Ver.
                    <span class="version"></span>
                    <div class="branch"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="control-panel-region" class="control-panel"></div>
<div id="errors"></div>
</body>
<script type="text/javascript">
    window.NzbDrone = {
        ApiRoot    : '/api',
        ApiKey     : '91c2468dcb0a4f17a5cef20affb4d8be',
        Version    : '2.0.0.4599',
        Branch     : 'develop',
        Analytics  : true,
        UrlBase    : '',
        Production : true
    };
</script>

<script src="/polyfills.js?h=lNPw50dpfmIeXiK2IfrqdQ"></script>
<script src="/handlebars.runtime.js?h=VR1gUKhkPyiPuEfway9bag"></script>
<script src="/templates.js?h=jUR+dQ/koZOY18pSDp2qbA"></script>
<script src="/vendor.js?h=2FmIv+aUyiq+NMR9XjuFmQ"></script>
<script src="/main.js?h=lESoGy0EXfJy2YS3nWbgBQ"></script>
</html>

Done ?(?????)?
so you seem to be correct on getting back HTML for some odd reason..
Post Reply