Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions browserApp/model/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,24 @@ def get_child(self, n):

return FileItem(os.path.join(self.full_path, self.file_list[n]))

def format_time(self, time_value):
'''Function for formating time'''
return datetime.fromtimestamp(time_value).strftime('%Y-%b-%d %H:%M')

def get_info(self):
data = {
'full_path': self.full_path,
}

if os.path.isfile(self.full_path):
stat = os.stat(self.full_path)
data['type'] = "File"

# data['file_ext'] = # Retrieve file ext
data['file_size'] = str(stat.st_size) + " bytes"
data['created'] = datetime.fromtimestamp(stat.st_ctime).strftime('%Y-%b-%d %H:%M')
data['modified'] = datetime.fromtimestamp(stat.st_mtime).strftime('%Y-%b-%d %H:%M')
data['device'] = str(stat.st_dev)

print(stat.st_ctime)
data['Type'] = os.path.splitext(self.full_path)[1] # Get extension from filename
data['file_name: '] = os.path.splitext(self.full_path)[0] # Get filename
data['file_size'] = os.path.getsize(self.full_path) # store the file size in "12.23MB" format
data['created'] = self.format_time(stat.st_ctime)
data['modified'] = self.format_time(stat.st_mtime)
#data['device'] = str(stat.st_dev)



Expand Down