1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.conf import settings
6 from django.utils.module_loading import import_string
7 from catalogue.utils import AppSettings
10 default_app_config = 'catalogue.apps.CatalogueConfig'
13 class Settings(AppSettings):
14 """Default settings for catalogue app."""
15 DEFAULT_LANGUAGE = 'pol'
16 # PDF needs TeXML + XeLaTeX, MOBI needs Calibre.
17 DONT_BUILD = {'pdf', 'mobi'}
19 'epub': 'wolnelektury_pl_epub',
20 'pdf': 'wolnelektury_pl_pdf',
21 'mobi': 'wolnelektury_pl_mobi',
22 'fb2': 'wolnelektury_pl_fb2',
25 REDAKCJA_URL = "http://redakcja.wolnelektury.pl"
26 GOOD_LICENSES = {r'CC BY \d\.\d', r'CC BY-SA \d\.\d'}
27 RELATED_RANDOM_PICTURE_CHANCE = .5
28 GET_MP3_LENGTH = 'catalogue.utils.get_mp3_length'
30 def _more_DONT_BUILD(self, value):
31 for format_ in ['cover', 'pdf', 'epub', 'mobi', 'fb2', 'txt']:
32 attname = 'NO_BUILD_%s' % format_.upper()
33 if hasattr(settings, attname):
34 logging.warn("%s is deprecated, use CATALOGUE_DONT_BUILD instead", attname)
35 if getattr(settings, attname):
41 def _more_FORMAT_ZIPS(self, value):
42 for format_ in ['epub', 'pdf', 'mobi', 'fb2']:
43 attname = 'ALL_%s_ZIP' % format_.upper()
44 if hasattr(settings, attname):
46 "%s is deprecated, use CATALOGUE_FORMAT_ZIPS[%s] instead",
49 value[format_] = getattr(settings, attname)
52 def _more_GET_MP3_LENGTH(self, value):
53 return import_string(value)
56 app_settings = Settings('CATALOGUE')