1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-26 01:38:57 -05:00
filebot/website/scripts/lib/plex.groovy
2012-07-10 05:14:43 +00:00

15 lines
503 B
Groovy

// plex functions
def refreshPlexLibrary(server, port = 32400, files = null) {
def sections = new URL("http://$server:$port/plex").getXml()
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()
}
}