Compare commits
No commits in common. "5bc039e965c2f48c5eb0c0d5a9ee4d350709f8b9" and "7cc92c5c7582dc8719fb8943a06f9ea5d80825c5" have entirely different histories.
5bc039e965
...
7cc92c5c75
2 changed files with 3 additions and 39 deletions
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
import re
|
||||
|
||||
import ox
|
||||
import ox.api
|
||||
|
||||
site = 'archive.leftove.rs'
|
||||
api = ox.api.signin('https://%s/api/' % site)
|
||||
|
||||
for regex, fragments in (
|
||||
['Vol. \d+, No. \d+', ['Vol.', 'No.']],
|
||||
['Vol \d+ no \d+', [' Vol ', ' no ']],
|
||||
['Vol:\d+ #\d+', ['Vol:', '#']],
|
||||
):
|
||||
for doc in api.findDocuments({
|
||||
'query': {
|
||||
'conditions': [
|
||||
{'key': 'title', 'operator': '=', 'value': fragment}
|
||||
for fragment in fragments
|
||||
],
|
||||
'operator': '&'
|
||||
},
|
||||
'keys': ['id', 'title', 'volume'],
|
||||
'range': [0, 10000]
|
||||
})['data']['items']:
|
||||
if 'Vol' not in doc.get('volume', ''):
|
||||
m = re.compile(regex).findall(doc['title'])
|
||||
if m:
|
||||
print(m[0], doc['id'], doc['title'])
|
||||
api.editDocument({
|
||||
'id': doc['id'],
|
||||
'volume': m[0].strip()
|
||||
})
|
||||
|
|
@ -303,18 +303,15 @@ pandora.ui.documentInfoView = function(data, isMixed) {
|
|||
}
|
||||
|
||||
// Preview
|
||||
if (!isMultiple && data.extension != 'html') {
|
||||
|
||||
if (data.extension == 'pdf' && !isMultiple) {
|
||||
var $div = $('<div>').css({
|
||||
marginTop: '12px',
|
||||
}).html(
|
||||
data.extension == 'pdf'
|
||||
? Ox.range(1, data.dimensions + 1).map(function(page) {
|
||||
Ox.range(1, data.dimensions + 1).map(function(page) {
|
||||
return '<a href="/document/'
|
||||
+ data.id + '/' + page
|
||||
+ '"><img src="/documents/'+ data.id + '/128p'+ page + '.jpg"></a>'
|
||||
}).join('\n')
|
||||
: ('<a href="/document/' + data.id + '><img src="/documents/'+ data.id + '/128p.jpg"></a>')
|
||||
)
|
||||
pandora.createLinks($div);
|
||||
$div.appendTo($text)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue