-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefaultConfigMopidy.py
128 lines (105 loc) · 4.37 KB
/
defaultConfigMopidy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
try:
import configparser
except:
import ConfigParser as configparser
config_file = "/etc/mopidy/mopidy.conf"
config = configparser.ConfigParser()
config.read(config_file)
def core_defaults():
config['core']['cache_dir'] = '/var/cache/mopidy'
config['core']['config_dir'] = '/etc/mopidy'
config['core']['data_dir'] = '/var/lib/mopidy'
def logging_defaults():
config['logging']['config_file'] = '/etc/mopidy/logging.conf'
config['logging']['debug_file'] = '/var/log/mopidy/mopidy-debug.log'
def local_defaults():
config['local']['enabled'] = 'True'
config['local']['media_dir'] = '/Music \n /usbdrives'
config['local']['library'] = 'sqlite'
config['local']['scan_timeout'] = '1000'
config['local']['scan_flush_threshold'] = '100'
config['local']['scan_follow_symlinks'] = 'true'
config['local']['excluded_file_extensions'] = '\n .directory\n .html\n .jpeg\n .jpg\n .log\n .nfo\n .png\n .txt\n .db\n .ini'
def file_defaults():
config['file']['enabled'] = 'True'
config['file']['media_dirs'] = '/Music \n /usbdrives'
config['file']['excluded_file_extensions'] = '\n .directory\n .html\n .jpeg\n .jpg\n .log\n .nfo\n .png\n .txt\n .db\n .ini'
config['file']['show_dotfiles'] = 'false'
config['file']['follow_symlinks'] = 'false'
config['file']['metadata_timeout'] = '1000'
def m3u_defaults():
config['m3u']['playlists_dir'] = '/var/lib/mopidy/playlists'
def http_defaults():
config['http']['enabled'] = 'True'
config['http']['hostname'] = '::'
config['http']['port'] = '8888'
config['http']['static_dir'] = ""
config['http']['zeroconf'] = 'Mopidy HTTP server on $hostname'
def mpd_defaults():
config['mpd']['enabled'] = 'True'
config['mpd']['hostname'] = '::'
config['mpd']['port'] = '6600'
config['mpd']['password'] = ''
config['mpd']['max_connections'] = '20'
config['mpd']['connection_timeout'] = '60'
config['mpd']['zeroconf'] = 'Mopidy MPD server on $hostname'
config['mpd']['command_blacklist'] = ' listall\n listallinfo'
config['mpd']['default_playlist_scheme'] = 'm3u'
def websettings_defaults():
config['websettings']['enabled'] = 'True'
config['websettings']['musicbox'] = 'True'
config['websettings']['config_file'] = '/etc/mopidy/mopidy.conf'
def spotify_defaults(spotify_user = '', spotify_client_id = '', spotify_client_secret = '', spotify_password = ''):
config['spotify']['enabled'] = 'True'
config['spotify']['username'] = spotify_user
config['spotify']['client_id'] = spotify_client_id
config['spotify']['client_secret'] = spotify_client_secret
config['spotify']['password'] = spotify_password
config['spotify']['bitrate'] = '320'
def spotify_web_defaults(spotify_user = '', spotify_client_id = '', spotify_client_secret = '', spotify_password = ''):
config['spotify_web']['enabled'] = 'True'
config['spotify_web']['username'] = spotify_user
config['spotify_web']['client_id'] = spotify_client_id
config['spotify_web']['client_secret'] = spotify_client_secret
config['spotify_web']['password'] = spotify_password
config['spotify_web']['bitrate'] = '320'
def audio_defaults():
config['audio']['mixer_volume'] = '100'
config['audio']['mixer'] = 'software'
# config['audio']['output'] = 'alsasink device=hw:1,0'
config['audio']['output'] = 'alsasink device=default'
if not config.has_section('core'):
config.add_section('core')
if not config.has_section('logging'):
config.add_section('logging')
if not config.has_section('local'):
config.add_section('local')
if not config.has_section('file'):
config.add_section('file')
if not config.has_section('m3u'):
config.add_section('m3u')
if not config.has_section('http'):
config.add_section('http')
if not config.has_section('mpd'):
config.add_section('mpd')
if not config.has_section('websettings'):
config.add_section('websettings')
if not config.has_section('spotify'):
config.add_section('spotify')
if not config.has_section('spotify_web'):
config.add_section('spotify_web')
if not config.has_section('audio'):
config.add_section('audio')
core_defaults()
logging_defaults()
local_defaults()
file_defaults()
m3u_defaults()
http_defaults()
mpd_defaults()
websettings_defaults()
spotify_defaults()
spotify_web_defaults()
audio_defaults()
with open(config_file, 'wb') as configfile:
config.write(configfile)