Compare commits
2 commits
0b5d56ed94
...
f66de47798
| Author | SHA1 | Date | |
|---|---|---|---|
| f66de47798 | |||
| ebf2ba4dbd |
2 changed files with 31 additions and 13 deletions
|
|
@ -9,24 +9,35 @@ site = 'pandora.cinemusespace.com'
|
||||||
api = ox.api.signin('https://%s/api/' % site)
|
api = ox.api.signin('https://%s/api/' % site)
|
||||||
|
|
||||||
keywords = collections.Counter()
|
keywords = collections.Counter()
|
||||||
for annotation in api.findAnnotations({
|
query = {
|
||||||
'query': {
|
|
||||||
'conditions': [{
|
'conditions': [{
|
||||||
'key': 'layer',
|
'key': 'layer',
|
||||||
'value': 'keywords',
|
'value': 'keywords',
|
||||||
'operator': '=='
|
'operator': '=='
|
||||||
}],
|
}],
|
||||||
'operator': '&'
|
'operator': '&'
|
||||||
},
|
}
|
||||||
'keys': ['id', 'in', 'out', 'value', 'user', 'created'],
|
count = api.findAnnotations({'query': query})['data']['items']
|
||||||
'range': [0, 500000]
|
position = 0
|
||||||
})['data']['items']:
|
chunk = 1000
|
||||||
if annotation['id'].startswith('BA/'):
|
|
||||||
continue
|
while position < count:
|
||||||
keyword = annotation['value']
|
r = api.findAnnotations({
|
||||||
if ': ' not in keyword:
|
'query': query,
|
||||||
keyword = 'other: ' + keyword
|
'keys': ['id', 'in', 'out', 'value', 'user', 'created'],
|
||||||
keywords[keyword] += 1
|
'sort': [{'key': 'public_id', 'operator': '+'}],
|
||||||
|
'range': [position, position+chunk]
|
||||||
|
})
|
||||||
|
if 'data' not in r:
|
||||||
|
print('failed', r)
|
||||||
|
for annotation in r['data']['items']:
|
||||||
|
if annotation['id'].startswith('BA/'):
|
||||||
|
continue
|
||||||
|
keyword = annotation['value']
|
||||||
|
if ': ' not in keyword:
|
||||||
|
keyword = 'other: ' + keyword
|
||||||
|
keywords[keyword] += 1
|
||||||
|
position += chunk
|
||||||
|
|
||||||
with open('keywords.json', 'w') as fd:
|
with open('keywords.json', 'w') as fd:
|
||||||
json.dump(keywords, fd, indent=4, ensure_ascii=False, sort_keys=True)
|
json.dump(keywords, fd, indent=4, ensure_ascii=False, sort_keys=True)
|
||||||
|
|
|
||||||
9
tasks.py
9
tasks.py
|
|
@ -18,4 +18,11 @@ def subtitles_user(**kwargs):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@periodic_task(run_every=timedelta(hours=12), queue='encoding')
|
||||||
|
def render_edits(**kwargs):
|
||||||
|
path = '/home/pandora/pandora_render/render_public_edits.py'
|
||||||
|
if os.path.exists(path)
|
||||||
|
try:
|
||||||
|
subprocess.call([path])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue