# Copyright (C) 2008 Simon Pantzare # See COPYING for details. import cherrypy from streamserver import StreamServer import os.path from code import interact # Let us first set up the streaming server and add some media to it. stream = StreamServer() media = [("m1.mp3", "Sample_MP3_1"), ("m2.mp3", "Sample_MP3_2"), ("va1.mpg", "Sample_MPEG"), ("vidonly1.mpg", "Sample_MPEG_video_only_1"), ("vidonly2.mpg", "Sample_MPEG_video_only_2")] for mp3 in range(0, 2): stream.addMP3(*media[mp3]) stream.addMPEG(*media[2]) for mpg in range(3, len(media)): stream.addMPEGVideo(*media[mpg]) # We could use a templating language but I think the extra dependencies is not # worth it in this case. html = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Streaming Server Demo</title> <script src="http://prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js" type="text/javascript"></script>
# See COPYING for details. import cherrypy from streamserver import StreamServer import os.path from code import interact # Let us first set up the streaming server and add some media to it. stream = StreamServer() media = [("m1.mp3", "Sample_MP3_1"), ("m2.mp3", "Sample_MP3_2"), ("va1.mpg", "Sample_MPEG"), ("vidonly1.mpg", "Sample_MPEG_video_only_1"), ("vidonly2.mpg", "Sample_MPEG_video_only_2")] for mp3 in range(0, 2): stream.addMP3(*media[mp3]) stream.addMPEG(*media[2]) for mpg in range(3, len(media)): stream.addMPEGVideo(*media[mpg]) # We could use a templating language but I think the extra dependencies is not # worth it in this case. html = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Streaming Server Demo</title> <script src="http://prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js" type="text/javascript"></script>