Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
797f1e43c0 | |||
db99c6b718 | |||
918b66aae5 | |||
4f581e8d62 | |||
2ed1bbaa6f | |||
a311235cf6 | |||
776c4ff5b3 | |||
da6fa3b697 | |||
5000f4a1ad |
7 changed files with 124 additions and 22 deletions
61
backup/backup_stills.command
Executable file
61
backup/backup_stills.command
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import unicodedata
|
||||||
|
import re
|
||||||
|
|
||||||
|
import ox
|
||||||
|
import ox.api
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
target = sys.argv[1]
|
||||||
|
else:
|
||||||
|
target = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Stills')
|
||||||
|
|
||||||
|
if not target.endswith('/'):
|
||||||
|
target += '/'
|
||||||
|
|
||||||
|
site = 'pandora.cinemusespace.com'
|
||||||
|
api = ox.api.signin('https://%s/api/' % site)
|
||||||
|
|
||||||
|
keep = []
|
||||||
|
r = api.findAnnotations({
|
||||||
|
'query': {
|
||||||
|
'conditions': [
|
||||||
|
{'key': 'layer', 'operator': '==', 'value': 'stills'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
'range': [0, 100000],
|
||||||
|
'keys': ['id', 'item', 'value', 'in', 'out', 'title', 'director', 'year']
|
||||||
|
})
|
||||||
|
for i in r['data']['items']:
|
||||||
|
img = re.compile('<img src="(.*)">').findall(i['value'])
|
||||||
|
if len(img) != 1:
|
||||||
|
print(img)
|
||||||
|
sys.exit(1)
|
||||||
|
lines = i['value'].strip().split('\n')
|
||||||
|
if len(lines) > 1:
|
||||||
|
tags = lines[1:]
|
||||||
|
else:
|
||||||
|
tags = []
|
||||||
|
|
||||||
|
name = i['title']
|
||||||
|
if i.get('year'):
|
||||||
|
name += '_(%s)' % i['year']
|
||||||
|
if i.get('director'):
|
||||||
|
name += '_' + ','.join(i['director'])
|
||||||
|
if tags:
|
||||||
|
name += '_' + ','.join(tags)
|
||||||
|
|
||||||
|
pos = float(re.compile('p(.*?).jpg').findall(img[0])[0])
|
||||||
|
name += '_%s.jpg' % ox.format_timecode(pos)
|
||||||
|
url = 'https://%s%s' % (site, img[0])
|
||||||
|
path = os.path.join(target, name)
|
||||||
|
if not os.path.exists(path):
|
||||||
|
print(url, name)
|
||||||
|
api.save_url(url, path)
|
||||||
|
|
45
config.jsonc
45
config.jsonc
|
@ -42,6 +42,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"canAddItems": {"staff": true, "admin": true},
|
"canAddItems": {"staff": true, "admin": true},
|
||||||
"canAddDocuments": {"staff": true, "admin": true},
|
"canAddDocuments": {"staff": true, "admin": true},
|
||||||
"canDownloadVideo": {"guest": 0, "member": 0, "visitor": 0, "staff": 1, "admin": 2},
|
"canDownloadVideo": {"guest": 0, "member": 0, "visitor": 0, "staff": 1, "admin": 2},
|
||||||
|
"canDownloadSource": {"member": -1, "staff": 4, "admin": 4},
|
||||||
"canEditAnnotations": {"staff": false, "admin": true},
|
"canEditAnnotations": {"staff": false, "admin": true},
|
||||||
"canEditDocuments": {"staff": true, "admin": true},
|
"canEditDocuments": {"staff": true, "admin": true},
|
||||||
"canEditEntities": {"staff": true, "admin": true},
|
"canEditEntities": {"staff": true, "admin": true},
|
||||||
|
@ -214,6 +215,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"columnWidth": 120,
|
"columnWidth": 120,
|
||||||
//"format": {"type": "date", "args": ["%a, %b %e, %Y"]},
|
//"format": {"type": "date", "args": ["%a, %b %e, %Y"]},
|
||||||
|
"filter": true,
|
||||||
"sort": true
|
"sort": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -510,7 +512,6 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"autocomplete": true,
|
"autocomplete": true,
|
||||||
"autocompleteSort": [{"key": "timesaccessed", "operator": "-"}],
|
"autocompleteSort": [{"key": "timesaccessed", "operator": "-"}],
|
||||||
"columnRequired": true,
|
|
||||||
"columnWidth": 180,
|
"columnWidth": 180,
|
||||||
"find": true,
|
"find": true,
|
||||||
"sort": true
|
"sort": true
|
||||||
|
@ -530,12 +531,13 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"columnRequired": true,
|
"columnRequired": true,
|
||||||
"columnWidth": 180,
|
"columnWidth": 180,
|
||||||
"filter": true,
|
"filter": true,
|
||||||
|
"find": true,
|
||||||
"sort": true,
|
"sort": true,
|
||||||
"sortType": "person"
|
"sortType": "person"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "country",
|
"id": "country",
|
||||||
"title": "Country",
|
"title": "Production Country",
|
||||||
"type": ["string"],
|
"type": ["string"],
|
||||||
"autocomplete": true,
|
"autocomplete": true,
|
||||||
"columnWidth": 180,
|
"columnWidth": 180,
|
||||||
|
@ -577,6 +579,16 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"find": true,
|
"find": true,
|
||||||
"sort": true
|
"sort": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "setincountry",
|
||||||
|
"title": "Set in Country",
|
||||||
|
"type": ["string"],
|
||||||
|
"autocomplete": true,
|
||||||
|
"columnWidth": 180,
|
||||||
|
"filter": true,
|
||||||
|
"find": true,
|
||||||
|
"sort": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "style",
|
"id": "style",
|
||||||
"title": "Style",
|
"title": "Style",
|
||||||
|
@ -770,14 +782,6 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"secondaryId": true,
|
"secondaryId": true,
|
||||||
"sort": true
|
"sort": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "icmaId",
|
|
||||||
"title": "Indiancine.ma ID",
|
|
||||||
"type": "string",
|
|
||||||
"columnWidth": 90,
|
|
||||||
"secondaryId": true,
|
|
||||||
"sort": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "comments",
|
"id": "comments",
|
||||||
"title": "Comments",
|
"title": "Comments",
|
||||||
|
@ -1203,22 +1207,22 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
the system (from).
|
the system (from).
|
||||||
*/
|
*/
|
||||||
"site": {
|
"site": {
|
||||||
"description": "CineGenus research project",
|
"description": "CineMuseSpace: A Cinematic Musée Imaginaire of Spatial Cultural Differences",
|
||||||
"email": {
|
"email": {
|
||||||
// E-mail address in contact form (to)
|
// E-mail address in contact form (to)
|
||||||
"contact": "js2034@cam.ac.uk",
|
"contact": "js2034@cam.ac.uk",
|
||||||
"footer": "-- \ncinegenus.cinemusespace.com",
|
"footer": "-- \npandora.cinemusespace.com",
|
||||||
"prefix": "CineGenus News -",
|
"prefix": "CineMuseSpace News -",
|
||||||
// E-mail address uses by the system (from)
|
// E-mail address uses by the system (from)
|
||||||
"system": "system@cinegenus.cinemusespace.com"
|
"system": "system@pandora.cinemusespace.com"
|
||||||
},
|
},
|
||||||
"https": false,
|
"https": false,
|
||||||
"id": "cms",
|
"id": "cms",
|
||||||
"name": "CineGenus",
|
"name": "CineMuseSpace",
|
||||||
// Set to true to allow search engines to index the site
|
// Set to true to allow search engines to index the site
|
||||||
"public": false,
|
"public": false,
|
||||||
"sendReferrer": true,
|
"sendReferrer": true,
|
||||||
"url": "cinegenus.cinemusespace.com"
|
"url": "pandora.cinemusespace.com"
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
"sitePages" defines the sections of the main site dialog. If "news" is
|
"sitePages" defines the sections of the main site dialog. If "news" is
|
||||||
|
@ -1327,11 +1331,19 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
},
|
},
|
||||||
"document": "",
|
"document": "",
|
||||||
"documents": {},
|
"documents": {},
|
||||||
|
"documentFiltersSize": 176,
|
||||||
"documentSize": 256,
|
"documentSize": 256,
|
||||||
"documentView": "view",
|
"documentView": "view",
|
||||||
"documentsSelection": {},
|
"documentsSelection": {},
|
||||||
"documentsSort": [{"key": "title", "operator": "+"}],
|
"documentsSort": [{"key": "title", "operator": "+"}],
|
||||||
"documentsView": "grid",
|
"documentsView": "grid",
|
||||||
|
"documentFilters": [
|
||||||
|
{"id": "author", "sort": [{"key": "items", "operator": "-"}]},
|
||||||
|
{"id": "place", "sort": [{"key": "items", "operator": "-"}]},
|
||||||
|
{"id": "date", "sort": [{"key": "name", "operator": "-"}]},
|
||||||
|
{"id": "publisher", "sort": [{"key": "items", "operator": "-"}]},
|
||||||
|
{"id": "language", "sort": [{"key": "items", "operator": "-"}]}
|
||||||
|
],
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"edits": {},
|
"edits": {},
|
||||||
"editSelection": [],
|
"editSelection": [],
|
||||||
|
@ -1396,6 +1408,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"showCalendarControls": false,
|
"showCalendarControls": false,
|
||||||
"showClips": true,
|
"showClips": true,
|
||||||
"showDocument": true,
|
"showDocument": true,
|
||||||
|
"showDocumentFilters": false,
|
||||||
"showFilters": true,
|
"showFilters": true,
|
||||||
"showIconBrowser": false,
|
"showIconBrowser": false,
|
||||||
"showInfo": true,
|
"showInfo": true,
|
||||||
|
|
|
@ -39,11 +39,22 @@ def get_node(name, children, parent=None):
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
||||||
|
def render_children(root, indent=0):
|
||||||
|
txt = ('\t' * indent) + root['name']
|
||||||
|
if 'children' in root:
|
||||||
|
parts = ''
|
||||||
|
for child in root['children']:
|
||||||
|
parts += '\n' + render_children(child, indent+1)
|
||||||
|
txt += '\n'.join([('\t' * indent) + p for p in parts.split('\n')])
|
||||||
|
return '\n'.join([l.rstrip() for l in txt.split('\n')])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
os.chdir(base)
|
os.chdir(base)
|
||||||
|
|
||||||
tree = defaultdict(dict)
|
tree = defaultdict(dict)
|
||||||
|
|
||||||
|
ontology_txt = ''
|
||||||
|
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
if ': ' not in keyword:
|
if ': ' not in keyword:
|
||||||
parent = 'other'
|
parent = 'other'
|
||||||
|
@ -75,5 +86,10 @@ if __name__ == '__main__':
|
||||||
child = get_node(name, tree[name], name)
|
child = get_node(name, tree[name], name)
|
||||||
sized_ontology['children'].append(child)
|
sized_ontology['children'].append(child)
|
||||||
|
|
||||||
|
|
||||||
|
ontology_txt = render_children(sized_ontology)
|
||||||
|
|
||||||
with open('../static/ontology/sized_ontology.json', 'w') as fd:
|
with open('../static/ontology/sized_ontology.json', 'w') as fd:
|
||||||
json.dump(sized_ontology, fd, indent=4, sort_keys=True)
|
json.dump(sized_ontology, fd, indent=4, sort_keys=True)
|
||||||
|
with open('../static/ontology/ontology.txt', 'w') as fd:
|
||||||
|
fd.write(ontology_txt)
|
||||||
|
|
|
@ -301,7 +301,7 @@ pandora.ui.infoView = function(data) {
|
||||||
|
|
||||||
renderGroup(['originalTitle', 'alternativeTitles']);
|
renderGroup(['originalTitle', 'alternativeTitles']);
|
||||||
|
|
||||||
renderGroup(['type', 'framework', 'style', 'version']);
|
renderGroup(['setincountry', 'type', 'framework', 'style', 'version']);
|
||||||
|
|
||||||
renderGroup(['country', 'year', 'language', 'runtime', 'color', 'sound']);
|
renderGroup(['country', 'year', 'language', 'runtime', 'color', 'sound']);
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ pandora.ui.infoView = function(data) {
|
||||||
renderGroup(['actor']);
|
renderGroup(['actor']);
|
||||||
renderGroup(['filmingLocations']);
|
renderGroup(['filmingLocations']);
|
||||||
|
|
||||||
renderGroup(['imdbId', 'icmaId', 'genre']);
|
renderGroup(['imdbId', 'genre']);
|
||||||
|
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
updateIMDb();
|
updateIMDb();
|
||||||
|
@ -603,9 +603,13 @@ pandora.ui.infoView = function(data) {
|
||||||
} else if (key == 'imdbId') {
|
} else if (key == 'imdbId') {
|
||||||
ret = '<a href="http://www.imdb.com/title/tt'
|
ret = '<a href="http://www.imdb.com/title/tt'
|
||||||
+ value + '">' + value + '</a>';
|
+ value + '">' + value + '</a>';
|
||||||
} else if (key == 'icmaId') {
|
} else if (key == 'encyclopedia') {
|
||||||
ret = '<a href="https://indiancine.ma/'
|
ret = '<a href="/texts/indiancine.ma:Encyclopedia%20of%20Indian%20Cinema/'
|
||||||
+ value + '">' + value + '</a>';
|
+ (value == 'Summary' ? '240' : '570') + '">'
|
||||||
|
+ value + '</a>';
|
||||||
|
} else if (key == 'wiki') {
|
||||||
|
ret = '<a href="' + value + '">'
|
||||||
|
+ Ox.decodeURIComponent(value.split('wiki/').pop()) + '</a>';
|
||||||
} else {
|
} else {
|
||||||
ret = value;
|
ret = value;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 48 KiB |
8
tasks.py
8
tasks.py
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -8,9 +9,16 @@ from celery.task import periodic_task
|
||||||
def subtitles_user(**kwargs):
|
def subtitles_user(**kwargs):
|
||||||
import annotation.models
|
import annotation.models
|
||||||
from user.models import User
|
from user.models import User
|
||||||
|
try:
|
||||||
u = User.objects.get(username='subtitles')
|
u = User.objects.get(username='subtitles')
|
||||||
|
except User.DoesNotExist:
|
||||||
|
print('subtitles user does not exist, unable to move subtitles')
|
||||||
|
return
|
||||||
annotation.models.Annotation.objects.filter(layer='subtitles').exclude(user=u).update(user=u)
|
annotation.models.Annotation.objects.filter(layer='subtitles').exclude(user=u).update(user=u)
|
||||||
|
|
||||||
|
@periodic_task(run_every=timedelta(hours=1), queue='encoding')
|
||||||
|
def update_ontology(**kwargs):
|
||||||
|
import annotation.models
|
||||||
t = datetime.now() - annotation.models.Annotation.objects.all().order_by('-created')[0].created
|
t = datetime.now() - annotation.models.Annotation.objects.all().order_by('-created')[0].created
|
||||||
if t < timedelta(hours=1):
|
if t < timedelta(hours=1):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue