Compare commits
No commits in common. "6a18c14d423e6919dac7d4e52e9d3813901d51e2" and "40784222a5f79c9248bf1c5ec566b290a5fe32f2" have entirely different histories.
6a18c14d42
...
40784222a5
4 changed files with 12 additions and 116 deletions
|
|
@ -1,51 +0,0 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
|
|
||||||
import getpass
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import ox
|
|
||||||
import ox.web.auth
|
|
||||||
|
|
||||||
site = 'pandora.cinemusespace.com'
|
|
||||||
api = ox.API('https://%s/api/' % site)
|
|
||||||
update = False
|
|
||||||
try:
|
|
||||||
credentials = ox.web.auth.get(site)
|
|
||||||
except:
|
|
||||||
credentials = {}
|
|
||||||
print('Please provide your username and password for %s:' % site)
|
|
||||||
credentials['username'] = input('Username: ')
|
|
||||||
credentials['password'] = getpass.getpass('Password: ')
|
|
||||||
update = True
|
|
||||||
r = api.signin(**credentials)
|
|
||||||
if 'errors' in r.get('data', {}):
|
|
||||||
for kv in r['data']['errors'].items():
|
|
||||||
print('%s: %s' % kv)
|
|
||||||
sys.exit(1)
|
|
||||||
if update:
|
|
||||||
ox.web.auth.update(site, credentials)
|
|
||||||
|
|
||||||
rename = json.load(open(sys.argv[1]))
|
|
||||||
|
|
||||||
for old, new in rename.items():
|
|
||||||
for annotation in api.findAnnotations({
|
|
||||||
'query': {
|
|
||||||
'conditions': [{
|
|
||||||
'key': 'value',
|
|
||||||
'value': old,
|
|
||||||
'operator': '=='
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'key': 'layer',
|
|
||||||
'value': 'keywords',
|
|
||||||
'operator': '=='
|
|
||||||
}],
|
|
||||||
'operator': '&'
|
|
||||||
},
|
|
||||||
'keys': ['id', 'in', 'out', 'value', 'user', 'created'],
|
|
||||||
'range': [0, 500000]
|
|
||||||
})['data']['items']:
|
|
||||||
print(annotation['id'], annotation['value'], '->', new)
|
|
||||||
r = api.editAnnotation({'id': annotation['id'], 'value': new})
|
|
||||||
print(r.get('status'))
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import getpass
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
import ox.web.auth
|
import ox.web.auth
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
url = 'http://131.111.144.26/api/'
|
||||||
|
|
||||||
|
api = ox.API(url)
|
||||||
|
site = '131.111.144.26'
|
||||||
|
|
||||||
site = 'pandora.cinemusespace.com'
|
|
||||||
api = ox.API('https://%s/api/' % site)
|
|
||||||
update = False
|
|
||||||
try:
|
try:
|
||||||
credentials = ox.web.auth.get(site)
|
credentials = ox.web.auth.get(site)
|
||||||
except:
|
except:
|
||||||
|
|
@ -26,7 +26,6 @@ if 'errors' in r.get('data', {}):
|
||||||
if update:
|
if update:
|
||||||
ox.web.auth.update(site, credentials)
|
ox.web.auth.update(site, credentials)
|
||||||
|
|
||||||
|
|
||||||
old = []
|
old = []
|
||||||
for annotation in api.findAnnotations({
|
for annotation in api.findAnnotations({
|
||||||
'query': {
|
'query': {
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<script src="/static/oxjs/min/Ox.js"></script>
|
|
||||||
<script>
|
|
||||||
function pandora_api(action, data, callback) {
|
|
||||||
var url = '/api/';
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.addEventListener('load', function (evt) {
|
|
||||||
var data = JSON.parse(evt.target.responseText);
|
|
||||||
callback(data);
|
|
||||||
});
|
|
||||||
var formData = new FormData();
|
|
||||||
formData.append('action', action);
|
|
||||||
formData.append('data', JSON.stringify(data));
|
|
||||||
xhr.open('POST', url);
|
|
||||||
xhr.send(formData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function render() {
|
|
||||||
var hash = document.location.hash.slice(1).split('/')
|
|
||||||
if (hash.length == 2) {
|
|
||||||
var item = hash[0],
|
|
||||||
time = hash[1].split(','),
|
|
||||||
in_ = time[0],
|
|
||||||
out = time[1];
|
|
||||||
|
|
||||||
in_ = Ox.parseDuration(in_);
|
|
||||||
out = Ox.parseDuration(out);
|
|
||||||
pandora_api('get', {
|
|
||||||
id: item,
|
|
||||||
keys: ['title', 'layers']
|
|
||||||
}, function(result) {
|
|
||||||
var html = ''
|
|
||||||
html += '<h1>' + result.data.title + ': ' + time[0] + ' - ' + time[1] + '</h1>'
|
|
||||||
html += '<img src="/' + item + '/240p'+in_+'.jpg">'
|
|
||||||
Ox.sortBy(result.data.layers.keywords, 'value').forEach(function(keyword) {
|
|
||||||
if (keyword['in'] <= out && keyword['out'] >= in_) {
|
|
||||||
html += '<br>' + keyword['value'];
|
|
||||||
}
|
|
||||||
})
|
|
||||||
document.body.innerHTML = html;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
window.onhashchange = render
|
|
||||||
|
|
||||||
render()
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -449,7 +449,7 @@ pandora.ui.infoView = function(data) {
|
||||||
var $rightsLevel = $('<div>');
|
var $rightsLevel = $('<div>');
|
||||||
var $div = $('<div>')
|
var $div = $('<div>')
|
||||||
.css({marginBottom: '4px'})
|
.css({marginBottom: '4px'})
|
||||||
.append(formatKey('Rights Level', 'statistics'))
|
.append('Rights Level')
|
||||||
.append($rightsLevel)
|
.append($rightsLevel)
|
||||||
.appendTo($statistics);
|
.appendTo($statistics);
|
||||||
pandora.createLinks($div);
|
pandora.createLinks($div);
|
||||||
|
|
@ -562,10 +562,10 @@ pandora.ui.infoView = function(data) {
|
||||||
key = Ox._('Alternative Title' + (
|
key = Ox._('Alternative Title' + (
|
||||||
data.alternativeTitles && data.alternativeTitles.length == 1 ? '' : 's'
|
data.alternativeTitles && data.alternativeTitles.length == 1 ? '' : 's'
|
||||||
));
|
));
|
||||||
} else if (key == 'Topic') {
|
} else if (key == 'topic') {
|
||||||
key = 'Topics'
|
key = 'topics'
|
||||||
} else if (key == 'Actor') {
|
} else if (key == 'actor') {
|
||||||
key = 'Actors'
|
key = 'actors'
|
||||||
}
|
}
|
||||||
var value = Ox.toTitleCase(key)
|
var value = Ox.toTitleCase(key)
|
||||||
.replace(' Of ', ' of ')
|
.replace(' Of ', ' of ')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue