comparison python/dlna.py @ 656:4d9df2370659

STUB: python/dlna.py
author Jeff Hammel <k0scist@gmail.com>
date Sat, 29 Mar 2014 10:08:48 -0700
parents cd73d951ae5b
children 7f910ce4da04
comparison
equal deleted inserted replaced
655:cd73d951ae5b 656:4d9df2370659
23 parser.add_argument('--db-dir', dest='db_dir', 23 parser.add_argument('--db-dir', dest='db_dir',
24 default=os.path.join(os.environ['HOME'], 'minidlna'), 24 default=os.path.join(os.environ['HOME'], 'minidlna'),
25 help='db directory') 25 help='db directory')
26 parser.add_argument('-p', '--port', dest='port', default=8200, type=int, 26 parser.add_argument('-p', '--port', dest='port', default=8200, type=int,
27 help="port") 27 help="port")
28 parser.add_argument('-v', '--videos', dest='videos', nargs='+',
29 help="videos")
28 parser.add_argument('audio', nargs='+') 30 parser.add_argument('audio', nargs='+')
29 options = parser.parse_args(args) 31 options = parser.parse_args(args)
30 32
31 lines = [('friendly_name', options.name), 33 lines = [('friendly_name', options.name),
32 ('db_dir', options.db_dir), 34 ('db_dir', options.db_dir),
33 ('log_dir', options.db_dir), 35 ('log_dir', options.db_dir),
34 ('inotify', 'yes'), 36 ('inotify', 'yes'),
35 ('enable_tivo', 'yes')] 37 ('enable_tivo', 'yes')]
36 lines.extend([('media_dir', 'A,{}'.format(os.path.abspath(d))) 38 lines.extend([('media_dir', 'A,{}'.format(os.path.abspath(d)))
39 for d in options.audio])
40 lines.extend([('media_dir', 'V,{}'.format(os.path.abspath(d)))
37 for d in options.audio]) 41 for d in options.audio])
38 config = '\n'.join(['{}={}'.format(*line) for line in lines]) 42 config = '\n'.join(['{}={}'.format(*line) for line in lines])
39 print (config) 43 print (config)
40 44
41 fd, name = tempfile.mkstemp() 45 fd, name = tempfile.mkstemp()