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(' = ')) }
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
}
Code: Select all
sonarr = tryQuietly{ !'TEST'.equalsIgnoreCase(_args.action) ? apiInfo(sonarr.toString()) : null }
radarr = tryQuietly{ !'TEST'.equalsIgnoreCase(_args.action) ? apiInfo(radarr.toString()) : null }
Code: Select all
if (artwork || kodi || plex || emby || sonarr || radarr) { include('lib/htpc') }
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)
}
}
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"
}
}
}
}
}
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()
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 ヾ(@⌒ー⌒@)ノ
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 ?(?????)?