Compare commits

..

No commits in common. "f66de47798b436fddec181687e3c38b210f4acb8" and "0b5d56ed94ae4d0008ceb02dbf35911477985c37" have entirely different histories.

2 changed files with 13 additions and 31 deletions

View file

@ -9,35 +9,24 @@ site = 'pandora.cinemusespace.com'
api = ox.api.signin('https://%s/api/' % site)
keywords = collections.Counter()
query = {
for annotation in api.findAnnotations({
'query': {
'conditions': [{
'key': 'layer',
'value': 'keywords',
'operator': '=='
}],
'operator': '&'
}
count = api.findAnnotations({'query': query})['data']['items']
position = 0
chunk = 1000
while position < count:
r = api.findAnnotations({
'query': query,
'keys': ['id', 'in', 'out', 'value', 'user', 'created'],
'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
},
'keys': ['id', 'in', 'out', 'value', 'user', 'created'],
'range': [0, 500000]
})['data']['items']:
if annotation['id'].startswith('BA/'):
continue
keyword = annotation['value']
if ': ' not in keyword:
keyword = 'other: ' + keyword
keywords[keyword] += 1
with open('keywords.json', 'w') as fd:
json.dump(keywords, fd, indent=4, ensure_ascii=False, sort_keys=True)

View file

@ -18,11 +18,4 @@ def subtitles_user(**kwargs):
except:
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