1#!/usr/bin/python3 -OO
2# Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org>
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version 2
7# of the License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17
18"""
19sabnzbd.cfg - Configuration Parameters
20"""
21import re
22
23import sabnzbd
24from sabnzbd.config import (
25    OptionBool,
26    OptionNumber,
27    OptionPassword,
28    OptionDir,
29    OptionStr,
30    OptionList,
31    validate_octal,
32    validate_safedir,
33    all_lowercase,
34    create_api_key,
35    validate_notempty,
36    clean_nice_ionice_parameters,
37    validate_strip_right_slash,
38)
39from sabnzbd.constants import (
40    DEF_HOST,
41    DEF_PORT,
42    DEF_STDINTF,
43    DEF_ADMIN_DIR,
44    DEF_DOWNLOAD_DIR,
45    DEF_NZBBACK_DIR,
46    DEF_SCANRATE,
47    DEF_COMPLETE_DIR,
48    DEF_FOLDER_MAX,
49    DEF_FILE_MAX,
50)
51
52##############################################################################
53# Email validation support
54##############################################################################
55RE_VAL = re.compile(r"[^@ ]+@[^.@ ]+\.[^.@ ]")
56
57
58def validate_email(value):
59    global email_endjob, email_full, email_rss
60    if email_endjob() or email_full() or email_rss():
61        if isinstance(value, list):
62            values = value
63        else:
64            values = [value]
65        for addr in values:
66            if not (addr and RE_VAL.match(addr)):
67                return T("%s is not a valid email address") % addr, None
68    return None, value
69
70
71def validate_server(value):
72    """Check if server non-empty"""
73    global email_endjob, email_full, email_rss
74    if value == "" and (email_endjob() or email_full() or email_rss()):
75        return T("Server address required"), None
76    else:
77        return None, value
78
79
80def validate_script(value):
81    """Check if value is a valid script"""
82    if not sabnzbd.__INITIALIZED__ or (value and sabnzbd.filesystem.is_valid_script(value)):
83        return None, value
84    elif (value and value == "None") or not value:
85        return None, "None"
86    return T("%s is not a valid script") % value, None
87
88
89##############################################################################
90# Special settings
91##############################################################################
92pre_script = OptionStr("misc", "pre_script", "None", validation=validate_script)
93queue_complete = OptionStr("misc", "queue_complete")
94queue_complete_pers = OptionBool("misc", "queue_complete_pers", False)
95bandwidth_perc = OptionNumber("misc", "bandwidth_perc", 100, 0, 100)
96refresh_rate = OptionNumber("misc", "refresh_rate", 0)
97interface_settings = OptionStr("misc", "interface_settings")
98log_level = OptionNumber("logging", "log_level", 1, -1, 2)
99log_size = OptionNumber("logging", "max_log_size", 5242880)
100log_backups = OptionNumber("logging", "log_backups", 5, 1, 1024)
101queue_limit = OptionNumber("misc", "queue_limit", 20, 0)
102
103configlock = OptionBool("misc", "config_lock", False)
104
105
106##############################################################################
107# One time trackers
108##############################################################################
109sched_converted = OptionBool("misc", "sched_converted", False)
110notified_new_skin = OptionNumber("misc", "notified_new_skin", 0)
111direct_unpack_tested = OptionBool("misc", "direct_unpack_tested", False)
112
113
114##############################################################################
115# Config - General
116##############################################################################
117version_check = OptionNumber("misc", "check_new_rel", 1)
118autobrowser = OptionBool("misc", "auto_browser", True)
119language = OptionStr("misc", "language", "en")
120enable_https_verification = OptionBool("misc", "enable_https_verification", True)
121cherryhost = OptionStr("misc", "host", DEF_HOST)
122cherryport = OptionStr("misc", "port", DEF_PORT)
123https_port = OptionStr("misc", "https_port")
124username = OptionStr("misc", "username")
125password = OptionPassword("misc", "password")
126bandwidth_max = OptionStr("misc", "bandwidth_max")
127cache_limit = OptionStr("misc", "cache_limit")
128web_dir = OptionStr("misc", "web_dir", DEF_STDINTF)
129web_color = OptionStr("misc", "web_color")
130https_cert = OptionDir("misc", "https_cert", "server.cert", create=False)
131https_key = OptionDir("misc", "https_key", "server.key", create=False)
132https_chain = OptionDir("misc", "https_chain", create=False)
133enable_https = OptionBool("misc", "enable_https", False)
134# 0=local-only, 1=nzb, 2=api, 3=full_api, 4=webui, 5=webui with login for external
135inet_exposure = OptionNumber("misc", "inet_exposure", 0, protect=True)
136api_key = OptionStr("misc", "api_key", create_api_key())
137nzb_key = OptionStr("misc", "nzb_key", create_api_key())
138
139
140##############################################################################
141# Config - Folders
142##############################################################################
143umask = OptionStr("misc", "permissions", validation=validate_octal)
144download_dir = OptionDir("misc", "download_dir", DEF_DOWNLOAD_DIR, create=False, validation=validate_safedir)
145download_free = OptionStr("misc", "download_free")
146complete_dir = OptionDir(
147    "misc", "complete_dir", DEF_COMPLETE_DIR, create=False, apply_umask=True, validation=validate_notempty
148)
149complete_free = OptionStr("misc", "complete_free")
150fulldisk_autoresume = OptionBool("misc", "fulldisk_autoresume", False)
151script_dir = OptionDir("misc", "script_dir", create=True, writable=False)
152nzb_backup_dir = OptionDir("misc", "nzb_backup_dir", DEF_NZBBACK_DIR)
153admin_dir = OptionDir("misc", "admin_dir", DEF_ADMIN_DIR, validation=validate_safedir)
154dirscan_dir = OptionDir("misc", "dirscan_dir", create=False)
155dirscan_speed = OptionNumber("misc", "dirscan_speed", DEF_SCANRATE, 0, 3600)
156password_file = OptionDir("misc", "password_file", "", create=False)
157log_dir = OptionDir("misc", "log_dir", "logs", validation=validate_notempty)
158
159
160##############################################################################
161# Config - Switches
162##############################################################################
163max_art_tries = OptionNumber("misc", "max_art_tries", 3, 2)
164load_balancing = OptionNumber("misc", "load_balancing", 2)
165top_only = OptionBool("misc", "top_only", False)
166sfv_check = OptionBool("misc", "sfv_check", True)
167quick_check_ext_ignore = OptionList("misc", "quick_check_ext_ignore", ["nfo", "sfv", "srr"])
168script_can_fail = OptionBool("misc", "script_can_fail", False)
169enable_recursive = OptionBool("misc", "enable_recursive", True)
170flat_unpack = OptionBool("misc", "flat_unpack", False)
171par_option = OptionStr("misc", "par_option")
172pre_check = OptionBool("misc", "pre_check", False)
173nice = OptionStr("misc", "nice", validation=clean_nice_ionice_parameters)
174win_process_prio = OptionNumber("misc", "win_process_prio", 3)
175ionice = OptionStr("misc", "ionice", validation=clean_nice_ionice_parameters)
176fail_hopeless_jobs = OptionBool("misc", "fail_hopeless_jobs", True)
177fast_fail = OptionBool("misc", "fast_fail", True)
178autodisconnect = OptionBool("misc", "auto_disconnect", True)
179no_dupes = OptionNumber("misc", "no_dupes", 0)
180no_series_dupes = OptionNumber("misc", "no_series_dupes", 0)
181series_propercheck = OptionBool("misc", "series_propercheck", True)
182pause_on_pwrar = OptionNumber("misc", "pause_on_pwrar", 1)
183ignore_samples = OptionBool("misc", "ignore_samples", False)
184deobfuscate_final_filenames = OptionBool("misc", "deobfuscate_final_filenames", False)
185auto_sort = OptionStr("misc", "auto_sort")
186direct_unpack = OptionBool("misc", "direct_unpack", False)
187direct_unpack_threads = OptionNumber("misc", "direct_unpack_threads", 3, 1)
188propagation_delay = OptionNumber("misc", "propagation_delay", 0)
189folder_rename = OptionBool("misc", "folder_rename", True)
190replace_spaces = OptionBool("misc", "replace_spaces", False)
191replace_dots = OptionBool("misc", "replace_dots", False)
192safe_postproc = OptionBool("misc", "safe_postproc", True)
193pause_on_post_processing = OptionBool("misc", "pause_on_post_processing", False)
194sanitize_safe = OptionBool("misc", "sanitize_safe", False)
195cleanup_list = OptionList("misc", "cleanup_list")
196unwanted_extensions = OptionList("misc", "unwanted_extensions")
197action_on_unwanted_extensions = OptionNumber("misc", "action_on_unwanted_extensions", 0)
198unwanted_extensions_mode = OptionNumber("misc", "unwanted_extensions_mode", 0)
199new_nzb_on_failure = OptionBool("misc", "new_nzb_on_failure", False)
200history_retention = OptionStr("misc", "history_retention", "0")
201enable_meta = OptionBool("misc", "enable_meta", True)
202
203quota_size = OptionStr("misc", "quota_size")
204quota_day = OptionStr("misc", "quota_day")
205quota_resume = OptionBool("misc", "quota_resume", False)
206quota_period = OptionStr("misc", "quota_period", "m")
207
208rating_enable = OptionBool("misc", "rating_enable", False)
209rating_host = OptionStr("misc", "rating_host")
210rating_api_key = OptionStr("misc", "rating_api_key")
211rating_filter_enable = OptionBool("misc", "rating_filter_enable", False)
212rating_filter_abort_audio = OptionNumber("misc", "rating_filter_abort_audio", 0)
213rating_filter_abort_video = OptionNumber("misc", "rating_filter_abort_video", 0)
214rating_filter_abort_encrypted = OptionBool("misc", "rating_filter_abort_encrypted", False)
215rating_filter_abort_encrypted_confirm = OptionBool("misc", "rating_filter_abort_encrypted_confirm", False)
216rating_filter_abort_spam = OptionBool("misc", "rating_filter_abort_spam", False)
217rating_filter_abort_spam_confirm = OptionBool("misc", "rating_filter_abort_spam_confirm", False)
218rating_filter_abort_downvoted = OptionBool("misc", "rating_filter_abort_downvoted", False)
219rating_filter_abort_keywords = OptionStr("misc", "rating_filter_abort_keywords")
220rating_filter_pause_audio = OptionNumber("misc", "rating_filter_pause_audio", 0)
221rating_filter_pause_video = OptionNumber("misc", "rating_filter_pause_video", 0)
222rating_filter_pause_encrypted = OptionBool("misc", "rating_filter_pause_encrypted", False)
223rating_filter_pause_encrypted_confirm = OptionBool("misc", "rating_filter_pause_encrypted_confirm", False)
224rating_filter_pause_spam = OptionBool("misc", "rating_filter_pause_spam", False)
225rating_filter_pause_spam_confirm = OptionBool("misc", "rating_filter_pause_spam_confirm", False)
226rating_filter_pause_downvoted = OptionBool("misc", "rating_filter_pause_downvoted", False)
227rating_filter_pause_keywords = OptionStr("misc", "rating_filter_pause_keywords")
228
229
230##############################################################################
231# Config - Sorting
232##############################################################################
233enable_tv_sorting = OptionBool("misc", "enable_tv_sorting", False)
234tv_sort_string = OptionStr("misc", "tv_sort_string")
235tv_sort_countries = OptionNumber("misc", "tv_sort_countries", 1)
236tv_categories = OptionList("misc", "tv_categories", "")
237
238enable_movie_sorting = OptionBool("misc", "enable_movie_sorting", False)
239movie_sort_string = OptionStr("misc", "movie_sort_string")
240movie_sort_extra = OptionStr("misc", "movie_sort_extra", "-cd%1", strip=False)
241movie_extra_folders = OptionBool("misc", "movie_extra_folder", False)
242movie_categories = OptionList("misc", "movie_categories", ["movies"])
243
244enable_date_sorting = OptionBool("misc", "enable_date_sorting", False)
245date_sort_string = OptionStr("misc", "date_sort_string")
246date_categories = OptionList("misc", "date_categories", ["tv"])
247
248
249##############################################################################
250# Config - Scheduling and RSS
251##############################################################################
252schedules = OptionList("misc", "schedlines")
253rss_rate = OptionNumber("misc", "rss_rate", 60, 15, 24 * 60)
254
255
256##############################################################################
257# Config - Specials
258##############################################################################
259# Bool switches
260ampm = OptionBool("misc", "ampm", False)
261replace_illegal = OptionBool("misc", "replace_illegal", True)
262start_paused = OptionBool("misc", "start_paused", False)
263enable_all_par = OptionBool("misc", "enable_all_par", False)
264enable_par_cleanup = OptionBool("misc", "enable_par_cleanup", True)
265enable_unrar = OptionBool("misc", "enable_unrar", True)
266enable_unzip = OptionBool("misc", "enable_unzip", True)
267enable_7zip = OptionBool("misc", "enable_7zip", True)
268enable_filejoin = OptionBool("misc", "enable_filejoin", True)
269enable_tsjoin = OptionBool("misc", "enable_tsjoin", True)
270overwrite_files = OptionBool("misc", "overwrite_files", False)
271ignore_unrar_dates = OptionBool("misc", "ignore_unrar_dates", False)
272backup_for_duplicates = OptionBool("misc", "backup_for_duplicates", True)
273empty_postproc = OptionBool("misc", "empty_postproc", False)
274wait_for_dfolder = OptionBool("misc", "wait_for_dfolder", False)
275rss_filenames = OptionBool("misc", "rss_filenames", False)
276api_logging = OptionBool("misc", "api_logging", True)
277html_login = OptionBool("misc", "html_login", True)
278osx_menu = OptionBool("misc", "osx_menu", True)
279osx_speed = OptionBool("misc", "osx_speed", True)
280warn_dupl_jobs = OptionBool("misc", "warn_dupl_jobs", True)
281helpfull_warnings = OptionBool("misc", "helpfull_warnings", True)
282keep_awake = OptionBool("misc", "keep_awake", True)
283win_menu = OptionBool("misc", "win_menu", True)
284allow_incomplete_nzb = OptionBool("misc", "allow_incomplete_nzb", False)
285enable_broadcast = OptionBool("misc", "enable_broadcast", True)
286ipv6_hosting = OptionBool("misc", "ipv6_hosting", False)
287fixed_ports = OptionBool("misc", "fixed_ports", False)
288api_warnings = OptionBool("misc", "api_warnings", True, protect=True)
289disable_key = OptionBool("misc", "disable_api_key", False, protect=True)
290no_penalties = OptionBool("misc", "no_penalties", False)
291x_frame_options = OptionBool("misc", "x_frame_options", True)
292require_modern_tls = OptionBool("misc", "require_modern_tls", False)
293num_decoders = OptionNumber("misc", "num_decoders", 3)
294
295# Text values
296rss_odd_titles = OptionList("misc", "rss_odd_titles", ["nzbindex.nl/", "nzbindex.com/", "nzbclub.com/"])
297req_completion_rate = OptionNumber("misc", "req_completion_rate", 100.2, 100, 200)
298selftest_host = OptionStr("misc", "selftest_host", "self-test.sabnzbd.org")
299movie_rename_limit = OptionStr("misc", "movie_rename_limit", "100M")
300size_limit = OptionStr("misc", "size_limit", "0")
301show_sysload = OptionNumber("misc", "show_sysload", 2, 0, 2)
302history_limit = OptionNumber("misc", "history_limit", 10, 0)
303wait_ext_drive = OptionNumber("misc", "wait_ext_drive", 5, 1, 60)
304max_foldername_length = OptionNumber("misc", "max_foldername_length", DEF_FOLDER_MAX, 20, 65000)
305marker_file = OptionStr("misc", "nomedia_marker")
306ipv6_servers = OptionNumber("misc", "ipv6_servers", 1, 0, 2)
307url_base = OptionStr("misc", "url_base", "/sabnzbd", validation=validate_strip_right_slash)
308host_whitelist = OptionList("misc", "host_whitelist", validation=all_lowercase)
309local_ranges = OptionList("misc", "local_ranges", protect=True)
310max_url_retries = OptionNumber("misc", "max_url_retries", 10, 1)
311downloader_sleep_time = OptionNumber("misc", "downloader_sleep_time", 10, 0)
312ssdp_broadcast_interval = OptionNumber("misc", "ssdp_broadcast_interval", 15, 1, 600)
313
314
315##############################################################################
316# Config - Notifications
317##############################################################################
318# [email]
319email_server = OptionStr("misc", "email_server", validation=validate_server)
320email_to = OptionList("misc", "email_to", validation=validate_email)
321email_from = OptionStr("misc", "email_from", validation=validate_email)
322email_account = OptionStr("misc", "email_account")
323email_pwd = OptionPassword("misc", "email_pwd")
324email_endjob = OptionNumber("misc", "email_endjob", 0, 0, 2)
325email_full = OptionBool("misc", "email_full", False)
326email_dir = OptionDir("misc", "email_dir", create=True)
327email_rss = OptionBool("misc", "email_rss", False)
328email_cats = OptionList("misc", "email_cats", ["*"])
329
330# [ncenter]
331ncenter_enable = OptionBool("ncenter", "ncenter_enable", sabnzbd.DARWIN)
332ncenter_cats = OptionList("ncenter", "ncenter_cats", ["*"])
333ncenter_prio_startup = OptionBool("ncenter", "ncenter_prio_startup", True)
334ncenter_prio_download = OptionBool("ncenter", "ncenter_prio_download", False)
335ncenter_prio_pause_resume = OptionBool("ncenter", "ncenter_prio_pause_resume", False)
336ncenter_prio_pp = OptionBool("ncenter", "ncenter_prio_pp", False)
337ncenter_prio_complete = OptionBool("ncenter", "ncenter_prio_complete", True)
338ncenter_prio_failed = OptionBool("ncenter", "ncenter_prio_failed", True)
339ncenter_prio_disk_full = OptionBool("ncenter", "ncenter_prio_disk_full", True)
340ncenter_prio_new_login = OptionBool("ncenter", "ncenter_prio_new_login", False)
341ncenter_prio_warning = OptionBool("ncenter", "ncenter_prio_warning", False)
342ncenter_prio_error = OptionBool("ncenter", "ncenter_prio_error", False)
343ncenter_prio_queue_done = OptionBool("ncenter", "ncenter_prio_queue_done", True)
344ncenter_prio_other = OptionBool("ncenter", "ncenter_prio_other", True)
345
346# [acenter]
347acenter_enable = OptionBool("acenter", "acenter_enable", sabnzbd.WIN32)
348acenter_cats = OptionList("acenter", "acenter_cats", ["*"])
349acenter_prio_startup = OptionBool("acenter", "acenter_prio_startup", False)
350acenter_prio_download = OptionBool("acenter", "acenter_prio_download", False)
351acenter_prio_pause_resume = OptionBool("acenter", "acenter_prio_pause_resume", False)
352acenter_prio_pp = OptionBool("acenter", "acenter_prio_pp", False)
353acenter_prio_complete = OptionBool("acenter", "acenter_prio_complete", True)
354acenter_prio_failed = OptionBool("acenter", "acenter_prio_failed", True)
355acenter_prio_disk_full = OptionBool("acenter", "acenter_prio_disk_full", True)
356acenter_prio_new_login = OptionBool("acenter", "acenter_prio_new_login", False)
357acenter_prio_warning = OptionBool("acenter", "acenter_prio_warning", False)
358acenter_prio_error = OptionBool("acenter", "acenter_prio_error", False)
359acenter_prio_queue_done = OptionBool("acenter", "acenter_prio_queue_done", True)
360acenter_prio_other = OptionBool("acenter", "acenter_prio_other", True)
361
362# [ntfosd]
363ntfosd_enable = OptionBool("ntfosd", "ntfosd_enable", not sabnzbd.WIN32 and not sabnzbd.DARWIN)
364ntfosd_cats = OptionList("ntfosd", "ntfosd_cats", ["*"])
365ntfosd_prio_startup = OptionBool("ntfosd", "ntfosd_prio_startup", True)
366ntfosd_prio_download = OptionBool("ntfosd", "ntfosd_prio_download", False)
367ntfosd_prio_pause_resume = OptionBool("ntfosd", "ntfosd_prio_pause_resume", False)
368ntfosd_prio_pp = OptionBool("ntfosd", "ntfosd_prio_pp", False)
369ntfosd_prio_complete = OptionBool("ntfosd", "ntfosd_prio_complete", True)
370ntfosd_prio_failed = OptionBool("ntfosd", "ntfosd_prio_failed", True)
371ntfosd_prio_disk_full = OptionBool("ntfosd", "ntfosd_prio_disk_full", True)
372ntfosd_prio_new_login = OptionBool("ntfosd", "ntfosd_prio_new_login", False)
373ntfosd_prio_warning = OptionBool("ntfosd", "ntfosd_prio_warning", False)
374ntfosd_prio_error = OptionBool("ntfosd", "ntfosd_prio_error", False)
375ntfosd_prio_queue_done = OptionBool("ntfosd", "ntfosd_prio_queue_done", True)
376ntfosd_prio_other = OptionBool("ntfosd", "ntfosd_prio_other", True)
377
378# [prowl]
379prowl_enable = OptionBool("prowl", "prowl_enable", False)
380prowl_cats = OptionList("prowl", "prowl_cats", ["*"])
381prowl_apikey = OptionStr("prowl", "prowl_apikey")
382prowl_prio_startup = OptionNumber("prowl", "prowl_prio_startup", -3)
383prowl_prio_download = OptionNumber("prowl", "prowl_prio_download", -3)
384prowl_prio_pause_resume = OptionNumber("prowl", "prowl_prio_pause_resume", -3)
385prowl_prio_pp = OptionNumber("prowl", "prowl_prio_pp", -3)
386prowl_prio_complete = OptionNumber("prowl", "prowl_prio_complete", 0)
387prowl_prio_failed = OptionNumber("prowl", "prowl_prio_failed", 1)
388prowl_prio_disk_full = OptionNumber("prowl", "prowl_prio_disk_full", 1)
389prowl_prio_new_login = OptionNumber("prowl", "prowl_prio_new_login", -3)
390prowl_prio_warning = OptionNumber("prowl", "prowl_prio_warning", -3)
391prowl_prio_error = OptionNumber("prowl", "prowl_prio_error", -3)
392prowl_prio_queue_done = OptionNumber("prowl", "prowl_prio_queue_done", 0)
393prowl_prio_other = OptionNumber("prowl", "prowl_prio_other", 0)
394
395# [pushover]
396pushover_token = OptionStr("pushover", "pushover_token")
397pushover_userkey = OptionStr("pushover", "pushover_userkey")
398pushover_device = OptionStr("pushover", "pushover_device")
399pushover_emergency_expire = OptionNumber("pushover", "pushover_emergency_expire", 3600)
400pushover_emergency_retry = OptionNumber("pushover", "pushover_emergency_retry", 60)
401pushover_enable = OptionBool("pushover", "pushover_enable")
402pushover_cats = OptionList("pushover", "pushover_cats", ["*"])
403pushover_prio_startup = OptionNumber("pushover", "pushover_prio_startup", -3)
404pushover_prio_download = OptionNumber("pushover", "pushover_prio_download", -2)
405pushover_prio_pause_resume = OptionNumber("pushover", "pushover_prio_pause_resume", -2)
406pushover_prio_pp = OptionNumber("pushover", "pushover_prio_pp", -3)
407pushover_prio_complete = OptionNumber("pushover", "pushover_prio_complete", -1)
408pushover_prio_failed = OptionNumber("pushover", "pushover_prio_failed", -1)
409pushover_prio_disk_full = OptionNumber("pushover", "pushover_prio_disk_full", 1)
410pushover_prio_new_login = OptionNumber("pushover", "pushover_prio_new_login", -3)
411pushover_prio_warning = OptionNumber("pushover", "pushover_prio_warning", 1)
412pushover_prio_error = OptionNumber("pushover", "pushover_prio_error", 1)
413pushover_prio_queue_done = OptionNumber("pushover", "pushover_prio_queue_done", -1)
414pushover_prio_other = OptionNumber("pushover", "pushover_prio_other", -1)
415
416# [pushbullet]
417pushbullet_enable = OptionBool("pushbullet", "pushbullet_enable")
418pushbullet_cats = OptionList("pushbullet", "pushbullet_cats", ["*"])
419pushbullet_apikey = OptionStr("pushbullet", "pushbullet_apikey")
420pushbullet_device = OptionStr("pushbullet", "pushbullet_device")
421pushbullet_prio_startup = OptionBool("pushbullet", "pushbullet_prio_startup", False)
422pushbullet_prio_download = OptionBool("pushbullet", "pushbullet_prio_download", False)
423pushbullet_prio_pause_resume = OptionBool("pushbullet", "pushbullet_prio_pause_resume", False)
424pushbullet_prio_pp = OptionBool("pushbullet", "pushbullet_prio_pp", False)
425pushbullet_prio_complete = OptionBool("pushbullet", "pushbullet_prio_complete", True)
426pushbullet_prio_failed = OptionBool("pushbullet", "pushbullet_prio_failed", True)
427pushbullet_prio_disk_full = OptionBool("pushbullet", "pushbullet_prio_disk_full", True)
428pushbullet_prio_new_login = OptionBool("pushbullet", "pushbullet_prio_new_login", False)
429pushbullet_prio_warning = OptionBool("pushbullet", "pushbullet_prio_warning", False)
430pushbullet_prio_error = OptionBool("pushbullet", "pushbullet_prio_error", False)
431pushbullet_prio_queue_done = OptionBool("pushbullet", "pushbullet_prio_queue_done", False)
432pushbullet_prio_other = OptionBool("pushbullet", "pushbullet_prio_other", True)
433
434# [nscript]
435nscript_enable = OptionBool("nscript", "nscript_enable")
436nscript_cats = OptionList("nscript", "nscript_cats", ["*"])
437nscript_script = OptionStr("nscript", "nscript_script", validation=validate_script)
438nscript_parameters = OptionStr("nscript", "nscript_parameters")
439nscript_prio_startup = OptionBool("nscript", "nscript_prio_startup", True)
440nscript_prio_download = OptionBool("nscript", "nscript_prio_download", False)
441nscript_prio_pause_resume = OptionBool("nscript", "nscript_prio_pause_resume", False)
442nscript_prio_pp = OptionBool("nscript", "nscript_prio_pp", False)
443nscript_prio_complete = OptionBool("nscript", "nscript_prio_complete", True)
444nscript_prio_failed = OptionBool("nscript", "nscript_prio_failed", True)
445nscript_prio_disk_full = OptionBool("nscript", "nscript_prio_disk_full", True)
446nscript_prio_new_login = OptionBool("nscript", "nscript_prio_new_login", False)
447nscript_prio_warning = OptionBool("nscript", "nscript_prio_warning", False)
448nscript_prio_error = OptionBool("nscript", "nscript_prio_error", False)
449nscript_prio_queue_done = OptionBool("nscript", "nscript_prio_queue_done", True)
450nscript_prio_other = OptionBool("nscript", "nscript_prio_other", True)
451
452
453##############################################################################
454# Set root folders for Folder config-items
455##############################################################################
456def set_root_folders(home, lcldata):
457    email_dir.set_root(home)
458    download_dir.set_root(home)
459    complete_dir.set_root(home)
460    script_dir.set_root(home)
461    nzb_backup_dir.set_root(lcldata)
462    admin_dir.set_root(lcldata)
463    dirscan_dir.set_root(home)
464    log_dir.set_root(lcldata)
465    password_file.set_root(home)
466
467
468def set_root_folders2():
469    https_cert.set_root(admin_dir.get_path())
470    https_key.set_root(admin_dir.get_path())
471    https_chain.set_root(admin_dir.get_path())
472