* update plex notify url
This commit is contained in:
parent
b81845e277
commit
7b8430ab65
|
@ -22,19 +22,9 @@ def invokeScanVideoLibrary(host, port = 9090) {
|
||||||
/**
|
/**
|
||||||
* Plex helpers
|
* Plex helpers
|
||||||
*/
|
*/
|
||||||
def refreshPlexLibrary(server, port = 32400, files = null) {
|
def refreshPlexLibrary(server, port = 32400) {
|
||||||
_guarded {
|
_guarded {
|
||||||
def sections = new URL("http://$server:$port/library/sections/").getXml()
|
new URL("http://$server:$port/library/sections/all/refresh").get()
|
||||||
def locations = sections.Directory.Location.collect{ [path:it.'@path', key:it.parent().'@key'] }
|
|
||||||
|
|
||||||
// limit refresh locations
|
|
||||||
if (files != null) {
|
|
||||||
locations = locations.findAll{ loc -> files.find{ it.path; it.path.startsWith(loc.path) }}
|
|
||||||
}
|
|
||||||
|
|
||||||
locations*.key.unique().each{ key ->
|
|
||||||
new URL("http://$server:$port/library/sections/$key/refresh/").get()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue