radboy 0.0.771__py3-none-any.whl → 0.0.854__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of radboy might be problematic. Click here for more details.
- radboy/Comm/RxTx.py +4 -493
- radboy/Comm/__pycache__/RxTx.cpython-313.pyc +0 -0
- radboy/CookBook/CookBook.py +4 -0
- radboy/DB/ExerciseTracker.py +64 -27
- radboy/DB/GEMINI.py +146 -0
- radboy/DB/Prompt.py +150 -7
- radboy/DB/__pycache__/ExerciseTracker.cpython-313.pyc +0 -0
- radboy/DB/__pycache__/Prompt.cpython-313.pyc +0 -0
- radboy/DB/__pycache__/db.cpython-313.pyc +0 -0
- radboy/DB/db.py +141 -10
- radboy/DayLog/DayLogger.py +1 -1
- radboy/DayLog/__pycache__/DayLogger.cpython-313.pyc +0 -0
- radboy/FB/FBMTXT.py +48 -1
- radboy/FB/__pycache__/FBMTXT.cpython-313.pyc +0 -0
- radboy/HowDoYouDefineMe/CoreEmotions.py +268 -9
- radboy/Lookup2/Lookup2.py +31 -1
- radboy/Lookup2/__pycache__/Lookup2.cpython-313.pyc +0 -0
- radboy/RNE/RNE.py +7 -0
- radboy/RNE/__pycache__/RNE.cpython-313.pyc +0 -0
- radboy/TasksMode/SetEntryNEU.py +16 -2
- radboy/TasksMode/Tasks.py +546 -101
- radboy/TasksMode/__pycache__/SetEntryNEU.cpython-313.pyc +0 -0
- radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc +0 -0
- radboy/Unified/BACKUP.py +443 -0
- radboy/Unified/Unified.py +2 -321
- radboy/Unified/__pycache__/Unified.cpython-313.pyc +0 -0
- radboy/Unified/__pycache__/bareCA.cpython-313.pyc +0 -0
- radboy/Unified/__pycache__/clearalll.cpython-313.pyc +0 -0
- radboy/Unified/bareCA.py +26 -2
- radboy/Unified/clearalll.py +6 -0
- radboy/__init__.py +1 -1
- radboy/__pycache__/__init__.cpython-313.pyc +0 -0
- radboy/code.png +0 -0
- radboy/preloader/preloader.py +70 -0
- radboy/preloader/preloader_func.py +688 -2
- {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/METADATA +1 -1
- {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/RECORD +39 -37
- {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/WHEEL +0 -0
- {radboy-0.0.771.dist-info → radboy-0.0.854.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
radboy/Unified/BACKUP.py
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import csv
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from colored import Fore,Style,Back
|
|
6
|
+
from barcode import Code39,UPCA,EAN8,EAN13
|
|
7
|
+
import barcode,qrcode,os,sys,argparse
|
|
8
|
+
from datetime import datetime,timedelta
|
|
9
|
+
import zipfile,tarfile
|
|
10
|
+
import base64,json
|
|
11
|
+
from ast import literal_eval
|
|
12
|
+
import sqlalchemy
|
|
13
|
+
from sqlalchemy import *
|
|
14
|
+
from sqlalchemy.orm import *
|
|
15
|
+
from sqlalchemy.ext.declarative import declarative_base as dbase
|
|
16
|
+
from sqlalchemy.ext.automap import automap_base
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
import upcean
|
|
19
|
+
from radboy.ExtractPkg.ExtractPkg2 import *
|
|
20
|
+
from radboy.Lookup.Lookup import *
|
|
21
|
+
from radboy.DayLog.DayLogger import *
|
|
22
|
+
from radboy.DB.db import *
|
|
23
|
+
from radboy.DB.Prompt import *
|
|
24
|
+
from radboy.DB.SMLabelImporter import *
|
|
25
|
+
from radboy.DB.ResetTools import *
|
|
26
|
+
|
|
27
|
+
from radboy.ConvertCode.ConvertCode import *
|
|
28
|
+
from radboy.setCode.setCode import *
|
|
29
|
+
from radboy.Locator.Locator import *
|
|
30
|
+
from radboy.ListMode2.ListMode2 import *
|
|
31
|
+
from radboy.TasksMode.Tasks import *
|
|
32
|
+
from radboy.ExportList.ExportListCurrent import *
|
|
33
|
+
from radboy.TouchStampC.TouchStampC import *
|
|
34
|
+
from radboy.EntryExtras.Extras import *
|
|
35
|
+
from radboy import VERSION
|
|
36
|
+
import radboy.possibleCode as pc
|
|
37
|
+
from radboy.Unified.clearalll import *
|
|
38
|
+
from dataclasses import dataclass
|
|
39
|
+
def format_bytes(size):
|
|
40
|
+
"""
|
|
41
|
+
Auto-convert bytes to a human-readable format.
|
|
42
|
+
|
|
43
|
+
this was generated by Google's AI Console.
|
|
44
|
+
"""
|
|
45
|
+
power = 2**10
|
|
46
|
+
n = 0
|
|
47
|
+
power_labels = {0 : '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'}
|
|
48
|
+
while size > power:
|
|
49
|
+
size /= power
|
|
50
|
+
n += 1
|
|
51
|
+
return f"{size:.2f} {power_labels[n]}B"
|
|
52
|
+
@dataclass
|
|
53
|
+
class BACKUP:
|
|
54
|
+
def daemon(self,limit=None):
|
|
55
|
+
bus=[]
|
|
56
|
+
backup_dir=Path(detectGetOrSet("Backup Directory",f"RadBoy Backups/{VERSION}",setValue=False,literal=True))
|
|
57
|
+
now=datetime.now()
|
|
58
|
+
if limit is None:
|
|
59
|
+
limit=timedelta(days=-7)
|
|
60
|
+
for root,dirs,fnames in backup_dir.walk(top_down=True):
|
|
61
|
+
for file in fnames:
|
|
62
|
+
fx=root/Path(file)
|
|
63
|
+
#print(f"{Fore.dark_goldenrod}Checking for age limited backups to delete({fx} >= {limit})){Style.reset}")
|
|
64
|
+
ctime=datetime.fromtimestamp(fx.stat().st_ctime)
|
|
65
|
+
age=ctime-now
|
|
66
|
+
|
|
67
|
+
if age >= limit:
|
|
68
|
+
bus.append(fx)
|
|
69
|
+
if len(bus) <= 0:
|
|
70
|
+
print(f"{Fore.orange_red_1}A Backup needs to be made!{Style.reset}")
|
|
71
|
+
__class__(dtbf=True)
|
|
72
|
+
|
|
73
|
+
def __init__(self,dtbf=False):
|
|
74
|
+
self.backup_dir=Path(detectGetOrSet("Backup Directory",f"RadBoy Backups/{VERSION}",setValue=False,literal=True))
|
|
75
|
+
self.limit=timedelta(days=-90)
|
|
76
|
+
limit=self.limit
|
|
77
|
+
self.now=datetime.now()
|
|
78
|
+
|
|
79
|
+
#check for older than 6-months
|
|
80
|
+
for root,dirs,fnames in self.backup_dir.walk(top_down=True):
|
|
81
|
+
cta=len(fnames)
|
|
82
|
+
for num,file in enumerate(fnames):
|
|
83
|
+
fx=root/Path(file)
|
|
84
|
+
ctime=datetime.fromtimestamp(fx.stat().st_ctime)
|
|
85
|
+
age=ctime-self.now
|
|
86
|
+
print(std_colorize(f"{Fore.light_magenta}Checking for age limited backups to delete ({fx} AGE({age}) <= {limit}){Style.reset}",num,cta))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if age <= limit:
|
|
90
|
+
print(f"{Fore.light_red}Deleting {Fore.light_steel_blue}{fx}{Fore.light_red} because it is {Fore.spring_green_3b}{age}{Fore.light_red}, which is >= {Fore.light_yellow}{limit}{Style.reset}")
|
|
91
|
+
fx.unlink()
|
|
92
|
+
|
|
93
|
+
self.backup(dtbf=dtbf)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def backup(self,dtbf=False):
|
|
101
|
+
backup_dir=self.backup_dir
|
|
102
|
+
if backup_dir == None:
|
|
103
|
+
backup_dir=Path('.')
|
|
104
|
+
else:
|
|
105
|
+
backup_dir=Path(backup_dir)
|
|
106
|
+
if not backup_dir.exists():
|
|
107
|
+
backup_dir.mkdir(parents=True)
|
|
108
|
+
startTime=datetime.now()
|
|
109
|
+
self.startTime=startTime
|
|
110
|
+
print(f"{Fore.orange_red_1}Backing {Fore.light_yellow}Files {Fore.light_green}up!{Style.reset}")
|
|
111
|
+
backup=''
|
|
112
|
+
while True:
|
|
113
|
+
try:
|
|
114
|
+
def mkBool(text,data):
|
|
115
|
+
try:
|
|
116
|
+
if text.lower() in ['','true','y','yes','1']:
|
|
117
|
+
return True
|
|
118
|
+
elif text.lower() in ['n','false','no','0']:
|
|
119
|
+
return False
|
|
120
|
+
else:
|
|
121
|
+
return bool(eval(text))
|
|
122
|
+
except Exception as e:
|
|
123
|
+
print(e)
|
|
124
|
+
return False
|
|
125
|
+
if not dtbf:
|
|
126
|
+
date_file=Prompt.__init2__(None,func=mkBool,ptext="Date and Time restore File?",helpText="y/n?",data=self)
|
|
127
|
+
if date_file in [None,]:
|
|
128
|
+
return True
|
|
129
|
+
elif isinstance(date_file,bool):
|
|
130
|
+
if date_file:
|
|
131
|
+
d=datetime.now().strftime("%m-%d-%Y-%H-%M-%S")
|
|
132
|
+
backup=backup_dir/Path(f"codesAndBarcodes-{d}.tgz")
|
|
133
|
+
else:
|
|
134
|
+
backup=backup_dir/Path(f"codesAndBarcodes.tgz")
|
|
135
|
+
else:
|
|
136
|
+
backup=backup_dir/Path(f"codesAndBarcodes-{d}.tgz")
|
|
137
|
+
else:
|
|
138
|
+
d=datetime.now().strftime("%m-%d-%Y-%H-%M-%S")
|
|
139
|
+
backup=backup_dir/Path(f"codesAndBarcodes-{d}.tgz")
|
|
140
|
+
break
|
|
141
|
+
except Exception as e:
|
|
142
|
+
print(e)
|
|
143
|
+
return True
|
|
144
|
+
if backup.exists():
|
|
145
|
+
backup.unlink()
|
|
146
|
+
|
|
147
|
+
with tarfile.open(backup,"w:gz") as gzf:
|
|
148
|
+
#gzf.add("codesAndBarcodes.db")
|
|
149
|
+
#gzf.add("Images")
|
|
150
|
+
#gzf.add("LCL_IMG")
|
|
151
|
+
with open("Run.py","wb") as runner:
|
|
152
|
+
lines=f'''#!/usr/bin/env python3
|
|
153
|
+
from pathlib import Path
|
|
154
|
+
ROOTDIR=str(Path().cwd())
|
|
155
|
+
from radboy import RecordMyCodes as rmc
|
|
156
|
+
rmc.quikRn(rootdir=ROOTDIR)'''.encode()
|
|
157
|
+
runner.write(lines)
|
|
158
|
+
'''
|
|
159
|
+
try:
|
|
160
|
+
print("adding module...")
|
|
161
|
+
m=Path("module")
|
|
162
|
+
if m.exists():
|
|
163
|
+
shutil.rmtree(m)
|
|
164
|
+
m.mkdir()
|
|
165
|
+
else:
|
|
166
|
+
m.mkdir()
|
|
167
|
+
os.system(f"pip download MobileInventoryCLI=={VERSION} -d {m}")
|
|
168
|
+
gzf.add(m)
|
|
169
|
+
print("added module code!")
|
|
170
|
+
except Exception as e:
|
|
171
|
+
print("could not finish adding modules/")
|
|
172
|
+
'''
|
|
173
|
+
#shutil.rmtree(m)
|
|
174
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{Path('Run.py')}{Style.reset}")
|
|
175
|
+
gzf.add("Run.py")
|
|
176
|
+
|
|
177
|
+
while True:
|
|
178
|
+
try:
|
|
179
|
+
def mkBool(text,self):
|
|
180
|
+
if text.lower() in ['','n','no','-']:
|
|
181
|
+
return False
|
|
182
|
+
elif text.lower() in ['y','yes','+']:
|
|
183
|
+
return True
|
|
184
|
+
else:
|
|
185
|
+
try:
|
|
186
|
+
return bool(eval(text))
|
|
187
|
+
except Exception as e:
|
|
188
|
+
print(e)
|
|
189
|
+
return False
|
|
190
|
+
if not dtbf:
|
|
191
|
+
rmRunner=Prompt.__init2__(None,func=mkBool,ptext="Delete 'Run.py'",helpText="default == 'No'",data=self)
|
|
192
|
+
if rmRunner:
|
|
193
|
+
Path("Run.py").unlink()
|
|
194
|
+
else:
|
|
195
|
+
pass
|
|
196
|
+
break
|
|
197
|
+
except Exception as e:
|
|
198
|
+
print(e)
|
|
199
|
+
|
|
200
|
+
with open("version.txt","w+") as version_txt:
|
|
201
|
+
version_txt.write(VERSION)
|
|
202
|
+
|
|
203
|
+
if Path("version.txt").exists():
|
|
204
|
+
print(f'{Fore.spring_green_3b}Adding {Fore.green_yellow}{Path("version.txt")}{Style.reset}')
|
|
205
|
+
gzf.add("version.txt")
|
|
206
|
+
Path("version.txt").unlink()
|
|
207
|
+
|
|
208
|
+
api_key_file=Path("./api_key")
|
|
209
|
+
if api_key_file.exists():
|
|
210
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{api_key_file}{Style.reset}")
|
|
211
|
+
gzf.add(api_key_file)
|
|
212
|
+
|
|
213
|
+
msg=f'''
|
|
214
|
+
{Fore.orange_red_1}Getting system settings files, testing for existance, if not found leaving alone!!!{Style.reset}
|
|
215
|
+
'''
|
|
216
|
+
print(msg)
|
|
217
|
+
#from ExportUtility/ExportTableClass.py
|
|
218
|
+
import_odf=detectGetOrSet("ImportODF",value="ImportExcel.xlsx.ods",literal=True)
|
|
219
|
+
if import_odf:
|
|
220
|
+
import_odf=Path(import_odf)
|
|
221
|
+
if import_odf.exists():
|
|
222
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{import_odf}{Style.reset}")
|
|
223
|
+
gzf.add(import_odf)
|
|
224
|
+
|
|
225
|
+
import_excel=detectGetOrSet("ImportExcel",value="ImportExcel.xlsx",literal=True)
|
|
226
|
+
if import_excel:
|
|
227
|
+
import_excel=Path(import_excel)
|
|
228
|
+
if import_excel.exists():
|
|
229
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{import_excel}{Style.reset}")
|
|
230
|
+
gzf.add(import_excel)
|
|
231
|
+
|
|
232
|
+
export_folder=Path(detectGetOrSet("ExportTablesFolder",value="ExportedTables",literal=True))
|
|
233
|
+
if export_folder:
|
|
234
|
+
export_folder=Path(export_folder)
|
|
235
|
+
if export_folder.exists() and export_folder.is_dir():
|
|
236
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{export_folder}{Style.reset}")
|
|
237
|
+
gzf.add(export_folder)
|
|
238
|
+
|
|
239
|
+
defFile=db.detectGetOrSet("currency_definitions_file","currency_definitions.txt",setValue=False,literal=True)
|
|
240
|
+
if defFile:
|
|
241
|
+
defFile=Path(defFile)
|
|
242
|
+
if defFile.exists() and defFile.is_file():
|
|
243
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{defFile}{Style.reset}")
|
|
244
|
+
gzf.add(defFile)
|
|
245
|
+
|
|
246
|
+
bootable="__bootable__.py"
|
|
247
|
+
if bootable:
|
|
248
|
+
bootable=Path(bootable)
|
|
249
|
+
if bootable.exists() and bootable.is_file():
|
|
250
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{bootable}{Style.reset}")
|
|
251
|
+
gzf.add(bootable)
|
|
252
|
+
|
|
253
|
+
pay_ws=Path("EstimatedPayCalendarWorkSheet.txt")
|
|
254
|
+
pay_ws=Path(detectGetOrSet("EstimatedPayCalendarExportFile",pay_ws,setValue=False,literal=True))
|
|
255
|
+
if pay_ws:
|
|
256
|
+
if pay_ws.exists():
|
|
257
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{pay_ws}{Style.reset}")
|
|
258
|
+
gzf.add(pay_ws)
|
|
259
|
+
|
|
260
|
+
combinations_receipt=Path(detectGetOrSet("combinations_receipt","combos.json.csv",setValue=False,literal=True))
|
|
261
|
+
if combinations_receipt:
|
|
262
|
+
if combinations_receipt.exists():
|
|
263
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{combinations_receipt}{Style.reset}")
|
|
264
|
+
gzf.add(combinations_receipt)
|
|
265
|
+
|
|
266
|
+
WebArchiveStore_folder=Path(detectGetOrSet("WebArchiveDownloadsFilePath","WebArchiveDownloads",literal=True))
|
|
267
|
+
if WebArchiveStore_folder:
|
|
268
|
+
WebArchiveStore_folder=Path(WebArchiveStore_folder)
|
|
269
|
+
if WebArchiveStore_folder.exists() and WebArchiveStore_folder.is_dir():
|
|
270
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{WebArchiveStore_folder}{Style.reset}")
|
|
271
|
+
gzf.add(WebArchiveStore_folder)
|
|
272
|
+
#from DB/Prompt.py
|
|
273
|
+
scanout=detectGetOrSet('CMD_TO_FILE',str(Path('./SCANNER.TXT')))
|
|
274
|
+
if scanout:
|
|
275
|
+
scanout=Path(scanout)
|
|
276
|
+
if scanout.exists():
|
|
277
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{scanout}{Style.reset}")
|
|
278
|
+
gzf.add(scanout)
|
|
279
|
+
|
|
280
|
+
#from TouchStampC/TouchStampC.py
|
|
281
|
+
ts_outfile=detectGetOrSet("TouchStampSearchExport",value="TS_NOTE.txt",literal=True)
|
|
282
|
+
if ts_outfile:
|
|
283
|
+
ts_outfile=Path(ts_outfile)
|
|
284
|
+
if ts_outfile.exists():
|
|
285
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{ts_outfile}{Style.reset}")
|
|
286
|
+
gzf.add(ts_outfile)
|
|
287
|
+
|
|
288
|
+
#from Roster/Roster.py
|
|
289
|
+
src_t="Downloads/Roster.xlsx"
|
|
290
|
+
lcl_e_src=detectGetOrSet("localEXCEL",src_t,literal=True,setValue=False)
|
|
291
|
+
if lcl_e_src:
|
|
292
|
+
lcl_e_src=Path(lcl_e_src)
|
|
293
|
+
if lcl_e_src.exists():
|
|
294
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{lcl_e_src}{Style.reset}")
|
|
295
|
+
gzf.add(lcl_e_src)
|
|
296
|
+
#from TasksMode/Tasks.py
|
|
297
|
+
bcd_final_out=detectGetOrSet("IMG_GEN_OUT_QR","GENERATED_QR.png",literal=True)
|
|
298
|
+
if bcd_final_out:
|
|
299
|
+
bcd_final_out=Path(bcd_final_out)
|
|
300
|
+
if bcd_final_out.exists():
|
|
301
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{bcd_final_out}{Style.reset}")
|
|
302
|
+
gzf.add(bcd_final_out)
|
|
303
|
+
|
|
304
|
+
qr_final_out=detectGetOrSet("IMG_GEN_OUT","GENERATED_BCD",literal=True)
|
|
305
|
+
if qr_final_out:
|
|
306
|
+
qr_final_out=Path(qr_final_out+".png")
|
|
307
|
+
if qr_final_out.exists():
|
|
308
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{qr_final_out}{Style.reset}")
|
|
309
|
+
gzf.add(qr_final_out)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
EMSGFILE=detectGetOrSet("OBFUSCATED MSG FILE","MSG.txt",literal=True)
|
|
313
|
+
if EMSGFILE:
|
|
314
|
+
EMSGFILE=Path(EMSGFILE)
|
|
315
|
+
if EMSGFILE.exists():
|
|
316
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{EMSGFILE}{Style.reset}")
|
|
317
|
+
gzf.add(EMSGFILE)
|
|
318
|
+
|
|
319
|
+
dbf=Path("codesAndBarcodes.db")
|
|
320
|
+
if dbf.exists():
|
|
321
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{dbf}{Style.reset}")
|
|
322
|
+
gzf.add(dbf)
|
|
323
|
+
|
|
324
|
+
password_file=Path('Password.txt')
|
|
325
|
+
if password_file:
|
|
326
|
+
password_file=Path(password_file)
|
|
327
|
+
if password_file.exists():
|
|
328
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{password_file}{Style.reset}")
|
|
329
|
+
gzf.add(password_file)
|
|
330
|
+
|
|
331
|
+
bld_list=Path('BLD.txt')
|
|
332
|
+
if bld_list:
|
|
333
|
+
bld_list=Path(bld_list)
|
|
334
|
+
if bld_list.exists():
|
|
335
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{bld_list}{Style.reset}")
|
|
336
|
+
gzf.add(bld_list)
|
|
337
|
+
|
|
338
|
+
EntryTXT=Path('EntryTXT.txt')
|
|
339
|
+
if EntryTXT:
|
|
340
|
+
EntryTXT=Path(EntryTXT)
|
|
341
|
+
if EntryTXT.exists():
|
|
342
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{EntryTXT}{Style.reset}")
|
|
343
|
+
gzf.add(EntryTXT)
|
|
344
|
+
|
|
345
|
+
ExtraTXT=Path('ExtraTXT.txt')
|
|
346
|
+
if ExtraTXT:
|
|
347
|
+
ExtraTXT=Path(ExtraTXT)
|
|
348
|
+
if ExtraTXT.exists():
|
|
349
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{ExtraTXT}{Style.reset}")
|
|
350
|
+
gzf.add(ExtraTXT)
|
|
351
|
+
|
|
352
|
+
extra_drugs=detectGetOrSet("extra_drugs","extra_drugs.csv",setValue=False,literal=True)
|
|
353
|
+
if extra_drugs:
|
|
354
|
+
extra_drugs=Path(extra_drugs)
|
|
355
|
+
if extra_drugs.exists():
|
|
356
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{extra_drugs}{Style.reset}")
|
|
357
|
+
gzf.add(extra_drugs)
|
|
358
|
+
|
|
359
|
+
generated_string=Path('GeneratedString.txt')
|
|
360
|
+
if generated_string:
|
|
361
|
+
generated_string=Path(generated_string)
|
|
362
|
+
if generated_string.exists():
|
|
363
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{generated_string}{Style.reset}")
|
|
364
|
+
gzf.add(generated_string)
|
|
365
|
+
|
|
366
|
+
holidays_file=Path('Holidays.txt')
|
|
367
|
+
if holidays_file:
|
|
368
|
+
holidays_file=Path(holidays_file)
|
|
369
|
+
if holidays_file.exists():
|
|
370
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{holidays_file}{Style.reset}")
|
|
371
|
+
gzf.add(holidays_file)
|
|
372
|
+
|
|
373
|
+
cost_report_xlsx_file=Path(detectGetOrSet("xlsx_cr_export","cost_report.xlsx",setValue=False,literal=True))
|
|
374
|
+
if cost_report_xlsx_file:
|
|
375
|
+
cost_report_xlsx_file=Path(cost_report_xlsx_file)
|
|
376
|
+
if cost_report_xlsx_file.exists():
|
|
377
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{cost_report_xlsx_file}{Style.reset}")
|
|
378
|
+
gzf.add(cost_report_xlsx_file)
|
|
379
|
+
|
|
380
|
+
cost_report_txt_file=Path(detectGetOrSet("text_cr_export","cost_report.txt",setValue=False,literal=True))
|
|
381
|
+
if cost_report_txt_file:
|
|
382
|
+
cost_report_txt_file=Path(cost_report_txt_file)
|
|
383
|
+
if cost_report_txt_file.exists():
|
|
384
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{cost_report_txt_file}{Style.reset}")
|
|
385
|
+
gzf.add(cost_report_txt_file)
|
|
386
|
+
|
|
387
|
+
bootable_directory=Path("RadBoy_Boot_Directory")
|
|
388
|
+
if bootable_directory.exists():
|
|
389
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{bootable_directory}{Style.reset}")
|
|
390
|
+
gzf.add(bootable_directory)
|
|
391
|
+
|
|
392
|
+
try:
|
|
393
|
+
recieptidFile=Path(detectGetOrSet("NanoIdFile","nanoid.txt",setValue=False,literal=True))
|
|
394
|
+
if recieptidFile.exists():
|
|
395
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{recieptidFile}{Style.reset}")
|
|
396
|
+
gzf.add(recieptidFile)
|
|
397
|
+
except Exception as e:
|
|
398
|
+
print(e)
|
|
399
|
+
pass
|
|
400
|
+
try:
|
|
401
|
+
recieptidFile=Path(detectGetOrSet("RecieptIdFile","reciept_id.txt",setValue=False,literal=True))
|
|
402
|
+
if recieptidFile.exists():
|
|
403
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{recieptidFile}{Style.reset}")
|
|
404
|
+
gzf.add(recieptidFile)
|
|
405
|
+
except Exception as e:
|
|
406
|
+
print(e)
|
|
407
|
+
pass
|
|
408
|
+
|
|
409
|
+
receiptsDirectory=detectGetOrSet("ReceiptsDirectory","Receipts",setValue=False,literal=True)
|
|
410
|
+
if receiptsDirectory:
|
|
411
|
+
receiptsDirectory=Path(receiptsDirectory)
|
|
412
|
+
if not receiptsDirectory.exists():
|
|
413
|
+
receiptsDirectory.mkdir(parents=True)
|
|
414
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{receiptsDirectory}{Style.reset}")
|
|
415
|
+
gzf.add(receiptsDirectory)
|
|
416
|
+
|
|
417
|
+
with Session(ENGINE) as session:
|
|
418
|
+
files=session.query(SystemPreference).filter(SystemPreference.name.icontains('ClipBoordImport_')).all()
|
|
419
|
+
for num,i in enumerate(files):
|
|
420
|
+
#print(num,json.loads(i.value_4_Json2DictString)[i.name],"Being Added from SystemPreference!")
|
|
421
|
+
try:
|
|
422
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{json.loads(i.value_4_Json2DictString)[i.name]}{Style.reset}")
|
|
423
|
+
gzf.add(json.loads(i.value_4_Json2DictString)[i.name])
|
|
424
|
+
except Exception as e:
|
|
425
|
+
print(e,"couldn't not add!")
|
|
426
|
+
|
|
427
|
+
imd=Path("Images")
|
|
428
|
+
if imd.exists():
|
|
429
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{imd}{Style.reset}")
|
|
430
|
+
gzf.add(imd)
|
|
431
|
+
lclimg=Path("LCL_IMG")
|
|
432
|
+
if lclimg.exists():
|
|
433
|
+
print(f"{Fore.spring_green_3b}Adding {Fore.green_yellow}{lclimg}{Style.reset}")
|
|
434
|
+
gzf.add(lclimg)
|
|
435
|
+
|
|
436
|
+
print(backup.absolute())
|
|
437
|
+
|
|
438
|
+
endTime=datetime.now()
|
|
439
|
+
msg=f'''{Fore.light_red}{backup}{Fore.light_steel_blue} Took {Fore.green_yellow}{endTime-startTime}{Fore.light_steel_blue} to backup'''
|
|
440
|
+
print(msg)
|
|
441
|
+
msg2=f"{Fore.orange_red_1}{format_bytes(os.stat(backup.absolute()).st_size)}{Fore.light_steel_blue} of Data, on {Fore.spring_green_3b}{datetime.fromtimestamp(os.stat(backup.absolute()).st_ctime)}{Style.reset}"
|
|
442
|
+
print(msg2)
|
|
443
|
+
return True
|