cleanup, use Firefogg module
This commit is contained in:
parent
5be87d8adb
commit
a3e3de8c99
8 changed files with 325 additions and 480 deletions
|
|
@ -4,6 +4,20 @@
|
|||
<script src="http://oxjs.org/js/jquery-1.4.2.min.js"></script>
|
||||
<script type="text/javascript" src="/static/oxjs/build/js/ox.js"></script>
|
||||
<script>
|
||||
function absolute_url(url) {
|
||||
var base = document.location.href;
|
||||
if (url.substring(0, 1) == '/') {
|
||||
url = document.location.href.substring(0, document.location.href.length-document.location.pathname.length) + url;
|
||||
}
|
||||
else {
|
||||
if(base.substring(base.length-1) == '/')
|
||||
url = base + url;
|
||||
else
|
||||
url = base + '/' + url;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
pandora = {};
|
||||
pandora.request_url = '/api/';
|
||||
|
||||
|
|
@ -102,31 +116,63 @@ function for_each_sorted(elements, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
function uploadFile(oshash) {
|
||||
var url = absolute_url('/api/');
|
||||
ox.upload(JSON.stringify({
|
||||
url: url,
|
||||
data: {action: 'upload', oshash: oshash},
|
||||
oshash: oshash,
|
||||
action: 'file'
|
||||
}),
|
||||
function(result) {
|
||||
$('#' + oshash).css('background', '#fff');
|
||||
console.log(result);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function extract(oshash) {
|
||||
console.log(oshash);
|
||||
/*
|
||||
/*
|
||||
ox.extract(oshash, 'stills', function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
*/
|
||||
profile = '96p.webm';
|
||||
var url = 'http://127.0.0.1:8000/api/upload/?profile='+profile+'&oshash='+oshash;
|
||||
|
||||
$('<div>').attr('id', 'progress_'+oshash)
|
||||
.appendTo('#' + oshash);
|
||||
ox.uploadVideo(oshash, url, profile, function(result) {
|
||||
console.log(result);
|
||||
$('#' + oshash).css('background', '#fff');
|
||||
$('#' + oshash).parent().css('background', '#fff');
|
||||
$('#progress_'+oshash).remove();
|
||||
}, function(result) {
|
||||
try {
|
||||
var data = JSON.parse(result);
|
||||
$('#progress_'+oshash).html(data.status +': '+ data.progress);
|
||||
} catch(e) {
|
||||
console.log('progress failed', e);
|
||||
*/
|
||||
var url = absolute_url('/api/');
|
||||
ox.upload(JSON.stringify({
|
||||
url: url,
|
||||
data: {action: 'upload', oshash: oshash},
|
||||
oshash: oshash,
|
||||
action: 'frames'
|
||||
}),
|
||||
function(result) {
|
||||
//FIXME: check result before posting video
|
||||
profile = '96p.webm';
|
||||
var url = absolute_url('/api/upload/') + '?profile=' + profile + '&oshash=' + oshash;
|
||||
|
||||
$('<div>').attr('id', 'progress_'+oshash)
|
||||
.appendTo('#' + oshash);
|
||||
|
||||
ox.upload(JSON.stringify({
|
||||
oshash: oshash,
|
||||
action: 'video',
|
||||
profile: profile,
|
||||
url: url
|
||||
}),
|
||||
function(result) {
|
||||
console.log(result);
|
||||
$('#' + oshash).css('background', '#fff');
|
||||
$('#' + oshash).parent().css('background', '#fff');
|
||||
$('#progress_'+oshash).remove();
|
||||
}, function(result) {
|
||||
try {
|
||||
var data = JSON.parse(result);
|
||||
$('#progress_'+oshash).html(data.status +': '+ data.progress);
|
||||
} catch(e) {
|
||||
console.log('progress failed', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
|
@ -160,6 +206,12 @@ function update() {
|
|||
});
|
||||
$.each(result.data.file, function(i, oshash) {
|
||||
$('#' + oshash).css('background', 'blue');
|
||||
$('#' + oshash).unbind('click').click(function() {
|
||||
$(this).unbind('click');
|
||||
uploadFile(this.id);
|
||||
return true;
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
if (result.data.info.length>0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue