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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
# File 'lib/ektoplayer/config.rb', line 95
def initialize
@options = Hash.new { |h,k| fail "Unknown option #{k}" }
@cast = {}
reg :database_file, 'Database file for storing ektoplazm metadata',
File.join(CONFIG_DIR, 'meta.db'),
File.method(:expand_path)
reg :log_file, 'File used for logging',
File.join(CONFIG_DIR, 'ektoplayer.log'),
File.method(:expand_path)
reg :temp_dir,
%{Temporary dir for downloading mp3 files.
They will be moved to `cache_dir` after the download completed and was successful.
Directory will be created if it does not exist, parent directories will not be created.},
'/tmp/.ektoplazm',
File.method(:expand_path)
reg :cache_dir,
'Directory for storing cached mp3 files',
File.join(Dir.home, '.cache', 'ektoplayer'),
File.method(:expand_path)
reg :archive_dir,
'Where to search for downloaded MP3 archives',
File.join(CONFIG_DIR, 'archives'),
File.method(:expand_path)
reg :download_dir,
'Where to store downloaded MP3 archives', '/tmp',
File.method(:expand_path)
reg :auto_extract_to_archive_dir,
%{Enable/disable automatic extraction of downloaded MP3
archives from `download_dir' to `archive_dir'}, true
reg :delete_after_extraction,
%{In combination `with auto_extract_to_archive_dir':
Delete zip archive after successful extraction}, true
reg :playlist_load_newest,
%{How many tracks from database should be added to
the playlist on application start.}, 1000
reg :use_cache,
%{Enable/disable local mp3 cache.
If this option is disabled, the downloaded mp3 files won't be moved
from `cache_dir`. Instead they will reside in `temp_dir` and will
be deleted on application exit.}, true
reg :prefetch,
'Enable prefetching the next track do be played', true
reg :small_update_pages,
'How many pages should be fetched after start', 5
reg :use_colors,
'Choose color capabilities. auto|mono|8|256', 'auto',
lambda { |v|
{ 'auto' => :auto, 'mono' => 0,
'8' => 8, '256' => 256 }[v] or fail 'invalid value'
}
reg :audio_system,
'Set output audio system. See option `-o` in mpg123(1)',
'pulse,alsa,jack,oss'
reg :threads,
'Number of download threads during database update',
20, lambda { |v| fail if Integer(v) < 1; Integer(v) }
reg 'playlist.format', 'Format of playlist columns',
DEFAULT_PLAYLIST_FORMAT, ColumnFormat.method(:parse_column_format)
reg 'playlist.format_256', 'Format of playlist columns (256 colors)',
DEFAULT_PLAYLIST_FORMAT_256, ColumnFormat.method(:parse_column_format)
reg 'browser.format', 'Format of browser columns',
DEFAULT_PLAYLIST_FORMAT, ColumnFormat.method(:parse_column_format)
reg 'browser.format_256', 'Format of browser columns (256 colors)',
DEFAULT_PLAYLIST_FORMAT_256, ColumnFormat.method(:parse_column_format)
reg 'progressbar.display',
'Enable/disable progressbar', true
reg 'progressbar.progress_char',
'Character used for displaying playing progress', ?~
reg 'progressbar.rest_char',
'Character used for the rest of the line', ?~
reg 'playinginfo.display',
'Enable/display playinginfo', true
reg 'playinginfo.format_top',
'Format of first line in playinginfo',
DEFAULT_PLAYINGINFO_FORMAT_TOP,
ColumnFormat.method(:parse_simple_format)
reg 'playinginfo.format_top_256',
'Format of first line in playinginfo (256 colors)',
DEFAULT_PLAYINGINFO_FORMAT_TOP_256,
ColumnFormat.method(:parse_simple_format)
reg 'playinginfo.format_bottom',
'Format of second line in playinginfo',
DEFAULT_PLAYINGINFO_FORMAT_BOTTOM,
ColumnFormat.method(:parse_simple_format)
reg 'playinginfo.format_bottom_256',
'Format of second line in playinginfo (256 colors)',
DEFAULT_PLAYINGINFO_FORMAT_BOTTOM_256,
ColumnFormat.method(:parse_simple_format)
reg 'tabbar.display',
'Enable/disable tabbar', true
reg 'tabs.widgets', 'Specify widget order of tabbar (left to right)',
'splash,playlist,browser,info,help',
lambda { |v| v.split(/\s*,\s*/).map(&:to_sym) }
reg 'main.widgets', 'Specify widgets to show (up to down)',
'playinginfo,tabbar,windows,progressbar',
lambda { |v| v.split(/\s*,\s*/).map(&:to_sym) }
end
|