Beispiel #1
0
def fill_tags(filename, tracknumber):
    """
    Deletes all tags and sets only title and tracknumber
    """
    audio = File(filename)
    audio.tags.clear()
    audio.tags['TRACKNUMBER'] = [str(tracknumber)]
    audio.tags['TITLE'] = [os.path.splitext(filename)[-1]]
    audio.save()
Beispiel #2
0
def fill_tags(filename, tracknumber):
    """
    Deletes all tags and sets only title and tracknumber
    """
    audio = File(filename)
    audio.tags.clear()
    audio.tags['TRACKNUMBER'] = [str(tracknumber)]
    audio.tags['TITLE'] = [os.path.splitext(filename)[-1]]
    audio.save()
Beispiel #3
0
 def test_simple_tags_filling(self):
     """
     """
     filename = "test.mp3"
     tracknumber = 1
     f = open(filename, 'w+')
     f.close()
     audio = File(filename)
     audio.tags['TITLE'] = "fill"
     audio.tags['TRACKNUMBER'] = "2"
     audio.save()
     fill_tags(filename, tracknumber)
     audio = File(filename)
     self.assertEqual(audio.tags['TITLE'], [os.path.splitext(filename)[-1]])
     self.assertEqual(audio.tags['TRACKNUMBER'], [str(tracknumber)])
     with self.assertRaises(KeyError):
         audio.tags['ARTIST']
Beispiel #4
0
 def test_simple_tags_filling(self):
     """
     """
     filename = "test.mp3"
     tracknumber = 1
     f = open(filename, 'w+')
     f.close()
     audio = File(filename)
     audio.tags['TITLE'] = "fill"
     audio.tags['TRACKNUMBER'] = "2"
     audio.save()
     fill_tags(filename, tracknumber)
     audio = File(filename)
     self.assertEqual(audio.tags['TITLE'], [os.path.splitext(filename)[-1]])
     self.assertEqual(audio.tags['TRACKNUMBER'], [str(tracknumber)])
     with self.assertRaises(KeyError):
         audio.tags['ARTIST']