asdf
This commit is contained in:
parent
3a3d32fcff
commit
ededb2f634
18
exif.py
18
exif.py
@ -143,20 +143,31 @@ def photoupload(targetfolder):
|
|||||||
|
|
||||||
for filename in testfiles:
|
for filename in testfiles:
|
||||||
# newfilename = filename.encode('utf-8')
|
# newfilename = filename.encode('utf-8')
|
||||||
|
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)
|
||||||
f2 = "./done/"+filename
|
|
||||||
f = open(pathfile,'rb')
|
f = open(pathfile,'rb')
|
||||||
if targetext == ".mp4":
|
if targetext == ".mp4":
|
||||||
print (".mp4")
|
print (".mp4")
|
||||||
T=datetime.datetime.strptime(str(get_video_date(pathfile))[1:10],'%Y-%m-%d')
|
resultvideo = get_video_date(pathfile)
|
||||||
|
print (resultvideo)
|
||||||
|
T=datetime.datetime.strptime(str(resultvideo)[1:11],'%Y-%m-%d')
|
||||||
|
print (T)
|
||||||
else:
|
else:
|
||||||
|
print("targetext:::",targetext)
|
||||||
tags = exifread.process_file(f, stop_tag=exif_choice)
|
tags = exifread.process_file(f, stop_tag=exif_choice)
|
||||||
|
#print("tags::",tags)
|
||||||
for tag in tags.keys():
|
for tag in tags.keys():
|
||||||
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):
|
||||||
@ -174,7 +185,8 @@ def photoupload(targetfolder):
|
|||||||
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)
|
||||||
#delete
|
#delete
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user