forked from 0x2620/pandora
better static page
This commit is contained in:
parent
49bf1acab0
commit
da70450f78
9 changed files with 57 additions and 29 deletions
|
@ -823,9 +823,8 @@ def item(request, id):
|
|||
keys = [
|
||||
'year',
|
||||
'director',
|
||||
'country',
|
||||
'keywords',
|
||||
'summary'
|
||||
'topic',
|
||||
'description'
|
||||
]
|
||||
data = []
|
||||
for key in keys:
|
||||
|
@ -848,12 +847,13 @@ def item(request, id):
|
|||
'settings': settings,
|
||||
'data': data,
|
||||
'clips': clips,
|
||||
'icon': 'poster',
|
||||
'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster',
|
||||
|
||||
}
|
||||
for key in ('title', 'description', 'keywords'):
|
||||
value = item.get({
|
||||
'description': 'summary' in keys and 'summary' or 'description'
|
||||
'description': 'summary' in keys and 'summary' or 'description',
|
||||
'keywords': 'topic' in keys and 'topic' or 'keywords'
|
||||
}.get(key, key))
|
||||
if isinstance(value, list):
|
||||
value = value = ', '.join(value)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"filters": [
|
||||
{"id": "source", "title": "Sources", "type": "string"},
|
||||
{"id": "project", "title": "Projects", "type": "string"},
|
||||
{"id": "topics", "title": "Topics", "type": "string"},
|
||||
{"id": "topic", "title": "Topics", "type": "string"},
|
||||
{"id": "name", "title": "People", "type": "string"},
|
||||
{"id": "keywords", "title": "Keywords", "type": "string"},
|
||||
{"id": "language", "title": "Languages", "type": "string"},
|
||||
|
@ -517,7 +517,7 @@
|
|||
{"id": "source", "sort": [{"key": "name", "operator": "+"}]},
|
||||
{"id": "project", "sort": [{"key": "name", "operator": "+"}]},
|
||||
{"id": "topic", "sort": [{"key": "items", "operator": "-"}]},
|
||||
{"id": "people", "sort": [{"key": "items", "operator": "-"}]},
|
||||
{"id": "name", "sort": [{"key": "items", "operator": "-"}]},
|
||||
{"id": "keywords", "sort": [{"key": "items", "operator": "-"}]},
|
||||
{"id": "places", "sort": [{"key": "items", "operator": "-"}]}
|
||||
],
|
||||
|
@ -529,7 +529,7 @@
|
|||
"itemFind": {"conditions": [], "operator": "&"},
|
||||
"itemSort": [{"key": "position", "operator": "+"}],
|
||||
"itemView": "info",
|
||||
"listColumns": ["title", "director", "location", "source", "language", "duration", "source"],
|
||||
"listColumns": ["title", "director", "location", "source", "language", "duration"],
|
||||
"listColumnWidth": {},
|
||||
"listSelection": [],
|
||||
"listSort": [{"key": "title", "operator": "+"}],
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<img src="/{{id}}/poster256.jpg" style="float: left; margin-right: 8px">
|
||||
<img src="/{{id}}/{{icon}}256.jpg" style="float: left; margin-right: 8px">
|
||||
<h1>{{title}}</h1>
|
||||
{% for i in data %}
|
||||
<div>
|
||||
|
|
|
@ -132,7 +132,7 @@ pandora.UI = (function() {
|
|||
// if the item view doesn't change, remains a video view,
|
||||
// video points don't exist yet, and won't be set,
|
||||
// add default video points
|
||||
add['videoPoints.' + item] = {'in': 0, out: 0, position: 0};
|
||||
add['videoPoints.' + item] = {annotation: '', 'in': 0, out: 0, position: 0};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ pandora.UI = (function() {
|
|||
) {
|
||||
// if video points don't exist yet, and won't be set,
|
||||
// add default video points
|
||||
add['videoPoints.' + item] = {'in': 0, out: 0, position: 0};
|
||||
add['videoPoints.' + item] = {annotation: '', 'in': 0, out: 0, position: 0};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ pandora.URL = (function() {
|
|||
// ...
|
||||
} else if (['video', 'timeline'].indexOf(state.view) > -1) {
|
||||
var videoPoints = pandora.user.ui.videoPoints[state.item] || {};
|
||||
state.span = Ox.merge(
|
||||
state.span = videoPoints.annotation || Ox.merge(
|
||||
videoPoints.position
|
||||
? videoPoints.position
|
||||
: [],
|
||||
|
@ -57,6 +57,8 @@ pandora.URL = (function() {
|
|||
|
||||
function setState(state, callback) {
|
||||
|
||||
Ox.Log('URL', 'setState:', state);
|
||||
|
||||
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
|
||||
pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find);
|
||||
pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find);
|
||||
|
@ -86,11 +88,15 @@ pandora.URL = (function() {
|
|||
|
||||
if (state.span) {
|
||||
if (['video', 'timeline'].indexOf(state.view) > -1) {
|
||||
// fixme: this doesn't handle annotation ids
|
||||
set['videoPoints.' + state.item] = {
|
||||
position: state.span[0] || 0,
|
||||
'in': state.span[1] || 0,
|
||||
out: Math.max(state.span[1] || 0, state.span[2] || 0)
|
||||
if (Ox.isArray(state.span)) {
|
||||
set['videoPoints.' + state.item] = {
|
||||
annotation: '',
|
||||
'in': state.span[1] || 0,
|
||||
out: Math.max(state.span[1] || 0, state.span[2] || 0),
|
||||
position: state.span[0]
|
||||
};
|
||||
} else {
|
||||
set['videoPoints.' + state.item + '.annotation'] = state.span;
|
||||
}
|
||||
} else if (state.view == 'map') {
|
||||
// fixme: this doesn't handle map coordinates
|
||||
|
@ -226,7 +232,7 @@ pandora.URL = (function() {
|
|||
pages: [
|
||||
'about', 'api', 'contact', 'faq', 'help', 'home', 'news',
|
||||
'preferences', 'rights', 'signin', 'signout', 'signup',
|
||||
'software', 'terms', 'tour', 'tv'
|
||||
'software', 'terms', 'tour', 'tutorial', 'tv'
|
||||
],
|
||||
sortKeys: sortKeys,
|
||||
spanType: spanType,
|
||||
|
|
|
@ -101,6 +101,7 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
var id = data.ids[0],
|
||||
item = !ui.item ? id.split('/')[0] : ui.item,
|
||||
points = {
|
||||
annotation: that.value(id, 'annotations')[0].id.split('/')[1],
|
||||
'in': that.value(id, 'in'),
|
||||
out: that.value(id, 'out')
|
||||
},
|
||||
|
@ -198,7 +199,6 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
that.options({sort: data.value});
|
||||
}
|
||||
});
|
||||
|
||||
return that;
|
||||
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ pandora.ui.infoView = function(data) {
|
|||
)
|
||||
.appendTo($text);
|
||||
|
||||
var list_keys = ['language', 'category', 'director', 'cinematographer', 'features'];
|
||||
var list_keys = ['language', 'topic', 'director', 'cinematographer', 'features'];
|
||||
$('<div>').html('<br>').appendTo($text);
|
||||
[
|
||||
'date',
|
||||
|
@ -275,7 +275,7 @@ pandora.ui.infoView = function(data) {
|
|||
'language',
|
||||
'source',
|
||||
'project',
|
||||
'category',
|
||||
'topic',
|
||||
'user',
|
||||
].forEach(function(key) {
|
||||
var $div = $('<div>')
|
||||
|
@ -387,14 +387,14 @@ pandora.ui.infoView = function(data) {
|
|||
var edit = {id: data.id};
|
||||
if (key == 'title') {
|
||||
edit[key] = value;
|
||||
} else if(['director', 'country', 'language', 'category'].indexOf(key) > -1) {
|
||||
} else if(list_keys.indexOf(key) > -1) {
|
||||
edit[key] = value ? value.split(', ') : [];
|
||||
} else {
|
||||
edit[key] = value;
|
||||
}
|
||||
pandora.api.edit(edit, function(result) {
|
||||
Ox.Request.clearCache(); // fixme: too much? can change filter/list etc
|
||||
if (result.data.id != data.id) {
|
||||
Ox.Request.clearCache(); // fixme: too much
|
||||
pandora.UI.set({item: result.data.id});
|
||||
pandora.$ui.browser.value(data.id, 'id', result.data.id);
|
||||
}
|
||||
|
|
|
@ -226,6 +226,9 @@ pandora.ui.item = function() {
|
|||
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
|
||||
posterFrame: parseInt(videoOptions.video.duration / 2),
|
||||
resolution: pandora.user.ui.videoResolution,
|
||||
selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
|
||||
? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
|
||||
: '',
|
||||
showAnnotations: pandora.user.ui.showAnnotations,
|
||||
showLargeTimeline: true,
|
||||
subtitles: videoOptions.subtitles,
|
||||
|
@ -259,6 +262,7 @@ pandora.ui.item = function() {
|
|||
},
|
||||
points: function(data) {
|
||||
pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
|
||||
annotation: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation,
|
||||
'in': data['in'],
|
||||
out: data.out,
|
||||
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position
|
||||
|
@ -278,6 +282,9 @@ pandora.ui.item = function() {
|
|||
resolution: function(data) {
|
||||
pandora.UI.set('videoResolution', data.resolution);
|
||||
},
|
||||
select: function(data) {
|
||||
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]);
|
||||
},
|
||||
subtitles: function(data) {
|
||||
pandora.UI.set('videoSubtitles', data.subtitles);
|
||||
},
|
||||
|
|
|
@ -631,7 +631,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
|
|||
// and checks if it's an annotation/event/place id or an event/place name,
|
||||
// and returns the id (or none) and the view (or none)
|
||||
// fixme: "subtitles:23" is still missing
|
||||
Ox.Log('', 'getMetadataByIdOrName', item, view, str);
|
||||
Ox.Log('URL', 'getMetadataByIdOrName', item, view, str);
|
||||
var isName = str[0] == '@',
|
||||
canBeAnnotation = (
|
||||
!view || view == 'video' || view == 'timeline'
|
||||
|
@ -641,7 +641,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
|
|||
str = isName ? str.substr(1) : str;
|
||||
getId(canBeAnnotation ? 'annotation' : '', function(id) {
|
||||
if (id) {
|
||||
Ox.Log('', 'id?', id)
|
||||
Ox.Log('URL', 'id?', id)
|
||||
callback(id, pandora.user.ui.videoView);
|
||||
} else {
|
||||
getId(canBePlace ? 'place' : '', function(id) {
|
||||
|
@ -668,20 +668,35 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
|
|||
query: {
|
||||
conditions: [{
|
||||
key: isName ? 'name' : 'id',
|
||||
value: type == 'annotation' ? item + '/' + str : str,
|
||||
value: type != 'annotation' ? str : item + '/' + str,
|
||||
operator: '=='
|
||||
}],
|
||||
operator: '&'
|
||||
},
|
||||
keys: ['id'],
|
||||
keys: type != 'annotation' ? ['id'] : ['id', 'in', 'out'],
|
||||
range: [0, 1]
|
||||
}, item ? {
|
||||
}, item && type != 'annotation' ? {
|
||||
itemQuery: {
|
||||
conditions: [{key: 'id', value: item, operator: '=='}],
|
||||
operator: '&'
|
||||
}
|
||||
} : {}), function(result) {
|
||||
callback(result.data.items.length ? result.data.items[0].id : '');
|
||||
var annotation, span;
|
||||
if (result.data.items.length) {
|
||||
span = result.data.items[0];
|
||||
annotation = span.id.split('/')[1];
|
||||
type == 'annotation' && pandora.UI.set('videoPoints.' + item, {
|
||||
annotation: annotation,
|
||||
'in': span['in'],
|
||||
out: span.out,
|
||||
position: span['in']
|
||||
});
|
||||
}
|
||||
callback(
|
||||
!span ? ''
|
||||
: type != 'annotation' ? span.id
|
||||
: annotation
|
||||
);
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
|
|
Loading…
Reference in a new issue