Changeset b730537fa74f1d549f46603218ca8ab1700efad0

Show
Ignore:
Timestamp:
03/07/08 20:48:44 (10 months ago)
Author:
KRKeegan <-NOSPAM-kevin@krkeegan.com>
git-committer:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1204944524 -0800
git-parent:

[9181fdc59b81e2b2ba4ce1399eba2997d24b6f65], [d701b66d5543d85805e657997dcfc4a7332f6111]

git-author:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1204944524 -0800
Message:

Merge branch 'master' of git://repo.or.cz/pyTivo/wgw

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • config.py

    r73b49cd r4dcb0e0  
    8686    return shares 
    8787 
    88 def getDebug(): 
    89     try: 
    90         return config.getboolean('Server', 'debug') 
    91     except NoOptionError, ValueError: 
    92         return False 
     88def getDebug(ref): 
     89    if config.has_option('Server', 'debug'): 
     90        try: 
     91            return str2tuple(config.get('Server', 'debug')+',,')[ref] 
     92        except NoOptionError: 
     93            pass 
     94    return str2tuple('False,,')[ref] 
    9395 
    9496def getHack83(): 
     
    220222def getBuffSize(): 
    221223    try: 
    222         return config.get('Server', 'bufsize'
     224        return str(int(strtod(config.get('Server', 'bufsize')))
    223225    except NoOptionError: #default 1024k 
    224226        return '1024k' 
     
    235237    except NoOptionError:  
    236238        return int(448) #default to 448 
     239 
     240def str2tuple(s): 
     241    items = s.split(',') 
     242    L = [x.strip() for x in items] 
     243    return tuple(L) 
    237244 
    238245# Parse a bitrate using the SI/IEEE suffix values as if by ffmpeg 
  • debug.py

    r76b6596 r4dcb0e0  
    11import ConfigParser, os, re, sys 
    22import config 
     3import datetime  
     4 
    35p = os.path.dirname(__file__) 
    46 
    57def debug_write(srcMod, fnAttr, data): 
    6     if config.getDebug()
     8    if config.getDebug(0).lower() == 'true'
    79        debug_out = [] 
    810        modname=srcMod.split('.')[-1] 
     
    1012        for x in data: 
    1113            debug_out.append(str(x)) 
    12         fdebug = open('debug.txt', 'a') 
     14        fpath = p 
     15        fname = [] 
     16        fname.append('debug') 
     17        if not config.getDebug(1) == '' or not config.getDebug(2) == '': 
     18            if os.path.isdir(config.getDebug(1)): 
     19                fpath = config.getDebug(1) 
     20            fname.append(os.path.split(os.path.dirname(__file__))[-1]) 
     21            if config.getDebug(2).lower() == 'split':  
     22                fname.append(modname) 
     23        fname.append('txt') 
     24        fdebug = open(os.path.join(fpath, '.'.join(fname)), 'a') 
    1325        fdebug.write(' '.join(debug_out)+'\n') 
    1426        print '___'+' '.join(debug_out) 
     
    2032 
    2133def print_conf(srcMod, fnAttr): 
    22     if config.getDebug(): 
     34    if config.getDebug(0).lower() == 'true': 
     35        debug_write(srcMod, fnAttr, ['********************************************************'])  
     36        debug_write(srcMod, fnAttr, ['**  Begin pyTivo Session:', datetime.datetime.today(), ' **'])  
     37        debug_write(srcMod, fnAttr, ['********************************************************'])  
    2338        debug_write(srcMod, fnAttr, ['----- begin pyTivo.conf -----']) 
    2439        conf = open(os.path.join(p, 'pyTivo.conf'))