better resizing in editor

This commit is contained in:
rolux 2010-11-25 10:05:31 +00:00
parent 91a2579ac6
commit 1e5d77f39d
2 changed files with 84 additions and 40 deletions

View file

@ -318,6 +318,12 @@ class Item(models.Model):
self.get('series title', ''), self.get('episode title', ''), self.get('series title', ''), self.get('episode title', ''),
self.get('season', ''), self.get('episode', '')) self.get('season', ''), self.get('episode', ''))
def oxid_new(self):
return utils.oxdb_id(self.get('title', ''), self.get('directors', []), str(self.get('year', '')),
self.get('season', ''), self.get('episode', ''),
self.get('episode title', ''))
#(title, directors=[], year='', season='', episode='', episode_title='', episode_director='', episode_year='')
''' '''
Search related functions Search related functions
@ -568,15 +574,20 @@ class Item(models.Model):
posters = self.local_posters() posters = self.local_posters()
for poster in posters: for poster in posters:
frame = posters[poster] frame = posters[poster]
timeline = os.path.join(itemid_path(self.itemId), 'timeline.64.png')
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
cmd = ['oxposter', cmd = ['oxposter',
'-t', self.get('title'), '-t', self.get('title'),
'-d', ', '.join(self.get('directors', ['Unknown Director'])), '-d', ', '.join(self.get('directors', ['Unknown Director'])),
'-f', frame, '-f', frame,
'-p', poster '-p', poster,
'-l', timeline,
] ]
if len(self.itemId) == 7: if len(self.itemId) == 7:
cmd += ['-i', self.itemId] cmd += ['-i', self.itemId]
cmd += ['-o', self.oxdbId] cmd += ['-o', self.oxid_new()]
print cmd
p = subprocess.Popen(cmd) p = subprocess.Popen(cmd)
p.wait() p.wait()
return posters.keys() return posters.keys()

View file

