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