##################################################<br />
<br />
VIDEO_PREFIX = "/video/ptp"<br />
<br />
NAME = "Pass The Popcorn"<br />
<br />
ART = 'art-default.jpg'<br />
ICON = 'icon-default.png'<br />
<br />
##################################################<br />
<br />
def Start():<br />
<br />
Plugin.AddPrefixHandler(VIDEO_PREFIX, MainMenu, NAME, ICON, ART)<br />
Plugin.AddViewGroup("List", viewMode = "List", mediaType = "items")<br />
<br />
MediaContainer.art = R(ART)<br />
MediaContainer.title1 = NAME<br />
MediaContainer.viewGroup = "List"<br />
DirectoryItem.thumb = R(ICON)<br />
<br />
def MainMenu():<br />
<br />
dir = MediaContainer(viewMode="List")<br />
dir.Append(Function(DirectoryItem(MostRecent, "Most Recent")))<br />
dir.Append(PrefsItem(L('Preferences'), thumb=R('icon-default.png')))<br />
<br />
return dir<br />
<br />
def MostRecent(sender):<br />
<br />
u = Prefs['username']<br />
p = Prefs['password']<br />
<br />
req = HTTP.Request('http://passthepopcorn.me/torrents.php')<br />
HTTP.SetPassword('http://passthepopcorn.me', u, p)<br />
req.load()<br />
res = req.content<br />
<br />
Log(res)<br />
<br />
return MessageContainer('Result', L(res))
Right now I'm kinda just hacking around and sending the result of the HTTP.Request to a MessageContainer to see if it worked. This works when I DO NOT include the line to HTTP.SetPassword, but when I do include that line, I receive an error in my log. Here's the line in the log that is of note:
2012-12-11 02:14:41,676 (-4faed000) : CRITICAL (sandbox:303) - Exception when calling function 'MostRecent' (most recent call last):<br />
File "/Users/thorson/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 294, in call_named_function<br />
result = f(*args, **kwargs)<br />
File "/Users/thorson/Library/Application Support/Plex Media Server/Plug-ins/passThePopcorn.bundle/Contents/Code/__init__.py", line 38, in MostRecent<br />
HTTP.SetPassword('http://passthepopcorn.me', u, p)<br />
File "/Users/thorson/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/base.py", line 55, in func<br />
return f(self, *args, **kwargs)<br />
File "/Users/thorson/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/networkkit.py", line 218, in SetPassword<br />
return self._core.networking.set_http_password(url, username, password, realm)<br />
File "/Users/thorson/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 420, in set_http_password<br />
if _global_http_auth_enabled:<br />
NameError: global name '_global_http_auth_enabled' is not defined
Let me know if you have any ideas or if I'm going about this all wrong. Thanks in advance for any assistance, I really appreciate it.