@ -304,7 +304,7 @@ app.constructApp = function() {
}) })
.bindEvent('resize', function(event, data) { .bindEvent('resize', function(event, data) {
Ox.print('resize', data, data / app.ui.infoRatio + 16); Ox.print('resize', data, data / app.ui.infoRatio + 16);
app.$ui.leftPanel.resize('infoPanel', Math.round(data / app.ui.infoRatio) + 16); app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16);
}), }),
resizable: true, resizable: true,
resize: [128, 192, 256], resize: [128, 192, 256],
@ -322,7 +322,7 @@ app.constructApp = function() {
elements: [ elements: [
{ {
collapsible: true, collapsible: true,
element: app.$ui.groupsOuterPanel = new Ox.SplitPanel({ element: app.$ui.browser = new Ox.SplitPanel({
elements: [ elements: [
{ {
element: app.$ui.groups[0], element: app.$ui.groups[0],
@ -357,7 +357,7 @@ app.constructApp = function() {
.bindEvent('resize', function(event, data) { .bindEvent('resize', function(event, data) {
Ox.print('resizing groups...') Ox.print('resizing groups...')
$.each(app.$ui.groups, function(i, list) { $.each(app.$ui.groups, function(i, list) {
list.resize(); list.size();
}); });
}), }),
resizable: true, resizable: true,
@ -384,12 +384,12 @@ app.constructApp = function() {
return app.getGroupWidth(i, data); return app.getGroupWidth(i, data);
}); });
Ox.print('widths', widths); Ox.print('widths', widths);
app.$ui.groupsOuterPanel.resize(0, widths[0].list).resize(2, widths[4].list); app.$ui.browser.size(0, widths[0].list).size(2, widths[4].list);
app.$ui.groupsInnerPanel.resize(0, widths[1].list).resize(2, widths[3].list); app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list);
$.each(app.$ui.groups, function(i, list) { $.each(app.$ui.groups, function(i, list) {
list.resizeColumn('name', widths[i].column); list.resizeColumn('name', widths[i].column);
}); });
app.$ui.list.resize(); app.$ui.list.size();
}) })
} }
], ],
@ -516,8 +516,8 @@ app.constructInfo = function() {
app.constructItem = function(id, view) { app.constructItem = function(id, view) {
var $item; var $item;
//location.hash = '!' + id; //location.hash = '!' + id;
app.$ui.contentPanel.resize(0, 80); app.$ui.contentPanel.size(0, 80);
app.$ui.groupsOuterPanel.empty(); app.$ui.browser.empty();
if (view == 'timeline') { if (view == 'timeline') {
app.api.getItem(id, function(result) { app.api.getItem(id, function(result) {
item_debug = result.data.item; item_debug = result.data.item;
@ -531,13 +531,17 @@ app.constructItem = function(id, view) {
video.height = 96; video.height = 96;
video.width = parseInt(video.height * video.aspectRatio / 2) * 2; video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
video.url = video.baseUrl + '/' + video.height + 'p.' + ($.support.video.webm ? 'webm' : 'mp4'); video.url = video.baseUrl + '/' + video.height + 'p.' + ($.support.video.webm ? 'webm' : 'mp4');
$item = new Ox.VideoEditor({ $item = new Ox.SplitPanel({
elements: [
{
element: app.$ui.editor = new Ox.VideoEditor({
cuts: cuts, cuts: cuts,
duration: video.duration, duration: video.duration,
find: '', find: '',
frameURL: function(position) { frameURL: function(position) {
return '/' + id + '/frame/' + video.width.toString() + '/' + position.toString() + '.jpg' return '/' + id + '/frame/' + video.width.toString() + '/' + position.toString() + '.jpg'
}, },
height: app.$ui.contentPanel.height() - 81,
id: 'editor', id: 'editor',
largeTimeline: true, largeTimeline: true,
matches: [], matches: [],
@ -551,21 +555,50 @@ app.constructItem = function(id, view) {
videoSize: 'small', videoSize: 'small',
videoURL: video.url, videoURL: video.url,
width: app.$document.width() - app.$ui.leftPanel.width() - 1 - 256 - 1 width: app.$document.width() - app.$ui.leftPanel.width() - 1 - 256 - 1
})
.bindEvent('resize', function(event, data) {
Ox.print('RESIZE:', data)
app.$ui.editor.options({
width: data
});
}),
size: 'auto'
},
{
collapsible: true,
element: app.$ui.annotations = new Ox.Element('div')
.options({
id: 'annotations'
})
.bindEvent('resize', function(event, data) {
app.$ui.editor.options({
width: app.$document.width() - app.$ui.leftPanel.width() - 1 - app.$ui.annotations.width() - 1.
})
}),
resizable: true,
resize: [128, 192, 256],
size: 256
}
],
orientation: 'horizontal'
}); });
app.$ui.contentPanel.replace(1, $item); app.$ui.contentPanel.replace(1, $item);
app.$ui.rightPanel app.$ui.rightPanel
/*.unbindEvent('resize')*/ /*.unbindEvent('resize')*/
.bindEvent('resize', function(event, data) { .bindEvent('resize', function(event, data) {
Ox.print('seems to work', data) //Ox.print('seems to work', data)
$item.options({ app.$ui.editor.options({
width: data - 256 - 1 width: data - app.$ui.annotations.width() - 1
}); });
}); });
///*
app.$window.resize(function() { app.$window.resize(function() {
$item.options({ app.$ui.editor.options({
width: app.$document.width() - app.$ui.leftPanel.width() - 1 - 256 - 1 height: app.$document.height() - 24 - 24 - 80 - 1 - 16,
width: app.$document.width() - app.$ui.leftPanel.width() - 1 - app.$ui.annotations.width() - 1
}); });
}); });
//*/
}); });
} }
} }
@ -595,7 +628,7 @@ app.constructList = function(view) {
}) })
.bindEvent({ .bindEvent({
resize: function(event, data) { resize: function(event, data) {
$list.resize(); $list.size();
} }
}); });
} else if (view == 'icons') { } else if (view == 'icons') {
@ -630,7 +663,7 @@ app.constructList = function(view) {
width: '100px', width: '100px',
height: '100px', height: '100px',
background: 'red' background: 'red'
}) });
} }
$list.bindEvent({ $list.bindEvent({
closepreview: function(event, data) { closepreview: function(event, data) {
@ -677,7 +710,7 @@ app.constructList = function(view) {
app.$ui.previewImage.animate({ app.$ui.previewImage.animate({
opacity: 0 opacity: 0
}, 100, function() { }, 100, function() {
app.$ui.previewDialog.resize(dialogWidth, dialogHeight, function() { app.$ui.previewDialog.size(dialogWidth, dialogHeight, function() {
app.$ui.previewImage app.$ui.previewImage
.attr({ .attr({
src: item.poster.url src: item.poster.url
@ -778,7 +811,7 @@ app.constructList = function(view) {
width = app.$ui.info.width(), width = app.$ui.info.width(),
height = imageHeight * width / imageWidth; height = imageHeight * width / imageWidth;
app.ui.infoRatio = width / height; app.ui.infoRatio = width / height;
app.$ui.leftPanel.resize('infoPanel', height + 16); app.$ui.leftPanel.size('infoPanel', height + 16);
$still.css({ $still.css({
position: 'absolute', position: 'absolute',
left: 0, left: 0,