Ultimo commit da windows
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (YealinkCSVtoExt)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (YealinkCSVtoExt) (2)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
7
.idea/pythonProject.iml
generated
Normal file
7
.idea/pythonProject.iml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (YealinkCSVtoExt) (2)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
21
main.py
21
main.py
@@ -5,20 +5,24 @@ from datetime import datetime
|
||||
|
||||
path = '/srv/tftp/'
|
||||
|
||||
header_cfg = """#!version:1.0.0.1
|
||||
|
||||
def now_formatted():
|
||||
now = datetime.now()
|
||||
return now.strftime("%d/%m/%Y, %H:%M:%S")
|
||||
|
||||
|
||||
header_cfg = f"""#!version:1.0.0.1
|
||||
#Tasti rapidi del tastierino esterno
|
||||
#ATTENZIONE: NON MODIFICARE QUESTO FILE
|
||||
#Questo file viene generato automaticamente a partire dal file
|
||||
#tastierino_esterno.csv, modificare quest'ultimo ed attendere qualche minuto
|
||||
|
||||
#file generato ultima volta il : {now_formatted()}
|
||||
account.1.sip_server.1.address = 192.168.1.7"""
|
||||
|
||||
|
||||
def append_log(text):
|
||||
with open("error.txt", "a") as f:
|
||||
now = datetime.now()
|
||||
now_formatted = now.strftime("%d/%m/%Y, %H:%M:%S")
|
||||
log = " ".join([now_formatted, text])
|
||||
log = " ".join([now_formatted(), text + "/n"])
|
||||
f.write(log)
|
||||
|
||||
|
||||
@@ -32,6 +36,7 @@ except NotADirectoryError:
|
||||
except PermissionError:
|
||||
append_log("You do not have permissions to change to {0}".format(path))
|
||||
|
||||
|
||||
def main(ofile):
|
||||
with open(ofile, newline='') as csvfile:
|
||||
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
|
||||
@@ -47,7 +52,7 @@ def main(ofile):
|
||||
append_log("Errore: file csv senza i campi 'extension' e/o 'name'")
|
||||
try:
|
||||
ext_n = int(row[idx_ext])
|
||||
except:
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
ext_name = row[idx_name]
|
||||
@@ -55,10 +60,12 @@ def main(ofile):
|
||||
line_count += 1
|
||||
write_f(to_write, "tastierino_esterno.cfg")
|
||||
|
||||
|
||||
def write_f(text, file_name):
|
||||
with open(file_name, "w") as file:
|
||||
file.write(text)
|
||||
|
||||
|
||||
def print_ext(n, n_ext, lbl_ext):
|
||||
spamrow = f"""expansion_module.1.key.{n}.extension =
|
||||
expansion_module.1.key.{n}.label = {n_ext}
|
||||
@@ -66,9 +73,11 @@ expansion_module.1.key.{n}.type = 16
|
||||
expansion_module.1.key.{n}.value = {lbl_ext}"""
|
||||
return spamrow
|
||||
|
||||
|
||||
def print_hotkeys():
|
||||
exit
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ofile: str = 'tastierino_esterno.csv'
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user