ff
This commit is contained in:
parent
68090ce2b8
commit
34ae0d90da
31
exif.py
31
exif.py
@ -66,7 +66,7 @@ for category in categories:
|
||||
findcategorys.append(findcategory)
|
||||
# print (category['name'])
|
||||
|
||||
|
||||
|
||||
def getidbyname(year):
|
||||
global findcategorys
|
||||
name=year
|
||||
@ -78,7 +78,7 @@ def getidbyname(year):
|
||||
newid=mySite.pwg.categories.add(name=year,status="private")
|
||||
findcategory={'id':newid['id'], 'name':name}
|
||||
findcategorys.append(findcategory)
|
||||
return newid['id']
|
||||
return newid['id']
|
||||
|
||||
def getidbyname2(year,month):
|
||||
global findcategorys
|
||||
@ -93,7 +93,7 @@ def getidbyname2(year,month):
|
||||
newid=mySite.pwg.categories.add(name=month,parent=int(yearid),status="private")
|
||||
findcategory={'id':newid['id'], 'name':name}
|
||||
findcategorys.append(findcategory)
|
||||
return newid['id']
|
||||
return newid['id']
|
||||
|
||||
def getidbyname3(year,month,day):
|
||||
global findcategorys
|
||||
@ -108,7 +108,7 @@ def getidbyname3(year,month,day):
|
||||
newid=mySite.pwg.categories.add(name=day,parent=int(monthid),status="private")
|
||||
findcategory={'id':newid['id'], 'name':name}
|
||||
findcategorys.append(findcategory)
|
||||
return newid['id']
|
||||
return newid['id']
|
||||
|
||||
|
||||
#print(str(getidbyname3("2017","05","1_59")))
|
||||
@ -132,6 +132,12 @@ filenames = os.listdir(folder)
|
||||
|
||||
|
||||
testfiles = [ x for x in filenames if os.path.isfile(os.path.join(folder,x)) == True ]
|
||||
|
||||
testdirs = [ x for x in filenames if os.path.isfile(os.path.join(folder,x)) == True ]
|
||||
|
||||
for filename in testdirs:
|
||||
print (filename)
|
||||
|
||||
#print (testfiles)
|
||||
|
||||
#exit()
|
||||
@ -151,7 +157,7 @@ for filename in testfiles:
|
||||
# newfilename = filename.encode('utf-8')
|
||||
targetname,targetext = os.path.splitext(filename)
|
||||
pathfile = folder+filename
|
||||
f2 = "./done/"+filename
|
||||
f2 = "./done/"+filename
|
||||
f = open(pathfile,'rb')
|
||||
if targetext == ".mp4":
|
||||
print (".mp4")
|
||||
@ -170,26 +176,23 @@ for filename in testfiles:
|
||||
elif (int(day)<=14):
|
||||
fromto=T.strftime('%Y%m08_%Y%m14')
|
||||
elif (int(day)<=21):
|
||||
fromto=T.strftime('%Y%m15_%Y%m21')
|
||||
fromto=T.strftime('%Y%m15_%Y%m21')
|
||||
else:
|
||||
year=int(T.strftime('%Y'))
|
||||
month=int(T.strftime('%m'))
|
||||
lastday=monthrange(year,month)[1]
|
||||
#print(lastday)
|
||||
fromto=T.strftime('%Y%m22_%Y%m'+str(lastday))
|
||||
print(T.strftime('%Y'),T.strftime('%m'),fromto)
|
||||
parentid=getidbyname3(T.strftime('%Y'),T.strftime('%m'),fromto)
|
||||
print(T.strftime('%Y'),T.strftime('%m'),fromto)
|
||||
parentid=getidbyname3(T.strftime('%Y'),T.strftime('%m'),fromto)
|
||||
try:
|
||||
print("Try:",pathfile)
|
||||
mySite.pwg.images.addSimple(image=pathfile, category=parentid)
|
||||
print("Success:",pathfile)
|
||||
os.rename(pathfile,f2)
|
||||
#delete
|
||||
os.rename(pathfile,f2)
|
||||
#delete
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
#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