Exemple #1
0
def tagUseageCheck(p_filename):
    f_metadata = pyexiv2.ImageMetadata(p_filename)
    f_metadata.read()
    print(f_metadata.exif_keys)
    f_keywords = f_metadata['Exif.Image.XPKeywords']
    f_dirtyTagString = pyexiv2.utils.undefined_to_string(f_keywords.value)
    print("tagUseageCheck() f_dirtyTagString\t\t", f_dirtyTagString)
    f_cleanTagList = MetadataManagerL0.dirtyStr2cleanList(f_dirtyTagString)
    print("tagUseageCheck() f_cleanTagList\t\t", f_cleanTagList)
    f_dirtyTagString2 = MetadataManagerL0.cleanList2dirtyStr(f_cleanTagList)
    print("tagUseageCheck() f_dirtyTagString2\t\t", f_dirtyTagString2)
    return
Exemple #2
0
def EverythingUseageCheck(p_fileEntry, p_testfilelist, f_outpath=g_outpath):
    #the file you load better have all this metadata in it.
    f_picID = p_testfilelist[p_fileEntry]
    f_filename = getGoogleDrivePicture(f_picID, f_outpath)
    f_metadata = pyexiv2.ImageMetadata(f_filename)
    f_metadata.read()
    print(f_metadata.exif_keys)
    #-------------Title--------------------------------------
    key1 = 'Exif.Image.XPTitle'
    f_keywords1 = f_metadata[key1]
    f_dirtyString1 = pyexiv2.utils.undefined_to_string(f_keywords1.value)
    print("titleUseageCheck() f_dirtyString1: \t\t", f_dirtyString1)
    f_cleanThing1 = MetadataManagerL0.dirtyStr2cleanStr(f_dirtyString1)
    print("titleUseageCheck() Title\t\t", f_cleanThing1)
    # -------------Tags--------------------------------------
    key2 = 'Exif.Image.XPTitle'
    f_keywords2 = f_metadata[key2]
    f_dirtyString2 = pyexiv2.utils.undefined_to_string(f_keywords2.value)
    print("titleUseageCheck() f_dirtyString2: \t\t", f_dirtyString2)
    f_cleanThing2 = MetadataManagerL0.dirtyStr2cleanList(f_dirtyString2)
    print("titleUseageCheck() Tags\t\t", f_cleanThing2)
    # -------------Artist--------------------------------------
    key3 = 'Exif.Image.XPAuthor'
    f_keywords3 = f_metadata[key3]
    f_dirtyString3 = pyexiv2.utils.undefined_to_string(f_keywords3.value)
    print("titleUseageCheck() f_dirtyString3: \t\t", f_dirtyString3)
    f_cleanThing3 = MetadataManagerL0.dirtyStr2cleanList(f_dirtyString3)
    print("titleUseageCheck() Artist\t\t", f_cleanThing3)
    # -------------Description--------------------------------------
    key4 = 'Exif.Image.XPComment'
    f_keywords4 = f_metadata[key4]
    f_dirtyString4 = pyexiv2.utils.undefined_to_string(f_keywords4.value)
    print("titleUseageCheck() f_dirtyString4: \t\t", f_dirtyString4)
    f_cleanThing4 = MetadataManagerL0.dirtyStr2cleanStr(f_dirtyString4)
    print("titleUseageCheck() Description\t\t", f_cleanThing4)
    # -------------Rating--------------------------------------
    key5 = 'Exif.Image.Rating'
    f_keywords5 = f_metadata[key5]
    print("titleUseageCheck() f_keywords5: \t\t", f_keywords5)
    print("titleUseageCheck() f_keywords5.value: \t\t", f_keywords5.value)
    #f_metadata.__delitem__('Exif.Image.Rating')
    #f_metadata.__delitem__('Exif.Image.RatingPercent')
    #f_metadata.write()
    #f_metadata.read()
    #print(f_metadata.exif_keys)

    # ------------Source URL-----------------------------------

    key6 = 'Exif.Image.ImageHistory'
    value6 = "modified by file tagger"
    f_metadata[key6] = pyexiv2.ExifTag(key6, value6)
    f_metadata.write()
    f_metadata.read()
    print(f_metadata.exif_keys)
    f_keywords6 = f_metadata[key6]
    print("titleUseageCheck() f_keywords6: \t\t", f_keywords6)
    print("titleUseageCheck() f_keywords6.value: \t\t", f_keywords6.value)
    print("titleUseageCheck() type(f_keywords6.value): \t\t",
          type(f_keywords6.value))

    # ------------Original Date--------------------------------

    key7 = 'Exif.Photo.DateTimeOriginal'
    f_keywords7 = f_metadata[key7]
    print("titleUseageCheck() f_keywords7: \t\t", f_keywords7)
    print("titleUseageCheck() f_keywords7.value: \t\t", f_keywords7.value)
    print("titleUseageCheck() type(f_keywords7.value): \t\t",
          type(f_keywords7.value))

    #f_dirtyTagString = pyexiv2.utils.undefined_to_string(f_keywords.value)
    #print("titleUseageCheck() f_dirtyTagString\t\t", f_dirtyTagString)
    #f_cleanTagList = MetadataManager.dirtyStr2cleanList(f_dirtyTagString)
    #print("titleUseageCheck() f_cleanTagList\t\t", f_cleanTagList)
    #f_dirtyTagString2 = MetadataManager.cleanList2dirtyStr(f_cleanTagList)
    #print("titleUseageCheck() f_dirtyTagString2\t\t", f_dirtyTagString2)
    os.remove(f_filename)
    return