projects
/
openlib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6b3a07a
)
Улучшена обработка ошибок, в т.ч. с избыточно длинными комментариями.
author
Roman Bazalevsky
<rvb@rvb.name>
Thu, 19 May 2016 19:47:24 +0000
(22:47 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Thu, 19 May 2016 19:47:24 +0000
(22:47 +0300)
fb2_process.py
patch
|
blob
|
history
diff --git
a/fb2_process.py
b/fb2_process.py
index 00ef2131a9aa0a9ce77706407cbd2d96e5618a50..595359a2fb396c54468615bc60a8a981d1a5721a 100755
(executable)
--- a/
fb2_process.py
+++ b/
fb2_process.py
@@
-66,9
+66,10
@@
class MetaData:
author_ids = set()
try:
for author in self.authors:
author_ids = set()
try:
for author in self.authors:
+ print author.encode('utf-8')
author_ids.add(db.GetOrCreateAuthor(author.encode('utf-8')))
except:
author_ids.add(db.GetOrCreateAuthor(author.encode('utf-8')))
except:
- pass
+ pass
except:
self.author='Неизвестный Автор (%s)' % (tag)
self.authors = []
except:
self.author='Неизвестный Автор (%s)' % (tag)
self.authors = []
@@
-117,7
+118,7
@@
class MetaData:
ser_id=None
try:
self.series_idx = meta_dict['series_index']
ser_id=None
try:
self.series_idx = meta_dict['series_index']
- ser_num=meta_dict['series_index']
+ ser_num=meta_dict['series_index']
.split(',')[0]
except:
ser_num=None
except:
ser_num=None
@@
-135,7
+136,10
@@
class MetaData:
self.has_cover=0
try:
self.has_cover=0
try:
- self.comments=meta_dict['comments'].encode('utf-8')
+ self.comments=meta_dict['comments']
+ if len(self.comments)>20000:
+ self.comments=self.comments[:20000]
+ self.comments=self.comments.encode('utf-8')
except:
self.comments=''
except:
self.comments=''
@@
-256,7
+260,7
@@
def CompressAll(limit=100):
pass
def CheckFiles(delete = 0):
pass
def CheckFiles(delete = 0):
- ids = db.ListByFormat('FB2',
3
00000)
+ ids = db.ListByFormat('FB2',
10
00000)
cnt = 0
for id in ids:
cnt = cnt + 1;
cnt = 0
for id in ids:
cnt = cnt + 1;
@@
-267,7
+271,7
@@
def CheckFiles(delete = 0):
if delete==1:
db.DelBook(id)
db.Commit()
if delete==1:
db.DelBook(id)
db.Commit()
- ids = db.ListByFormat('FB2.ZIP',
3
00000)
+ ids = db.ListByFormat('FB2.ZIP',
10
00000)
cnt = 0
for id in ids:
cnt = cnt + 1;
cnt = 0
for id in ids:
cnt = cnt + 1;