Exemplo n.º 1
0
def tryAddData(p_filename):
    #this will try to add every kind of metadata possible to an image.
    #-------------Title--------------------------------------
    MetadataManagerL0.setTitle(p_filename, "testFile")
    # -------------Tags--------------------------------------
    MetadataManagerL1.addArtist(p_filename, "creator: weirdo")
    # -------------Artist------------------------------------
    MetadataManagerL1.addTag(p_filename, "test")
    # -------------Description-------------------------------
    MetadataManagerL0.setDescr(p_filename, "this is a sample description")
    # -------------Rating------------------------------------
    MetadataManagerL0.setRating(p_filename, 3)
    return
Exemplo n.º 2
0
def addArtist(p_filename, p_artist):
    """
    appends new artist to the artist metadata
    :param p_filename: name/path of the file
	:type p_filename: string
	:param p_artist: artist we are adding into the artist metadata
	:type p_artist: string

	:return: True if operation was successful
    :rtype: bool
    """
    try:
        MetadataManagerL1.addArtist(p_filename, p_artist)
    except Exception as e:
        print("MetadataManager2.addArtist() error: ", e)
        return False
    try:
        MetadataManagerL1.placeMark(p_filename)
        return True
    except Exception as e:
        print("MetadataManager2.addArtist() Mark error: ", e)
        return True
Exemplo n.º 3
0
    def test_addArtistResults(self):
        releaseAllClones(g_clonenames)

        f_value = "model: crazyguy"
        f_expected = [
            "model: crazyguy", "stockphotographer", "publisher: twitter"
        ]
        f_filename = singleClone(g_files["fixingComputer.jpg"].fullname)
        MetadataManagerL1.addArtist(f_filename, f_value)
        self.assertEqual(f_expected, MetadataManagerL0.getArtists(f_filename))
        os.remove(f_filename)

        f_value = "model: pizzadog"
        f_expected = ["model: pizzadog", "photographer: idunno"]
        f_filename = singleClone(g_files["catScreamPizza.jpg"].fullname)
        MetadataManagerL1.addArtist(f_filename, f_value)
        self.assertEqual(f_expected, MetadataManagerL0.getArtists(f_filename))
        os.remove(f_filename)
        f_value = "Artist: Simon Stalenhag"
        f_expected = ["Artist: Simon Stalenhag"]
        f_filename = singleClone(g_files["rippledotzero.jpg"].fullname)
        MetadataManagerL1.addArtist(f_filename, f_value)
        self.assertEqual(f_expected, MetadataManagerL0.getArtists(f_filename))
        os.remove(f_filename)