gmyth-stream/server/lib.py
author rosfran
Mon Apr 09 15:20:37 2007 +0100 (2007-04-09)
branchtrunk
changeset 513 12a61040588d
parent 484 27e83a8f68d7
child 516 f353f0da6f07
permissions -rw-r--r--
[svn r518] Newly added GMythFileLocal, to deal with local stream files.
     1 import time
     2 import logging
     3 import os
     4 import stat
     5 
     6 def now():
     7     return time.strftime("%Y-%m-%d %H:%M:%S");
     8 
     9 def log(msg):
    10     logging.log(logging.DEBUG, msg)
    11     new_msg = "[%s] %s" % (now(), msg)
    12     return new_msg
    13 
    14 
    15 bin_path_list = os.environ["PATH"].split(os.pathsep)
    16 def which(prg):
    17     for d in bin_path_list:
    18         path = os.path.join(d, prg)
    19         if os.path.exits(path):
    20             st = os.stat(path)
    21             if st[stat.ST_MODE] & 0111:
    22                 return path
    23     return ""
    24 
    25