fff
This commit is contained in:
parent
ededb2f634
commit
33912f1d2f
15
exif.py
15
exif.py
@ -143,6 +143,7 @@ def photoupload(targetfolder):
|
|||||||
|
|
||||||
for filename in testfiles:
|
for filename in testfiles:
|
||||||
# newfilename = filename.encode('utf-8')
|
# newfilename = filename.encode('utf-8')
|
||||||
|
try:
|
||||||
print("targetfile:",filename)
|
print("targetfile:",filename)
|
||||||
targetname,targetext = os.path.splitext(filename)
|
targetname,targetext = os.path.splitext(filename)
|
||||||
pathfile = os.path.join(targetfolder,filename)
|
pathfile = os.path.join(targetfolder,filename)
|
||||||
@ -161,13 +162,8 @@ def photoupload(targetfolder):
|
|||||||
if tag in (exif_choice):
|
if tag in (exif_choice):
|
||||||
photodatetime=tags[tag]
|
photodatetime=tags[tag]
|
||||||
T=datetime.datetime.strptime(str(photodatetime)[0:10],'%Y:%m:%d')
|
T=datetime.datetime.strptime(str(photodatetime)[0:10],'%Y:%m:%d')
|
||||||
try:
|
|
||||||
day=T.strftime('%d')
|
day=T.strftime('%d')
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
print(pathfile)
|
|
||||||
os.rename(pathfile,os.path.join("done",pathfile))
|
|
||||||
continue
|
|
||||||
if(int(day)<=7):
|
if(int(day)<=7):
|
||||||
fromto=T.strftime('%Y%m01_%Y%m07')
|
fromto=T.strftime('%Y%m01_%Y%m07')
|
||||||
elif (int(day)<=14):
|
elif (int(day)<=14):
|
||||||
@ -181,16 +177,19 @@ def photoupload(targetfolder):
|
|||||||
fromto=T.strftime('%Y%m22_%Y%m'+str(lastday))
|
fromto=T.strftime('%Y%m22_%Y%m'+str(lastday))
|
||||||
print(T.strftime('%Y'),T.strftime('%m'),fromto)
|
print(T.strftime('%Y'),T.strftime('%m'),fromto)
|
||||||
parentid=getidbyname3(T.strftime('%Y'),T.strftime('%m'),fromto)
|
parentid=getidbyname3(T.strftime('%Y'),T.strftime('%m'),fromto)
|
||||||
try:
|
|
||||||
print("Try:",pathfile)
|
print("Try:",pathfile)
|
||||||
mySite.pwg.images.addSimple(image=pathfile, category=parentid)
|
mySite.pwg.images.addSimple(image=pathfile, category=parentid)
|
||||||
print("Success:",pathfile)
|
print("Success:",pathfile)
|
||||||
# os.rename(pathfile,f2)
|
# os.rename(pathfile,f2)
|
||||||
os.remove(pathfile)
|
os.remove(pathfile)
|
||||||
#delete
|
#delete
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
pass
|
print(pathfile)
|
||||||
|
os.rename(pathfile,os.path.join("done",pathfile))
|
||||||
|
continue
|
||||||
#print (T)
|
#print (T)
|
||||||
#print ("Key: %s, value %s" % (tag, tags[tag]))
|
#print ("Key: %s, value %s" % (tag, tags[tag]))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user