speedtrans/js/staticfuncs.js

28 lines
817 B
JavaScript
Raw Normal View History

2016-02-29 11:56:25 +00:00
function formatFrames(seconds) {
var npt = Ox.formatDuration(seconds, 3);
2015-04-21 14:25:36 +00:00
var dotpos = npt.lastIndexOf(".");
var mmStr = npt.substring(dotpos + 1, npt.length);
var mmInt = parseInt(mmStr);
2016-02-29 11:56:25 +00:00
var frames = parseInt((mmInt / 1000) * 24);
2015-04-21 14:25:36 +00:00
var framesTc = '';
var joinToken = ":";
var framesTc = npt.substring(0, dotpos ) + joinToken + frames;
return framesTc;
2015-12-20 23:54:18 +00:00
}
2015-04-21 14:25:36 +00:00
function isValidTimecode(tc) {
var tc = $.trim(tc);
var nptRegex = new RegExp("^[0-9][0-9]?\:[0-9][0-9]\:[0-9][0-9][\.|\,|\:][0-9]?[0-9]?[0-9]?$");
2016-02-29 11:56:25 +00:00
return nptRegex.test(tc);
2015-12-20 23:54:18 +00:00
}
2015-04-21 14:25:36 +00:00
function getFileNameSansExt(filename) {
var dotPos = filename.lastIndexOf(".");
if (dotPos != '-1') {
2016-02-29 11:56:25 +00:00
var filenameSansExt = filename.substring(0, dotPos);
} else {
2015-04-21 14:25:36 +00:00
var filenameSansExt = filename;
2016-02-29 11:56:25 +00:00
}
2015-04-21 14:25:36 +00:00
return filenameSansExt;
2015-12-20 23:54:18 +00:00
}