Initial commit
This commit is contained in:
38
funkce1.py
Normal file
38
funkce1.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os, fdb,re
|
||||
import datetime
|
||||
|
||||
|
||||
def prejmenuj_chybny_soubor(souborname,cesta):
|
||||
if souborname[0]!="♥":
|
||||
soubornovy = "♥" + souborname
|
||||
os.rename(os.path.join(cesta,souborname),os.path.join(cesta,soubornovy))
|
||||
|
||||
|
||||
def kontrola_struktury(souborname,connection):
|
||||
if souborname.endswith('.pdf'):
|
||||
#kontrola struktury
|
||||
pattern=re.compile(r'(\d{9,10}) (\d{4}-\d{2}-\d{2}) (\w+, \w.+?) \[(.+?)\] \[(.*?)\]')
|
||||
match=pattern.search(souborname)
|
||||
# print(souborname)
|
||||
vpohode=True
|
||||
if match and len(match.groups())==5:
|
||||
datum=match.group(2)
|
||||
try:
|
||||
datum_object = datetime.datetime.strptime(datum,"%Y-%m-%d").date()
|
||||
# print(datum_object)
|
||||
except:
|
||||
vpohode=False
|
||||
return vpohode
|
||||
cur = connection.cursor()
|
||||
cur.execute("select count(*) from kar where rodcis=?", (match.group(1),))
|
||||
row = cur.fetchone()[0]
|
||||
if row!=1:
|
||||
vpohode = False
|
||||
return vpohode
|
||||
else:
|
||||
vpohode=False
|
||||
return vpohode
|
||||
else:
|
||||
vpohode=False
|
||||
return vpohode
|
||||
return vpohode
|
||||
Reference in New Issue
Block a user