forked from libgenman/GenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flask.cfg
211 lines (190 loc) · 5.18 KB
/
flask.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
# Web-interface port. Default is 5000
FLASK_PORT = 5000
# Proxy for online updates. Default is None
#HTTP_PROXY = 'http://127.0.0.1:3128/'
# URL list for online updates. Each group is randomized, but groups are tried in sequence.
JSONAPI_URL_LIST = [
['http://gen.lib.rus.ec/json.php'],
['http://libgen.io/json.php'],
]
JSONAPI_RETRY_COUNT = 3
JSONAPI_RETRY_DELAY = 1
VIEW_URL="http://gen.lib.rus.ec/book/index.php?md5={md5}"
MIRROR_LIST=[
"http://libgen.io/get?md5={md5}",
"http://bookzz.org/md5/{md5}",
"http://golibgen.io/view.php?id={id}",
"http://bookfi.net/md5/{md5}",
]
EDIT_URL="http://libgen.io/librarian/registration?md5={md5}"
DELTA_MERGE_THRESHOLD = 10000
# MySQL connection to Sphinx
MYSQL_DATABASE_HOST='127.0.0.1'
MYSQL_DATABASE_PORT=5306
MYSQL_DATABASE_USER='root'
MYSQL_DATABASE_PASSWORD=''
MYSQL_DATABASE_DB=''
MYSQL_DATABASE_CHARSET='utf8'
INDEX_TABLE='libgenmain,libgendelta'
# CSV update file
CSV_FIELDS = [
'ID', 'Title', 'VolumeInfo', 'Series', 'Periodical', 'Author', 'Year',
'Edition', 'Publisher', 'City', 'Pages', 'PagesInFile', 'Language',
# 'Topic', 'Library', 'Issue',
'Identifier',
# 'ISSN', 'ASIN', 'UDC', 'LBC', 'DDC', 'LCC', 'Doi', 'Googlebookid', 'OpenLibraryID',
# 'Commentary', 'DPI', 'Color', 'Cleaned', 'Orientation', 'Paginated', 'Scanned', 'Bookmarked', 'Searchable',
'Filesize', 'Extension', 'MD5', 'Generic',
'Visible',
# 'Locator', 'Local',
'TimeAdded', 'TimeLastModified',
# 'Coverurl', 'Tags',
'IdentifierWODash',
]
# Sphinx indexer pipe
SPHINX_VISIBLE_ENUM={ '':0, 'no':1, 'ban': 2, 'del': 3 }
SPHINX_ATTR_DUPLICATE=["Title","VolumeInfo","Series","Periodical","Author","Year","Publisher","Language","Identifier","Extension","MD5"]
SPHINX_ATTR_SUFFIX="Attr"
SPHINX_FIELDS=[
'ID',
# Fields
"Title",
"VolumeInfo",
"Series",
"Periodical",
"Author",
"Year",
# "Edition",
"Publisher",
# "City",
# "Pages",
# "PagesInFile",
"Language",
# "Topic",
# "Library",
# "Issue",
"Identifier",
# "ISSN",
# "ASIN",
# "UDC",
# "LBC",
# "DDC",
# "LCC",
# "Doi",
# "Googlebookid",
# "OpenLibraryID",
# "Commentary",
# "DPI",
# "Color",
# "Cleaned",
# "Orientation",
# "Paginated",
# "Scanned",
# "Bookmarked",
# "Searchable",
# "Filesize",
"Extension",
"MD5",
# "Generic",
# "Visible",
# "Locator",
# "Local",
# "TimeAdded",
# "TimeLastModified",
# "Coverurl",
# "Tags",
"IdentifierWODash",
# Attributes
'TitleAttr',
'VolumeInfoAttr',
'SeriesAttr',
'PeriodicalAttr',
'AuthorAttr',
'YearAttr',
'Edition',
'PublisherAttr',
'City',
'Pages',
'PagesInFile',
'LanguageAttr',
# 'Topic',
# 'Library',
# 'Issue',
'IdentifierAttr',
# 'ISSN',
# 'ASIN',
# 'UDC',
# 'LBC',
# 'DDC',
# 'LCC',
# 'Doi',
# 'Googlebookid',
# 'OpenLibraryID',
# 'Commentary',
# 'DPI', # uint
# 'Color',
# 'Cleaned',
# 'Orientation',
# 'Paginated',
# 'Scanned',
# 'Bookmarked',
# 'Searchable',
'Filesize', # bigint
'ExtensionAttr',
'MD5Attr',
'Generic',
'Visible',
# 'Locator',
# 'Local',
'TimeAdded', # timestamp
'TimeLastModified', # timestamp
# 'Coverurl',
# 'Tags',
#'IdentifierWODashAttr', # don't add this as attribute because it is actually the copy of 'Identifier',
]
# Search API
# Fields are prepended to query as Sphinx multiple-field search operator: @(field1,field2,...) http://sphinxsearch.com/docs/current.html#extended-syntax
FIELD_LIST={
't': 'title',
'a': 'author',
's': 'series',
'p': 'periodical',
'u': 'publisher',
'y': 'year',
'v': 'volumeinfo',
'L': 'language',
'5': 'md5',
'i': 'identifier,identifierwodash',
'e': 'extension',
}
SORT_DEFAULT='title'
SORT_LIST={
'title': "TitleAttr ASC, SeriesAttr ASC, PeriodicalAttr ASC, AuthorAttr ASC, ID ASC",
'series': "SeriesAttr ASC, PeriodicalAttr ASC, TitleAttr ASC, AuthorAttr ASC, ID ASC",
'relevance': "WEIGHT() DESC, ID ASC",
'added': "ID DESC",
'modified': "TimeLastModified DESC, ID DESC",
'year': "YearAttr DESC, TitleAttr ASC, SeriesAttr ASC, PeriodicalAttr ASC, AuthorAttr ASC",
'-year': "YearAttr ASC, TitleAttr ASC, SeriesAttr ASC, PeriodicalAttr ASC, AuthorAttr ASC",
'size': "Filesize ASC, TitleAttr ASC, SeriesAttr ASC, PeriodicalAttr ASC, AuthorAttr ASC",
'-size': "Filesize DESC, TitleAttr ASC, SeriesAttr ASC, PeriodicalAttr ASC, AuthorAttr ASC",
}
VISIBLE_LIST={
'n': '1',
'b': '2',
}
# Double-formatted: %%()s is quoted and escaped, %()s is passed as-is
SEARCH_QUERY="""
SELECT
ID, MD5Attr as MD5,
SeriesAttr as Series,PeriodicalAttr as Periodical,TitleAttr as Title,AuthorAttr as Author,PublisherAttr as Publisher,
Edition,VolumeInfoAttr as VolumeInfo,
IdentifierAttr as Identifier,
YearAttr as Year,Pages,LanguageAttr as Language,Filesize,ExtensionAttr as Extension,
Visible, TimeAdded, TimeLastModified
FROM %(table)s
WHERE MATCH(%%(query)s) %(visible)s
ORDER BY %(sort)s
LIMIT 1000
OPTION max_matches = 1000
"""