Guest User

PlexconnectTheuns

a guest
Jun 11th, 2013
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. Your ATV model (2 or 3) and firmware version (found under the ATV settings > general > about > Apple TV software): APTV3 5.2.1
  2.  
  3. The DNS server set on the ATV (found under the ATV settings > general > network > DNS): 192.168.0.100 PMS Server
  4.  
  5.  
  6. The device and operating system (including version number) that PlexConnect is installed on:
  7. Win8 : Plex Media Server 0.9.7.27-d02a10a
  8.  
  9. The local IP address of the device that PlexConnect is installed on: 192.168.0.100
  10.  
  11. The device and operating system (including version number) that the Plex media server (PMS) is installed on:
  12. Win8 : Plex Media Server 0.9.7.27-d02a10a
  13. The local IP address of the device that the Plex media server (PMS) is installed on:
  14. 192.168.0.100
  15. Where your media is stored (e.g. internal drive):
  16. External Drive
  17. The PlexConnect version number. If using Github source then a time and date of download (look at the creation date of the folder) and if you are using any testing branch e.g. the Elan/PlexInc one.
  18. Latest, and previous versions tested
  19.  
  20. The content of your 'Settings.cfg' file (if you do not have this file you are running an old version, please update)
  21. #!/usr/bin/python
  22.  
  23. import sys
  24. from os import sep
  25. import ConfigParser
  26.  
  27. from Debug import * # dprint()
  28.  
  29.  
  30.  
  31. """
  32. Global Settings...
  33. PMS: plexgdm, ip_pms, port_pms
  34. DNS: ip_dnsmaster - IP of Router, ISP's DNS, ... [dflt: google public DNS]
  35. HTTP: ip_httpforward, port_httpforward
  36. """
  37. g_settings = { \
  38. 'enable_plexgdm' :('True', 'False'), \
  39. 'ip_pms' :('192.168.0.100',), \
  40. 'port_pms' :('32400',), \
  41. \
  42. 'enable_dnsserver':('True', 'False'), \
  43. 'ip_dnsmaster' :('192.168.0.111',), \
  44. }
  45.  
  46.  
  47.  
  48. class CSettings():
  49. def __init__(self):
  50. dprint(__name__, 1, "init class CSettings")
  51. self.cfg = None
  52. self.section = 'PlexConnect'
  53. self.loadSettings()
  54. self.checkSection()
  55.  
  56.  
  57.  
  58. # load/save config
  59. def loadSettings(self):
  60. dprint(__name__, 1, "load settings")
  61. # options -> default
  62. dflt = {}
  63. for opt in g_settings:
  64. dflt[opt] = g_settings[opt][0]
  65.  
  66. # load settings
  67. self.cfg = ConfigParser.SafeConfigParser()
  68. self.cfg.read(self.getSettingsFile())
  69.  
  70. def saveSettings(self):
  71. dprint(__name__, 1, "save settings")
  72. f = open(self.getSettingsFile(), 'wb')
  73. self.cfg.write(f)
  74. f.close()
  75.  
  76. def getSettingsFile(self):
  77. return sys.path[0] + sep + "Settings.cfg"
  78.  
  79. def checkSection(self):
  80. modify = False
  81. # check for existing section
  82. if not self.cfg.has_section(self.section):
  83. modify = True
  84. self.cfg.add_section(self.section)
  85. dprint(__name__, 0, "add section {0}", self.section)
  86.  
  87. for opt in g_settings:
  88. if not self.cfg.has_option(self.section, opt):
  89. modify = True
  90. self.cfg.set(self.section, opt, g_settings[opt][0])
  91. dprint(__name__, 0, "add option {0}={1}", opt, g_settings[opt][0])
  92.  
  93. # save if changed
  94. if modify:
  95. self.saveSettings()
  96.  
  97.  
  98.  
  99. # access/modify PlexConnect settings
  100. def getSetting(self, option):
  101. dprint(__name__, 1, "getsetting {0}", self.cfg.get(self.section, option))
  102. return self.cfg.get(self.section, option)
  103.  
  104.  
  105.  
  106. if __name__=="__main__":
  107. Settings = CSettings()
  108.  
  109. option = 'enable_plexgdm'
  110. print Settings.getSetting(option)
  111.  
  112. option = 'enable_dnsserver'
  113. print Settings.getSetting(option)
  114.  
  115. Settings.saveSettings()
  116. del Settings
Advertisement
Add Comment
Please, Sign In to add comment