123456789101112131415161718192021222324252627 |
- import json
- import os
- AZAP_PATH = os.path.expanduser('~/.azap')
- CHANNELS_PATH = os.path.join(AZAP_PATH, 'channels.conf')
- def parse_config(filename='/code/fourier-config.json'):
- with open(filename, 'r') as fp:
- the_config = json.loads(fp.read())
- if 'localDatabase' not in the_config:
- the_config['localDatabase'] = os.path.join(
- the_config['basepath'],
- the_config['device_id'],
- 'files.db'
- )
- return the_config
- def prepare_channels(channels):
- if not os.path.isdir(AZAP_PATH):
- os.mkdir(AZAP_PATH)
- with open(CHANNELS_PATH, 'w') as f:
- for channel in channels:
- f.write((
- '{id}:{herz}:{modulation}:'
- '{videoID}:{audioID}:{serviceID}\n'
- ).format(**channel))
|