-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathFREAloadcontent.py
More file actions
160 lines (118 loc) · 3.75 KB
/
FREAloadcontent.py
File metadata and controls
160 lines (118 loc) · 3.75 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
def readfile(file_info):
pathname = file_info['path']
if file_info['type'] == 'text/plain':
with open(pathname, 'r') as file:
data = file.read()
return data
if file_info['type'] == 'application/pdf':
pdf_text = ""
try:
fd = open(pathname, "rb")
viewer = SimplePDFViewer(fd)
pdf_text = viewer.render()
except Exception as e:
print(f"Error reading PDF file: {e}")
return pdf_text
def maketags(file_info):
substraction = 'C:/SyncedFolder/Team Shares/FREA/'
pathname = file_info['path']
tagstring = pathname.replace(substraction, '')
tagstring2 = tagstring.replace(file_info['name'], '')
tags = tagstring2.split('/')
print(tags)
return tags
def process_file_getinfo(file_info):
return_data = {}
#data =readfile(file_info)
tags = maketags(file_info)
#return_data['data'] = data
#return_data['tags'] = tags
return tags
def functext(file_info):
process_file_getinfo(file_info)
#text/html
def funcWebPages(file_info):
process_file_getinfo(file_info)
# 'text/markdown':
def funcMarkdown(file_info):
process_file_getinfo(file_info)
# 'application/xml':
def funcXML(file_info):
process_file_getinfo(file_info)
# 'application/pdf':
def funcPDF(file_info):
process_file_getinfo(file_info)
# 'application/msword':
def funcDOC(file_info):
process_file_getinfo(file_info)
# 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
def funcDOCX(file_info):
process_file_getinfo(file_info)
# 'application/vnd.ms-excel (XLS)':
def funcXLS(file_info):
process_file_getinfo(file_info)
# 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
def funcXLSX(file_info):
process_file_getinfo(file_info)
# 'application/vnd.ms-powerpoint (PPT)':
def funcPPT(file_info):
process_file_getinfo(file_info)
# 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
def funcPPTX(file_info):
process_file_getinfo(file_info)
# 'application/rtf':
def funcRTF(file_info):
process_file_getinfo(file_info)
# 'image/jpeg':
def funcJPG(file_info):
process_file_getinfo(file_info)
# 'image/png':
def funcPNG(file_info):
process_file_getinfo(file_info)
# 'image/gif':
def funcGIF(file_info):
process_file_getinfo(file_info)
# 'image/bmp':
def funcBMP(file_info):
process_file_getinfo(file_info)
# 'image/tiff':
def funcTIFF(file_info):
process_file_getinfo(file_info)
# 'application/javascript':
def funcJavaScript(file_info):
process_file_getinfo(file_info)
# 'application/zip':
def funcZIP(file_info):
process_file_getinfo(file_info)
# 'application/gzip':
def funcGZIP(file_info):
process_file_getinfo(file_info)
# 'audio/mpeg':
def funcMP3(file_info):
process_file_getinfo(file_info)
# 'video/mp4':
def funcMP4(file_info):
process_file_getinfo(file_info)
# 'audio/wav':
def funcWAV(file_info):
process_file_getinfo(file_info)
# 'audio/ogg':
def funcOGG(file_info):
process_file_getinfo(file_info)
# 'video/webm':
def funcWEBM(file_info):
process_file_getinfo(file_info)
# 'application/json':
def funcJSON(file_info):
process_file_getinfo(file_info)
# 'application/x-yaml':
def funcYAML(file_info):
process_file_getinfo(file_info)
# 'application/epub+zip':
def funcEPUB(file_info):
process_file_getinfo(file_info)
# 'application/x-mobipocket-ebook':
def funcMOBI(file_info):
process_file_getinfo(file_info)
def funcnone(file_info):
process_file_getinfo(file_info)