-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueueFile.py
49 lines (40 loc) · 1.32 KB
/
queueFile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# import importQueue
import datetime, os
class queueFile(object):
def __init__(self, filename):
self.fullname = filename
self.filename = os.path.basename(filename)
self.extension = os.path.splitext(filename)[1]
self.type = self.getType(self.filename)
self.filedate = datetime.datetime.fromtimestamp(os.path.getmtime(filename)).strftime('%Y-%m-%d')
def type(self):
return self.type
def fullname(self):
return self.fullname
def filename(self):
return self.filename
def extension(self):
return self.extension
def filedate(self):
return self.filedate
def getType(self, file):
file = file.lower()
if '.jpg' in file or '.cr2' in file:
return 'Photo'
elif '.mov' in file or '.mp4' in file or '.m4v' in file:
return 'Video'
else:
return 'Error'
# def getAttribute(self, attrib):
# if attrib == 'full':
# return self.fullname
# elif attrib == 'file':
# return self.filename
# elif attrib == 'ext':
# return self.extension
# elif attrib == 'type':
# return self.type
# elif attrib == 'date':
# return self.date
# else:
# return 'Error in getAttribute'