3e6f96f856c4a429578adb7a337184b86af12031
[audio.git] / src / archive / settings.py
1 import os.path
2 from django.conf import settings
3
4 # this is where the end user puts new files
5 try:
6     NEW_PATH = settings.ARCHIVE_NEW_PATH
7 except AttributeError:
8     NEW_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
9                         "archive/new"))
10
11 # here the application keeps its managed files
12 try:
13     FILES_PATH = settings.ARCHIVE_FILES_PATH
14 except AttributeError:
15     FILES_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
16                         "archive/files"))
17
18 _media_root = os.path.abspath(settings.MEDIA_ROOT)
19 if FILES_PATH.startswith(_media_root):
20     FILES_SAVE_PATH = FILES_PATH[len(_media_root):].lstrip('/')
21
22
23 # here the app keeps the unmanaged (archive) files
24 try:
25     UNMANAGED_PATH = settings.ARCHIVE_UNMANAGED_PATH
26 except AttributeError:
27     UNMANAGED_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
28                         "archive/unmanaged"))
29
30
31 # here the app keeps the resulting (published) files
32 try:
33     FINAL_PATH = settings.ARCHIVE_FINAL_PATH
34 except AttributeError:
35     FINAL_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
36                         "archive/final"))
37
38
39 # here the app keeps temporary build files
40 try:
41     BUILD_PATH = settings.ARCHIVE_BUILD_PATH
42 except AttributeError:
43     BUILD_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
44                         "archive/build"))
45
46 UPLOAD_URL = getattr(
47     settings,
48     'ARCHIVE_UPLOAD_URL',
49     'audiobooks/'
50 )
51
52
53 try:
54     PROJECT = settings.ARCHIVE_PROJECT
55 except AttributeError:
56     PROJECT = 'Wolne Lektury'
57
58
59 LICENSE = getattr(
60     settings,
61     'ARCHIVE_LICENSE',
62     'http://artlibre.org/licence/lal/pl/'
63 )
64
65 LICENSE_NAME = getattr(
66     settings, 'ARCHIVE_LICENSE_NAME',
67     'Licencja Wolnej Sztuki 1.3'
68 )
69
70
71 try:
72     ORGANIZATION = settings.ARCHIVE_ORGANIZATION
73 except AttributeError:
74     ORGANIZATION = 'Fundacja Nowoczesna Polska'
75
76 try:
77     ADVERT = settings.ARCHIVE_ADVERT
78 except AttributeError:
79     ADVERT = """
80 Przekaż 1% podatku na rozwój Wolnych Lektur:
81 Fundacja Nowoczesna Polska
82 KRS 0000070056
83 http://nowoczesnapolska.org.pl/wesprzyj_nas/
84 """
85
86 try:
87     COVER_IMAGE = settings.ARCHIVE_COVER_IMAGE
88 except AttributeError:
89     COVER_IMAGE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cover.png')
90