merge
This commit is contained in:
commit
237a6ea39d
11 changed files with 99 additions and 55 deletions
|
@ -10,13 +10,13 @@
|
||||||
"canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true}
|
"canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true}
|
||||||
},
|
},
|
||||||
"clipKeys": [
|
"clipKeys": [
|
||||||
{"id": "clip:text", "title": "Text", "type": "string"},
|
{"id": "text", "title": "Text", "type": "string"},
|
||||||
{"id": "clip:position", "title": "Position", "type": "float"},
|
{"id": "position", "title": "Position", "type": "float", "sortOperator": "-"},
|
||||||
{"id": "clip:duration", "title": "Duration", "type": "float"},
|
{"id": "duration", "title": "Duration", "type": "float"},
|
||||||
{"id": "clip:hue", "title": "Hue", "type": "hue"},
|
{"id": "hue", "title": "Hue", "type": "float", "sortOperator": "-"},
|
||||||
{"id": "clip:saturation", "title": "Saturation", "type": "float"},
|
{"id": "saturation", "title": "Saturation", "type": "float"},
|
||||||
{"id": "clip:lightness", "title": "Lightness", "type": "float"},
|
{"id": "lightness", "title": "Lightness", "type": "float"},
|
||||||
{"id": "clip:volume", "title": "Volume", "type": "float"}
|
{"id": "volume", "title": "Volume", "type": "float"}
|
||||||
],
|
],
|
||||||
"groups": [
|
"groups": [
|
||||||
{"id": "director", "title": "Director", "type": "string"},
|
{"id": "director", "title": "Director", "type": "string"},
|
||||||
|
@ -298,9 +298,10 @@
|
||||||
{
|
{
|
||||||
"id": "hue",
|
"id": "hue",
|
||||||
"title": "Hue",
|
"title": "Hue",
|
||||||
"type": "hue",
|
"type": "float",
|
||||||
"columnWidth": 90,
|
"columnWidth": 90,
|
||||||
"format": {"type": "color", "args": ["hue"]}
|
"format": {"type": "color", "args": ["hue"]},
|
||||||
|
"sortOperator": "-"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "saturation",
|
"id": "saturation",
|
||||||
|
@ -567,7 +568,7 @@
|
||||||
"icons": "posters",
|
"icons": "posters",
|
||||||
"infoIconSize": 256,
|
"infoIconSize": 256,
|
||||||
"item": "",
|
"item": "",
|
||||||
"itemSort": [{"key": "clip:position", "operator": "+"}],
|
"itemSort": [{"key": "position", "operator": "+"}],
|
||||||
"itemView": "info",
|
"itemView": "info",
|
||||||
"listColumns": ["title", "director", "country", "year", "language", "runtime", "genre"],
|
"listColumns": ["title", "director", "country", "year", "language", "runtime", "genre"],
|
||||||
"listColumnWidth": {},
|
"listColumnWidth": {},
|
||||||
|
|
|
@ -50,13 +50,14 @@ class Clip(models.Model):
|
||||||
|
|
||||||
def json(self, keys=None):
|
def json(self, keys=None):
|
||||||
j = {}
|
j = {}
|
||||||
clip_keys = ('id', 'in', 'out', 'created', 'modified',
|
clip_keys = ('id', 'in', 'out', 'position', 'created', 'modified',
|
||||||
'hue', 'saturation', 'lightness', 'volume')
|
'hue', 'saturation', 'lightness', 'volume')
|
||||||
for key in clip_keys:
|
for key in clip_keys:
|
||||||
j[key] = getattr(self, {
|
j[key] = getattr(self, {
|
||||||
'id': 'public_id',
|
'id': 'public_id',
|
||||||
'in': 'start',
|
'in': 'start',
|
||||||
'out': 'end',
|
'out': 'end',
|
||||||
|
'position': 'start',
|
||||||
}.get(key, key))
|
}.get(key, key))
|
||||||
if keys:
|
if keys:
|
||||||
for key in j.keys():
|
for key in j.keys():
|
||||||
|
|
|
@ -31,9 +31,14 @@ def order_query(qs, sort):
|
||||||
operator = e['operator']
|
operator = e['operator']
|
||||||
if operator != '-':
|
if operator != '-':
|
||||||
operator = ''
|
operator = ''
|
||||||
|
clip_keys = ('public_id', 'start', 'end', 'hue', 'saturation', 'lightness', 'volume',
|
||||||
|
'annotations__value')
|
||||||
key = {
|
key = {
|
||||||
|
'id': 'public_id',
|
||||||
'in': 'start',
|
'in': 'start',
|
||||||
'out': 'end',
|
'out': 'end',
|
||||||
|
'position': 'start',
|
||||||
|
'text': 'annotations__value',
|
||||||
}.get(e['key'], e['key'])
|
}.get(e['key'], e['key'])
|
||||||
if key.startswith('clip:'):
|
if key.startswith('clip:'):
|
||||||
key = e['key'][len('clip:'):]
|
key = e['key'][len('clip:'):]
|
||||||
|
@ -41,7 +46,7 @@ def order_query(qs, sort):
|
||||||
'text': 'annotations__value',
|
'text': 'annotations__value',
|
||||||
'position': 'start',
|
'position': 'start',
|
||||||
}.get(key, key)
|
}.get(key, key)
|
||||||
elif key not in ('start', 'end', 'annotations__value'):
|
elif key not in clip_keys:
|
||||||
#key mgith need to be changed, see order_sort in item/views.py
|
#key mgith need to be changed, see order_sort in item/views.py
|
||||||
key = "item__sort__%s" % key
|
key = "item__sort__%s" % key
|
||||||
order = '%s%s' % (operator, key)
|
order = '%s%s' % (operator, key)
|
||||||
|
|
|
@ -73,7 +73,7 @@ Ox.load({
|
||||||
Ox.extend(pandora.site, {
|
Ox.extend(pandora.site, {
|
||||||
clipKeys: Ox.map(data.site.clipKeys, function(key) {
|
clipKeys: Ox.map(data.site.clipKeys, function(key) {
|
||||||
return Ox.extend(key, {
|
return Ox.extend(key, {
|
||||||
operator: pandora._getSortOperator(key.type)
|
operator: pandora.getSortOperator(key.id)
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
findKeys: Ox.map(data.site.itemKeys, function(key) {
|
findKeys: Ox.map(data.site.itemKeys, function(key) {
|
||||||
|
@ -100,7 +100,7 @@ Ox.load({
|
||||||
},
|
},
|
||||||
sortKeys: Ox.map(pandora.site.itemKeys, function(key) {
|
sortKeys: Ox.map(pandora.site.itemKeys, function(key) {
|
||||||
return key.columnWidth ? Ox.extend(key, {
|
return key.columnWidth ? Ox.extend(key, {
|
||||||
operator: pandora._getSortOperator(key.type)
|
operator: pandora.getSortOperator(key.id)
|
||||||
}) : null;
|
}) : null;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,11 +79,13 @@ pandora.URL = (function() {
|
||||||
state.view = pandora.user.ui.itemView;
|
state.view = pandora.user.ui.itemView;
|
||||||
state.sort = pandora.user.ui.itemSort;
|
state.sort = pandora.user.ui.itemSort;
|
||||||
}
|
}
|
||||||
|
if (state.view == 'map') {
|
||||||
if (pandora.user.ui.mapSelection) {
|
if (pandora.user.ui.mapSelection) {
|
||||||
state.span = '@' + pandora.user.ui.mapSelection;
|
state.span = '@' + pandora.user.ui.mapSelection;
|
||||||
} else if (pandora.user.ui.mapFind) {
|
} else if (pandora.user.ui.mapFind) {
|
||||||
state.span = '@' + pandora.user.ui.mapFind;
|
state.span = '@' + pandora.user.ui.mapFind;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
: pandora.isClipView(pandora.user.ui.itemView)
|
: pandora.isClipView(pandora.user.ui.itemView)
|
||||||
? pandora.user.ui.itemSort : [],
|
? pandora.user.ui.itemSort : [],
|
||||||
|
@ -414,7 +416,7 @@ pandora.URL = (function() {
|
||||||
} else {
|
} else {
|
||||||
action = 'push';
|
action = 'push';
|
||||||
}
|
}
|
||||||
self.URL[action](getState(), pandora.getPageTitle(), getState(keys));
|
self.URL[action](getState(), pandora.getPageTitle(), getState(/*keys*/));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ pandora.ui.clipList = function(videoRatio) {
|
||||||
fixedRatio: fixedRatio,
|
fixedRatio: fixedRatio,
|
||||||
item: function(data, sort, size) {
|
item: function(data, sort, size) {
|
||||||
size = size || 128; // fixme: is this needed?
|
size = size || 128; // fixme: is this needed?
|
||||||
var ratio, width, height, url, sortKey, info;
|
var ratio, width, height,
|
||||||
|
format, info, sortKey, url;
|
||||||
if (!ui.item) {
|
if (!ui.item) {
|
||||||
ratio = data.videoRatio;
|
ratio = data.videoRatio;
|
||||||
width = ratio > fixedRatio ? size : Math.round(size * ratio / fixedRatio);
|
width = ratio > fixedRatio ? size : Math.round(size * ratio / fixedRatio);
|
||||||
|
@ -19,13 +20,19 @@ pandora.ui.clipList = function(videoRatio) {
|
||||||
width = fixedRatio > 1 ? size : Math.round(size * fixedRatio);
|
width = fixedRatio > 1 ? size : Math.round(size * fixedRatio);
|
||||||
height = fixedRatio > 1 ? Math.round(size / fixedRatio) : size;
|
height = fixedRatio > 1 ? Math.round(size / fixedRatio) : size;
|
||||||
}
|
}
|
||||||
url = '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg';
|
|
||||||
sortKey = sort[0].key.split(':').pop();
|
|
||||||
info = ['hue', 'saturation', 'lightness'].indexOf(sortKey) > -1
|
|
||||||
? Ox.formatColor(data[sortKey], sortKey)
|
|
||||||
: Ox.formatDuration(data['in'], 'short') + ' - '
|
|
||||||
+ Ox.formatDuration(data['out'], 'short'),
|
|
||||||
title = data.subtitles[0]; //fixme: could be other layer
|
title = data.subtitles[0]; //fixme: could be other layer
|
||||||
|
url = '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg';
|
||||||
|
sortKey = sort[0].key;
|
||||||
|
if (['text', 'position', 'duration'].indexOf(sortKey) > -1) {
|
||||||
|
info = Ox.formatDuration(data['in'], 'short') + ' - '
|
||||||
|
+ Ox.formatDuration(data.out, 'short');
|
||||||
|
} else {
|
||||||
|
format = pandora.getSortKeyData(sortKey).format;
|
||||||
|
info = format
|
||||||
|
? Ox['format' + Ox.toTitleCase(format.type)]
|
||||||
|
.apply(this, Ox.merge([data[sortKey]], format.args || []))
|
||||||
|
: data[sortKey];
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
height: height,
|
height: height,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
|
|
|
@ -145,19 +145,29 @@ pandora.ui.list = function() {
|
||||||
var ui = pandora.user.ui,
|
var ui = pandora.user.ui,
|
||||||
ratio = ui.icons == 'posters'
|
ratio = ui.icons == 'posters'
|
||||||
? (ui.showSitePoster ? 5/8 : data.posterRatio) : 1,
|
? (ui.showSitePoster ? 5/8 : data.posterRatio) : 1,
|
||||||
info = ['hue', 'saturation', 'lightness'].indexOf(sort[0].key) > -1
|
url = '/' + data.id + '/' + (
|
||||||
? Ox.formatColor(data[sort[0].key], sort[0].key)
|
ui.icons == 'posters'
|
||||||
: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key];
|
? (ui.showSitePoster ? 'siteposter' : 'poster') : 'icon'
|
||||||
|
) + size + '.jpg',
|
||||||
|
sortKey = sort[0].key,
|
||||||
|
format, info;
|
||||||
|
if (['title', 'director'].indexOf(sortKey) > -1) {
|
||||||
|
info = data['year'];
|
||||||
|
} else {
|
||||||
|
sortKey = sort[0].key,
|
||||||
|
format = pandora.getSortKeyData(sortKey).format,
|
||||||
|
info = format
|
||||||
|
? Ox['format' + Ox.toTitleCase(format.type)]
|
||||||
|
.apply(this, Ox.merge([data[sortKey]], format.args || []))
|
||||||
|
: data[sortKey];
|
||||||
|
}
|
||||||
size = size || 128;
|
size = size || 128;
|
||||||
return {
|
return {
|
||||||
height: Math.round(ratio <= 1 ? size : size / ratio),
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: info,
|
info: info,
|
||||||
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
||||||
url: '/' + data.id + '/' + (
|
url: url,
|
||||||
ui.icons == 'posters'
|
|
||||||
? (ui.showSitePoster ? 'siteposter' : 'poster') : 'icon'
|
|
||||||
) + size + '.jpg',
|
|
||||||
width: Math.round(ratio >= 1 ? size : size * ratio)
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -210,7 +210,14 @@ pandora.ui.mainMenu = function() {
|
||||||
} else if (data.id == 'viewicons') {
|
} else if (data.id == 'viewicons') {
|
||||||
pandora.UI.set({icons: value});
|
pandora.UI.set({icons: value});
|
||||||
} else if (data.id == 'viewmovies') {
|
} else if (data.id == 'viewmovies') {
|
||||||
pandora.UI.set('listView', value);
|
var set = {listView: value};
|
||||||
|
if (
|
||||||
|
!pandora.isClipView(key, pandora.user.ui.item)
|
||||||
|
&& ['title', 'position'].indexOf(pandora.user.ui.listSort[0].key) > -1
|
||||||
|
) {
|
||||||
|
set.listSort = pandora.site.user.ui.listSort;
|
||||||
|
}
|
||||||
|
pandora.UI.set(set);
|
||||||
} else if (['personallists', 'favoritelists', 'featuredlists'].indexOf(value) > -1) {
|
} else if (['personallists', 'favoritelists', 'featuredlists'].indexOf(value) > -1) {
|
||||||
pandora.UI.set({list: value.substr(8)});
|
pandora.UI.set({list: value.substr(8)});
|
||||||
}
|
}
|
||||||
|
@ -277,6 +284,7 @@ pandora.ui.mainMenu = function() {
|
||||||
that[data.value.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
that[data.value.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
||||||
},
|
},
|
||||||
pandora_listview: function(data) {
|
pandora_listview: function(data) {
|
||||||
|
pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + data.value);
|
||||||
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
|
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
|
||||||
that.replaceMenu('sortMenu', getSortMenu());
|
that.replaceMenu('sortMenu', getSortMenu());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.sortSelect = function() {
|
pandora.ui.sortSelect = function() {
|
||||||
var items = [],
|
var isClipView = pandora.isClipView(),
|
||||||
|
items = [],
|
||||||
sortKey = !pandora.user.ui.item ? 'listSort' : 'itemSort',
|
sortKey = !pandora.user.ui.item ? 'listSort' : 'itemSort',
|
||||||
that;
|
that;
|
||||||
if (pandora.isClipView()) {
|
if (isClipView) {
|
||||||
items = pandora.site.clipKeys.map(function(key) {
|
items = pandora.site.clipKeys.map(function(key) {
|
||||||
return Ox.extend(Ox.clone(key), {
|
return Ox.extend(Ox.clone(key), {
|
||||||
checked: key.id == pandora.user.ui[sortKey][0].key,
|
checked: key.id == pandora.user.ui[sortKey][0].key,
|
||||||
title: 'Sort by ' + (!pandora.user.ui.item ? 'Clip ' : '') + key.title
|
title: 'Sort by ' + (!pandora.user.ui.item ? 'Clip ' : '') + key.title
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//!pandora.user.ui.item && items.push({});
|
// fixme: a separator would be good
|
||||||
|
// !pandora.user.ui.item && items.push({});
|
||||||
}
|
}
|
||||||
if (!pandora.user.ui.item) {
|
if (!pandora.user.ui.item) {
|
||||||
items = Ox.merge(items, pandora.site.sortKeys.map(function(key) {
|
items = Ox.merge(items, Ox.map(pandora.site.sortKeys, function(key) {
|
||||||
return Ox.extend(Ox.clone(key), {
|
return Ox.getPositionById(items, key.id) == -1
|
||||||
|
? Ox.extend(Ox.clone(key), {
|
||||||
checked: key.id == pandora.user.ui[sortKey][0].key,
|
checked: key.id == pandora.user.ui[sortKey][0].key,
|
||||||
title: 'Sort by ' + key.title
|
title: 'Sort by ' + key.title
|
||||||
});
|
})
|
||||||
|
: null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
that = Ox.Select({
|
that = Ox.Select({
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
|
|
||||||
pandora.ui.viewSelect = function() {
|
pandora.ui.viewSelect = function() {
|
||||||
var viewKey = !pandora.user.ui.item ? 'listView' : 'itemView',
|
var sortKey = !pandora.user.ui.item ? 'listSort' : 'itemSort',
|
||||||
|
viewKey = !pandora.user.ui.item ? 'listView' : 'itemView',
|
||||||
that = Ox.Select({
|
that = Ox.Select({
|
||||||
id: 'viewSelect',
|
id: 'viewSelect',
|
||||||
items: Ox.map(pandora.site[viewKey + 's'], function(view) {
|
items: Ox.map(pandora.site[viewKey + 's'], function(view) {
|
||||||
|
@ -22,7 +23,16 @@ pandora.ui.viewSelect = function() {
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
pandora.UI.set(viewKey, data.selected[0].id);
|
var key = data.selected[0].id,
|
||||||
|
set = {};
|
||||||
|
set[viewKey] = key
|
||||||
|
if (
|
||||||
|
!pandora.isClipView(key, pandora.user.ui.item)
|
||||||
|
&& ['title', 'position'].indexOf(pandora.user.ui[sortKey][0].key) > -1
|
||||||
|
) {
|
||||||
|
set[sortKey] = pandora.site.user.ui.listSort;
|
||||||
|
}
|
||||||
|
pandora.UI.set(set);
|
||||||
},
|
},
|
||||||
pandora_listview: function(data) {
|
pandora_listview: function(data) {
|
||||||
that.selectItem(data.value);
|
that.selectItem(data.value);
|
||||||
|
|
|
@ -592,19 +592,15 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
pandora._getSortOperator = function(type) {
|
pandora.getSortKeyData = function(key) {
|
||||||
return ['hue', 'string', 'text'].indexOf(
|
return Ox.getObjectById(pandora.site.itemKeys, key)
|
||||||
Ox.isArray(type) ? type[0] : type
|
|| Ox.getObjectById(pandora.site.clipKeys, key);
|
||||||
) > -1 ? '+' : '-';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pandora.getSortOperator = function(key) { // fixme: remove?
|
pandora.getSortOperator = function(key) {
|
||||||
var type = Ox.getObjectById(
|
var data = pandora.getSortKeyData(key);
|
||||||
/^clip:/.test(key) ? pandora.site.clipKeys : pandora.site.itemKeys,
|
return data.sortOperator || ['string', 'text'].indexOf(
|
||||||
key
|
Ox.isArray(data.type) ? data.type[0] : data.type
|
||||||
).type;
|
|
||||||
return ['hue', 'string', 'text'].indexOf(
|
|
||||||
Ox.isArray(type) ? type[0] : type
|
|
||||||
) > -1 ? '+' : '-';
|
) > -1 ? '+' : '-';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue