| 12345678910111213141516171819202122232425262728293031 |
- app.controller('processedCtrl', ['$scope', '$http', function ($scope, $http) {
- $scope.update = function() {
- $http.get('back/list/processed').success(function(data) {
- $scope.videolist = data.list.map(function(el) {
- if (el.end_time==0) return el;
- if (el.start_time==0) return el;
- if (el.end_time.indexOf(":") == -1 ) { //1800 => 0:30:00
- el.end_time=toHHMMSS(el.end_time);
- }
- if (el.start_time.indexOf(":") == -1 ) { //1800 => 0:30:00
- el.start_time=toHHMMSS(el.start_time);
- }
- return el;
- });
- });
- };
- $scope.update();
- function toHHMMSS (t) {
- var sec_num = parseInt(t, 10); // don't forget the second param
- var hours = Math.floor(sec_num / 3600);
- var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
- var seconds = sec_num - (hours * 3600) - (minutes * 60);
-
- if (hours < 10) {hours = "0"+hours;}
- if (minutes < 10) {minutes = "0"+minutes;}
- if (seconds < 10) {seconds = "0"+seconds;}
- return hours+':'+minutes+':'+seconds;
- }
- }]);
|