Created
January 6, 2014 08:41
-
-
Save ghuntley/8279917 to your computer and use it in GitHub Desktop.
plex media server library refresh all libraries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib | |
from xml.dom import minidom | |
host = 'localhost' | |
source_type = ['movie', 'show'] # Valid values: artist (for music), movie, show (for tv) | |
base_url = 'http://%s:32400/library/sections' % host | |
refresh_url = '%s/%%s/refresh?force=1' % base_url | |
try: | |
xml_sections = minidom.parse(urllib.urlopen(base_url)) | |
sections = xml_sections.getElementsByTagName('Directory') | |
for s in sections: | |
if s.getAttribute('type') in source_type: | |
url = refresh_url % s.getAttribute('key') | |
x = urllib.urlopen(url) | |
except: | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib | |
from xml.dom import minidom | |
host = 'localhost' | |
source_type = ['movie', 'show'] # Valid values: artist (for music), movie, show (for tv) | |
base_url = 'http://%s:32400/library/sections' % host | |
refresh_url = '%s/%%s/refresh' % base_url | |
try: | |
xml_sections = minidom.parse(urllib.urlopen(base_url)) | |
sections = xml_sections.getElementsByTagName('Directory') | |
for s in sections: | |
if s.getAttribute('type') in source_type: | |
url = refresh_url % s.getAttribute('key') | |
x = urllib.urlopen(url) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is no need to do per section if your intent is to refresh all. Example:
/library/sections/all/refresh?force=1