REQ: PSP media player streaming using xbox python
#1
theres a great media player out for the psp which plays files specially converted for it and now it is possible to stream these files from your pc using a python server. so im just wondering if anyone who's good at python would know if its possible to have this server running from the xbox and have all your converted files stored on the xbox hd.

http://pspupdates.qj.net/2006....omments

here's the python server code:
################################################################################
# pmp server
# copyright © 2006 david voswinkel
#
# homepage: http://optixx.org
# e-mail: [email="[email protected]"][email protected][/email]
#
# this program is free software; you can redistribute it and/or modify
# it under the terms of the gnu general public license as published by
# the free software foundation; either version 2 of the license, or
# (at your option) any later version.

# this program is distributed in the hope that it will be useful,
# but without any warranty; without even the implied warranty of
# merchantability or fitness for a particular purpose. see the
# gnu general public license for more details.
#
# you should have received a copy of the gnu general public license
# along with this program; if not, write to the free software
# foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
################################################################################

import re
import os
import sys
import string
import linecache
import traceback
import basehttpserver
import threading
import urllib
import urlparse
import types


# curl "[url]http://localhost:3333/open?filename=movie.avi&flags=o_rdonly"[/url]
# curl "[url]http://localhost:3333/read?fd=1&size=100"[/url]
# curl "[url]http://localhost:3333/lseek?fd=1&offset=1000&whence=1"[/url]
# curl "[url]http://localhost:3333/close?fd=1"[/url]

import platform

if platform.system() == 'windows':
root="c:\movies"
else:
root="/movies"

class httpserver(basehttpserver.httpserver):

def (self,addr,handler):
basehttpserver.httpserver.(self,addr,handler)
self.requesthandlerclass.subjects = {}
self.fds = {}

class fileioobject:

def (self,fd,name):
self.name = name
self.mutex = threading.semaphore(1)
self.fd = fd


class fileioserver(basehttpserver.basehttprequesthandler):

fd_max = 0
mutex.acquire()
fileioserver.fd_max +1
net_fd = fileioserver.fds[net_fd] = fo
sys.stderr.write("create %s net:%i fd:%s \n" % ( filename, net_fd, fileno))
except:
et, ev, tb = sys.exc_info()
sys.stderr.write("error: %s %s\n" % (et,ev))
fileioserver.mutex.release()
return net_fd


def fileioread(self,*args,**kwds):
try:
fo = none
net_fd = int(kwds['fd'])
size = int(kwds['size'])
fileioserver.fds.has_key(net_fd):
fileioserver.fds[net_fd]
fo.mutex.acquire()
fileioserver.mutex.release()
if fo:
fo.mutex.release()
et, ev, tb = sys.exc_info()
sys.stderr.write("error: %s %s\n" % (et,ev))
return "-1"

return recv_data

def fileiolseek(self,*args,**kwds):
try:
fo = none
net_fd = int(kwds['fd'])
offset = int(kwds['offset'])
whence = int(kwds['whence'])
fileioserver.fds.has_key(net_fd):
fileioserver.fds[net_fd]
fo.mutex.acquire()
fileioserver.mutex.release()
if fo:
fo.mutex.release()
et, ev, tb = sys.exc_info()
sys.stderr.write("error: %s %s\n" % (et,ev))
return "-1"
return str(ret)

def fileioclose(self,*args,**kwds):
try:
fo = none
net_fd = int(kwds['fd'])
fileioserver.fds.has_key(net_fd):
fileioserver.fds[net_fd]
ret = os.close(fo.fd)
sys.stderr.write("close %s net:%i fd:%s \n" % (fo.name,net_fd, fo.fd))
fo.mutex.release()
del fileioserver.mutex.release()
except:
fileioserver.namemain__':
try:
httpd = httpserver(('',3333),fileioserver)
while true:
httpd.handle_request()
except exception, argument:
et, ev, tb = sys.exc_info()
sys.stderr.write('#' * 60 + '\n')
sys.stderr.write('exception:%s %s\n' % (et,ev))
while tb:
co = tb.tb_frame.f_code
filename = co.co_filename
linenum = traceback.tb_lineno(tb),
line = linecache.getline(filename,linenum[0])
line = re.compile('[\n\t]+|[ ]{2,1000}').sub(' ',line)
sys.stderr.write("file: %s line: %6s code: '%s' \n" % (filename,linenum[0],line))
tb = tb.tb_next
sys.stderr.write('#' * 60 + '\n')
Reply

Logout Mark Read Team Forum Stats Members Help
REQ: PSP media player streaming using xbox python0