Esempio n. 1
0
 def _replaygain(self, flac, id3, gain_type):
     gain_tag = 'replaygain_%s_gain' % gain_type
     peak_tag = 'replaygain_%s_peak' % gain_type
     if gain_tag in flac and peak_tag in flac:
         gain = float(flac[gain_tag][0][:-3])
         peak = float(flac[peak_tag][0][:-3])
         id3.add(RVA2(unicode(gain_type), 1, gain, peak))
Esempio n. 2
0
    def test_gain_peak_capitalization(self):
        frame = RVA2(desc=u"Foo", gain=1.0, peak=1.0, channel=0)
        self.assertFalse(len(self.realid3))
        self.realid3.add(frame)
        self.assertTrue("replaygain_Foo_peak" in self.id3)
        self.assertTrue("replaygain_Foo_peak" in self.id3.keys())
        self.assertTrue("replaygain_Foo_gain" in self.id3)
        self.assertTrue("replaygain_Foo_gain" in self.id3.keys())

        self.id3["replaygain_Foo_gain"] = ["0.5"]
        self.id3["replaygain_Foo_peak"] = ["0.25"]

        frames = self.realid3.getall("RVA2")
        self.assertEqual(len(frames), 1)
        self.assertEqual(frames[0].desc, u"Foo")
        self.assertEqual(frames[0].gain, 0.5)
        self.assertEqual(frames[0].peak, 0.25)
Esempio n. 3
0
 def test_basic(self):
     from mutagen.id3 import RVA2
     r = RVA2(gain=1, channel=1, peak=1)
     self.assertEqual(r, r)
     self.assertNotEqual(r, 42)
Esempio n. 4
0
 def test_multi_RVA2(self):
     from mutagen.id3 import RVA2
     self.assertEquals(RVA2(gain=1).HashKey, RVA2(gain=2).HashKey)
     self.assertNotEquals(RVA2(desc="a").HashKey, RVA2(desc="b").HashKey)
Esempio n. 5
0
    def test_RVA2(self):
        from mutagen.id3 import RVA2

        frame = RVA2(method=42, desc="d", channel=1, gain=1, peak=1)
        self.assertEqual(frame.HashKey, "RVA2:d")
        frame._pprint()