2009-02-24, 06:58
TheB Wrote:I think there may be issues in the current SVN win32 builds with popen (see the bottom of this thread)
yep, popen is broken on win32 for xbmc.
I can't get gnash to work on my system, and after a long day at work I don't want to play with it, but this is what I have so far, and I believe it would work if gnash was...
Code:
#!/usr/bin/python
import os
import re
import subprocess
import common
PID_RE = re.compile("hulupid=(.*)")
def hulu_decrypt(pid):
gnash = common.settings['gnash_path']
currentPath = os.path.dirname(os.path.realpath(__file__))
swf = os.path.join(currentPath, "DecryptPid.swf")
if os.environ.get( 'OS', 'xbox' ) == 'win32':
sysargs = '"%s" -r 0 -1 -v -P FlashVars=pid=%s' % (swf, pid)
outputFilePath = os.path.join(currentPath,'output.txt')
os.system('"%sgnash" %s>"%s"' %(gnash,sysargs,outputFilePath))
outputFile = open(outputFilePath,'r')
output = outputFile.read()
outputFile.close()
os.remove(outputFilePath)
else:
args = [gnash, "--render-mode", "0", "--once", "--verbose", "--param", "FlashVars=pid=%s" % pid, swf]
output = subprocess.Popen(args, executable=gnash, bufsize=1, universal_newlines=True, stdout=subprocess.PIPE).communicate()[0]
print output
match = PID_RE.search(output)
if match:
return match.group(1)