Esempio n. 1
0
 def test_addDescrResults(self):
     releaseAllClones(g_clonenames)
     f_value = "\nThis is basically me building my gaming pc"
     f_expected = "Bad stock photo of my job found on twitter.\nThis is basically me building my gaming pc"
     f_filename = singleClone(g_files["fixingComputer.jpg"].fullname)
     MetadataManagerL1.addDescr(f_filename, f_value)
     self.assertEqual(f_expected, MetadataManagerL0.getDescr(f_filename))
     os.remove(f_filename)
     f_value = "\nCrazy cat picture"
     f_expected = "a cat screaming at the camera in front of a dog wearing a pizza box\nCrazy cat picture"
     f_filename = singleClone(g_files["catScreamPizza.jpg"].fullname)
     MetadataManagerL1.addDescr(f_filename, f_value)
     self.assertEqual(f_expected, MetadataManagerL0.getDescr(f_filename))
     os.remove(f_filename)
     f_value = "The game is about a penguin"
     f_expected = "The game is about a penguin"
     f_filename = singleClone(g_files["rippledotzero.jpg"].fullname)
     MetadataManagerL1.addDescr(f_filename, f_value)
     self.assertEqual(f_expected, MetadataManagerL0.getDescr(f_filename))
     os.remove(f_filename)
Esempio n. 2
0
def getDescr(p_filename):
    """!
    :param p_filename: name/path of the file
    :type p_filename: string

    :return: description if it exists. Else, ""
    :rtype: string
    """
    try:
        return MetadataManagerL0.getDescr(p_filename)
    except Exception as e:
        print("MetadataManager2.getDescr() error: ", e)
        return ""