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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<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>
|
</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>
|
||||||
25
main.py
25
main.py
@@ -5,20 +5,24 @@ from datetime import datetime
|
|||||||
|
|
||||||
path = '/srv/tftp/'
|
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
|
#Tasti rapidi del tastierino esterno
|
||||||
#ATTENZIONE: NON MODIFICARE QUESTO FILE
|
#ATTENZIONE: NON MODIFICARE QUESTO FILE
|
||||||
#Questo file viene generato automaticamente a partire dal file
|
#Questo file viene generato automaticamente a partire dal file
|
||||||
#tastierino_esterno.csv, modificare quest'ultimo ed attendere qualche minuto
|
#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"""
|
account.1.sip_server.1.address = 192.168.1.7"""
|
||||||
|
|
||||||
|
|
||||||
def append_log(text):
|
def append_log(text):
|
||||||
with open("error.txt", "a") as f:
|
with open("error.txt", "a") as f:
|
||||||
now = datetime.now()
|
log = " ".join([now_formatted(), text + "/n"])
|
||||||
now_formatted = now.strftime("%d/%m/%Y, %H:%M:%S")
|
|
||||||
log = " ".join([now_formatted, text])
|
|
||||||
f.write(log)
|
f.write(log)
|
||||||
|
|
||||||
|
|
||||||
@@ -32,6 +36,7 @@ except NotADirectoryError:
|
|||||||
except PermissionError:
|
except PermissionError:
|
||||||
append_log("You do not have permissions to change to {0}".format(path))
|
append_log("You do not have permissions to change to {0}".format(path))
|
||||||
|
|
||||||
|
|
||||||
def main(ofile):
|
def main(ofile):
|
||||||
with open(ofile, newline='') as csvfile:
|
with open(ofile, newline='') as csvfile:
|
||||||
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
|
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
|
||||||
@@ -47,18 +52,20 @@ def main(ofile):
|
|||||||
append_log("Errore: file csv senza i campi 'extension' e/o 'name'")
|
append_log("Errore: file csv senza i campi 'extension' e/o 'name'")
|
||||||
try:
|
try:
|
||||||
ext_n = int(row[idx_ext])
|
ext_n = int(row[idx_ext])
|
||||||
except:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ext_name = row[idx_name]
|
ext_name = row[idx_name]
|
||||||
to_write = "\n".join([to_write, print_ext(line_count, ext_n, ext_name)])
|
to_write = "\n".join([to_write, print_ext(line_count, ext_n, ext_name)])
|
||||||
line_count += 1
|
line_count += 1
|
||||||
write_f(to_write,"tastierino_esterno.cfg")
|
write_f(to_write, "tastierino_esterno.cfg")
|
||||||
|
|
||||||
def write_f(text,file_name):
|
|
||||||
|
def write_f(text, file_name):
|
||||||
with open(file_name, "w") as file:
|
with open(file_name, "w") as file:
|
||||||
file.write(text)
|
file.write(text)
|
||||||
|
|
||||||
|
|
||||||
def print_ext(n, n_ext, lbl_ext):
|
def print_ext(n, n_ext, lbl_ext):
|
||||||
spamrow = f"""expansion_module.1.key.{n}.extension =
|
spamrow = f"""expansion_module.1.key.{n}.extension =
|
||||||
expansion_module.1.key.{n}.label = {n_ext}
|
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}"""
|
expansion_module.1.key.{n}.value = {lbl_ext}"""
|
||||||
return spamrow
|
return spamrow
|
||||||
|
|
||||||
|
|
||||||
def print_hotkeys():
|
def print_hotkeys():
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ofile: str = 'tastierino_esterno.csv'
|
ofile: str = 'tastierino_esterno.csv'
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user