gmyth-stream/server/lib.py
branchtrunk
changeset 529 dfa28b22a36c
parent 511 16312d0021cb
child 533 e55310730feb
     1.1 --- a/gmyth-stream/server/lib.py	Fri Apr 06 22:58:06 2007 +0100
     1.2 +++ b/gmyth-stream/server/lib.py	Thu Apr 12 13:22:53 2007 +0100
     1.3 @@ -3,6 +3,8 @@
     1.4  import os
     1.5  import stat
     1.6  
     1.7 +global ext = ['mpg', 'avi', 'mp4', 'nuv', 'mpeg', 'mov']
     1.8 +
     1.9  def now():
    1.10      return time.strftime("%Y-%m-%d %H:%M:%S");
    1.11  
    1.12 @@ -22,4 +24,13 @@
    1.13                  return path
    1.14      return ""
    1.15  
    1.16 +def list_media_files(directory, file_list):
    1.17 +    for root, dirs, files in os.walk(directory):
    1.18 +        for name in files:
    1.19 +            if os.path.splitext(name)[1].strip(".") in ext:
    1.20 +                media = os.path.join(root,name)
    1.21 +                if media not in file_list
    1.22 +                file_list.append(os.path.join(root,name))
    1.23  
    1.24 +    return True
    1.25 +