~ubuntu-branches/ubuntu/maverick/coherence/maverick

« back to all changes in this revision

Viewing changes to bin/coherence

  • Committer: Bazaar Package Importer
  • Author(s): Charlie Smotherman
  • Date: 2010-01-02 10:57:15 UTC
  • mfrom: (1.1.7 upstream) (3.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100102105715-sghzl2nw4lr5b1ob
Tags: 0.6.6.2-1
*  New  upstream release, summary of changes:
    - adding all necessary files to MANIFEST.in, to compensate for the
      gone 'auto-include-all-files-under-version-control' setuptools
      feature.
    - rearranging genre and genres attribute in DIDLLite - thx Caleb  
    - fix face_path typo, fixes #275.   

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
""" Coherence is a framework to host DLNA/UPnP devices
9
9
 
10
10
    For more information about it and its available backends
11
 
    point your browser to: http://coherence.beebits.net
 
11
    point your browser to: http://coherence-project.org
12
12
"""
13
13
 
14
14
import os, sys
15
15
 
16
16
import string
17
17
 
18
 
from twisted.python import usage, text
19
 
 
20
 
 
21
18
from coherence import __version__
22
19
 
23
20
from coherence.extern.simple_config import Config,ConfigItem
24
21
 
 
22
from twisted.python import usage, text
 
23
 
 
24
 
25
25
"""
26
26
 thankfully taken from twisted.scripts._twistd_unix.py
27
27
"""
252
252
    #                       'Player': {})
253
253
    #c.add_plugin('FSStore', content_directory='tests/content', version=1)
254
254
 
 
255
 
255
256
if __name__ == '__main__':
256
257
 
257
258
    options = Options()
262
263
        print '%s: Try --help for usage details.' % (sys.argv[0])
263
264
        sys.exit(0)
264
265
 
265
 
    if options['daemon'] == 1:
266
 
        daemonize()
 
266
    try:
 
267
        if options['daemon'] == 1:
 
268
            daemonize()
 
269
    except:
 
270
        print traceback.format_exc()
267
271
 
268
272
    config = {}
269
273
 
283
287
            print "no config file %r found" % options['configfile']
284
288
            pass
285
289
 
286
 
    for k,v in options['options'].items():
287
 
        config[k] = v
288
 
 
289
 
 
290
290
    if options['logfile'] != None:
291
 
        if isinstance(config,ConfigItem):
292
 
            config['logging'] = {}
 
291
        if isinstance(config,(ConfigItem,dict)):
 
292
            if 'logging' not in config:
 
293
                config['logging'] = {}
293
294
            config['logging']['logfile'] = options['logfile']
294
295
        else:
295
296
            config['logfile'] = options['logfile']
296
297
 
 
298
    for k,v in options['options'].items():
 
299
        if k == 'logfile':
 
300
            continue
 
301
        config[k] = v
 
302
 
297
303
    if options['daemon'] == 1:
298
 
        if options['logfile'] == None:
299
 
            if isinstance(config,ConfigItem):
300
 
                config.get('logging').get('level','none')
301
 
            else:
 
304
        if isinstance(config,(ConfigItem,dict)):
 
305
            if config.get('logging',None) == None:
 
306
                config['logging'] = {}
 
307
            if config['logging'].get('logfile',None) == None:
 
308
                config['logging']['level'] = 'none'
 
309
                try:
 
310
                    del config['logging']['logfile']
 
311
                except KeyError:
 
312
                    pass
 
313
        else:
 
314
            if config.get('logfile',None) == None:
302
315
                config.set('logmode','none')
303
 
 
304
 
    #print config
 
316
                try:
 
317
                    del config['logfile']
 
318
                except KeyError:
 
319
                    pass
305
320
 
306
321
    if(config.get('use_dbus', 'no') == 'yes' or
307
322
       config.get('glib', 'no') == 'yes' or