gmyth-stream/server/main.py
branchtrunk
changeset 529 dfa28b22a36c
parent 514 b5352888e3c2
child 533 e55310730feb
     1.1 --- a/gmyth-stream/server/main.py	Mon Apr 09 16:22:37 2007 +0100
     1.2 +++ b/gmyth-stream/server/main.py	Thu Apr 12 13:22:53 2007 +0100
     1.3 @@ -71,23 +71,35 @@
     1.4      nextport += 1
     1.5      ret = media.setup(filename, mux, vcodec, vbitrate, fps, acodec,
     1.6                        abitrate, width, height, nextport, options)
     1.7 -    if ret == True:
     1.8 +    if ret:
     1.9          server.sendOk()
    1.10      else:
    1.11          server.sendNotOk(ret)
    1.12 +
    1.13      return True
    1.14  
    1.15  def do_play(server):
    1.16 -    media.play()
    1.17 -    server.sendOk("%d" % nextport)
    1.18 +    ret = media.play()
    1.19 +    if ret:
    1.20 +        server.sendOk("%d" % nextport)
    1.21 +    else:
    1.22 +        server.sendNotOk(ret)
    1.23 +
    1.24      return True
    1.25  
    1.26 -
    1.27  def do_stop(server):
    1.28      media.stop()
    1.29      server.sendOk()
    1.30      return True
    1.31  
    1.32 +def do_list(server, *directory):
    1.33 +    file_list = []
    1.34 +    for j in directory:
    1.35 +        list_media_files(j, file_list)
    1.36 +
    1.37 +    server.sendOk()
    1.38 +    return True
    1.39 +
    1.40  def do_quit(server):
    1.41      server.finish = 1
    1.42      media.stop()
    1.43 @@ -99,6 +111,7 @@
    1.44      "SETUP": do_setup,
    1.45      "PLAY": do_play,
    1.46      "STOP": do_stop,
    1.47 +    "LIST": do_list,
    1.48      "QUIT": do_quit,
    1.49      }
    1.50