Browse Source

add date to files got inside dir

beware: files are still missing filters
boyska 6 years ago
parent
commit
229b946a32
1 changed files with 4 additions and 1 deletions
  1. 4 1
      feed

+ 4 - 1
feed

@@ -179,7 +179,10 @@ def scan_dir_audio(dirname, extensions=('mp3', 'oga', 'wav', 'ogg')):
 
 def get_audio_from_dir(dirpath):
     fpaths = scan_dir_audio(dirpath)
-    return [Audio('file://' + os.path.realpath(u)) for u in fpaths]
+    return [Audio('file://' + os.path.realpath(u),
+                  date=datetime.datetime.fromtimestamp(os.path.getmtime(u)).
+                  replace(tzinfo=datetime.timezone.utc))
+            for u in fpaths]
 
 
 def get_item_date(el):