filebot/website/scripts/lib/plex.groovy

15 lines
503 B
Groovy
Raw Normal View History

2012-07-10 05:14:43 +00:00
// 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()
}
}