Explorar o código

Fix date format

David %!s(int64=10) %!d(string=hai) anos
pai
achega
7a6cece41f
Modificáronse 4 ficheiros con 18 adicións e 19 borrados
  1. 14 7
      back/db.py
  2. 2 10
      front/views/processed.html
  3. 1 1
      front/views/raw.html
  4. 1 1
      front/views/uploadList.html

+ 14 - 7
back/db.py

@@ -1,3 +1,4 @@
+import datetime
 import time
 import re
 import os
@@ -17,7 +18,12 @@ class db():
         self.ul_files  = self.client[self.DB]["ul"]
 
     def uploaded(self):
-        ret = [ jsonable(f) for f in self.ul_files.find() ]
+        ret = []
+        for f in self.ul_files.find():
+            item = jsonable(f)
+            item["enqueued_at"]=item["enqueued_at"].strftime("%d/%m/%Y %H:%M")
+            item["finished_at"]=item["finished_at"].strftime("%d/%m/%Y %H:%M")
+            ret.append(item)
         return ret
 
     def raw(self, _id=None):
@@ -25,7 +31,12 @@ class db():
         if _id:
             ret = jsonable(self.raw_files.find_one({"_id": ObjectId(_id)}))
         else:
-            ret = [ jsonable(fix_date(r)) for r in self.raw_files.find() ]
+            ret=[]
+            for r in self.raw_files.find():
+                item = jsonable(r)
+                #item["date"]=item["date"].strftime("%d/%m/%Y %H:%M")
+                ret.append(item)
+
 
         return ret
 
@@ -34,7 +45,7 @@ class db():
         if _id:
             ret = jsonable(self.cut_files.find_one({"_id": ObjectId(_id)}))
         else:
-            ret = [ jsonable(fix_date(c)) for c in self.cut_files.find() ]
+            ret = [ jsonable(c) for c in self.cut_files.find() ]
 
         return ret
 
@@ -69,10 +80,6 @@ class db():
                 self.insert_raw(file_info(os.path.join(RAW_PATH,fname)))
 
 
-def fix_date(obj):
-    ret = obj
-    #ret["date"]=ret["date"].strftime('%Y-%m-%dT%H:%M:%S')
-    return ret
 def get_video_length(fname):
     process="ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -sexagesimal %s" % fname
     process=process.split(" ")

+ 2 - 10
front/views/processed.html

@@ -3,19 +3,11 @@
 	<tr>
 		<th>Inicio</th>
 		<th>Fin</th>
-		<th>Inicio2</th>
-		<th>Fin2</th>
 		<th>Archivo Crudo</th>
 		<th>Archivo Procesado</th>
 		<th>Subir</th>
 	</tr>
 	<tr ng-repeat="v in videolist">
-		<td>
-			{{v.job_start}}
-		</td>
-		<td>
-			{{v.job_end}}
-		</td>
 		<td>
 			{{v.start_time}}
 		</td>
@@ -23,10 +15,10 @@
 			{{v.end_time}}
 		</td>
 		<td>
-			{{v.in_fname}}
+			{{v.in_fname.split("/").slice(-1)[0]}}
 		</td>
 		<td>
-			{{v.out_fname}}
+			{{v.out_fname.split("/").slice(-1)[0]}}
 		</td>
 		<td>
 			<a ng-href="/upload/{{v._id}}">subir</a>

+ 1 - 1
front/views/raw.html

@@ -11,7 +11,7 @@
 				{{r.date | date:'dd/MM/yy HH:mm'}}
 			</td>
 			<td>
-				{{r.file}}
+				{{r.file.split("/").slice(-1)[0]}}
 			</td>
 			<td>
 				{{r.length}}

+ 1 - 1
front/views/uploadList.html

@@ -18,7 +18,7 @@
 			{{v.title}}
 		</td>
 		<td>
-			{{v.video}}
+			{{v.video.split("/").slice(-1)[0]}}
 		</td>
 		<td>
 			<a ng-href="http://youtube.com/watch?v={{v.yt}}" target="_blank">{{v.yt}}</a>