ttt
This commit is contained in:
parent
34ae0d90da
commit
33f43d2e3b
63
exif.py
63
exif.py
@ -124,48 +124,33 @@ def files(path):
|
|||||||
for file in os.listdir(path):
|
for file in os.listdir(path):
|
||||||
if os.path.isfile(os.path.join(path, file)):
|
if os.path.isfile(os.path.join(path, file)):
|
||||||
yield file
|
yield file
|
||||||
folder = "./data/"
|
|
||||||
|
|
||||||
filenames = os.listdir(folder)
|
|
||||||
|
targetfolder = "./data/"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def photoupload(targetfolder):
|
||||||
|
filenames = os.listdir(targetfolder)
|
||||||
|
testfiles = [ x for x in filenames if os.path.isfile(os.path.join(targetfolder,x)) == True ]
|
||||||
|
|
||||||
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.isdir(os.path.join(targetfolder,x)) == True ]
|
||||||
|
for testdir in testdirs:
|
||||||
|
photoupload(testdir)
|
||||||
|
|
||||||
testdirs = [ x for x in filenames if os.path.isfile(os.path.join(folder,x)) == True ]
|
for filename in testfiles:
|
||||||
|
# newfilename = filename.encode('utf-8')
|
||||||
for filename in testdirs:
|
|
||||||
print (filename)
|
|
||||||
|
|
||||||
#print (testfiles)
|
|
||||||
|
|
||||||
#exit()
|
|
||||||
#def print_all_metadata_atoms(file):
|
|
||||||
# atoms = file.findall('.//data')
|
|
||||||
# for atom in atoms:
|
|
||||||
# data = atom.get_attribute('data')
|
|
||||||
# print (atom.parent.name, data)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#for filename in filenames:
|
|
||||||
for filename in testfiles:
|
|
||||||
# newfilename = filename.encode('utf-8')
|
|
||||||
targetname,targetext = os.path.splitext(filename)
|
targetname,targetext = os.path.splitext(filename)
|
||||||
pathfile = folder+filename
|
pathfile = folder+filename
|
||||||
f2 = "./done/"+filename
|
f2 = "./done/"+filename
|
||||||
f = open(pathfile,'rb')
|
f = open(pathfile,'rb')
|
||||||
if targetext == ".mp4":
|
if targetext == ".mp4":
|
||||||
print (".mp4")
|
print (".mp4")
|
||||||
# print_all_metadata_atoms(Mp4File(pathfile))
|
# print_all_metadata_atoms(Mp4File(pathfile))
|
||||||
# exit()
|
# exit()
|
||||||
else:
|
else:
|
||||||
tags = exifread.process_file(f, stop_tag=exif_choice)
|
tags = exifread.process_file(f, stop_tag=exif_choice)
|
||||||
# print (pathfile)
|
# print (pathfile)
|
||||||
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]
|
||||||
@ -196,3 +181,25 @@ for filename in testfiles:
|
|||||||
pass
|
pass
|
||||||
#print (T)
|
#print (T)
|
||||||
#print ("Key: %s, value %s" % (tag, tags[tag]))
|
#print ("Key: %s, value %s" % (tag, tags[tag]))
|
||||||
|
|
||||||
|
photoupload(targetfolder)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#print (testfiles)
|
||||||
|
|
||||||
|
#exit()
|
||||||
|
#def print_all_metadata_atoms(file):
|
||||||
|
# atoms = file.findall('.//data')
|
||||||
|
# for atom in atoms:
|
||||||
|
# data = atom.get_attribute('data')
|
||||||
|
# print (atom.parent.name, data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#for filename in filenames:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user