Example #1
0
 def test_wxxx(self):
     res, out = self.call(fsn(u"--WXXX"), fsn(u"foobar"), self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = f.getall("WXXX")
     assert len(frames) == 1
     assert frames[0].url == "foobar"
Example #2
0
 def test_artist_escape(self):
     res, out = self.call(fsn(u"-e"), fsn(u"-a"), fsn(u"foo\\nbar"),
                          self.filename)
     self.failUnlessEqual(res, 0)
     self.failIf(out)
     f = ID3(self.filename)
     self.failUnlessEqual(f["TPE1"][0], "foo\nbar")
Example #3
0
 def test_wxxx(self):
     res, out = self.call(fsn(u"--WXXX"), fsn(u"foobar"), self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = f.getall("WXXX")
     assert len(frames) == 1
     assert frames[0].url == "foobar"
Example #4
0
 def test_artist_escape(self):
     res, out = self.call(
         fsn(u"-e"), fsn(u"-a"), fsn(u"foo\\nbar"), self.filename)
     self.failUnlessEqual(res, 0)
     self.failIf(out)
     f = ID3(self.filename)
     self.failUnlessEqual(f["TPE1"][0], "foo\nbar")
Example #5
0
 def test_wxxx_escape(self):
     res, out = self.call(fsn(u"-e"), fsn(u"--WXXX"),
                          fsn(u"http\\://example.com/"), self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = f.getall("WXXX")
     assert frames[0].url == "http://example.com/"
Example #6
0
 def setUp(self):
     super(TMid3v2, self).setUp()
     original = os.path.join(DATA_DIR, fsn(u'silence-44-s.mp3'))
     fd, self.filename = mkstemp(suffix=fsn(u'öäü.mp3'))
     assert isinstance(self.filename, fsn)
     os.close(fd)
     shutil.copy(original, self.filename)
Example #7
0
 def setUp(self):
     super(TMid3v2, self).setUp()
     original = os.path.join(DATA_DIR, fsn(u'silence-44-s.mp3'))
     fd, self.filename = mkstemp(suffix=fsn(u'öäü.mp3'))
     assert isinstance(self.filename, fsn)
     os.close(fd)
     shutil.copy(original, self.filename)
Example #8
0
    def test_exclude_single_tag(self):
        self.call(fsn(u'-x'), fsn(u'TLEN'), self.filename, self.blank_file)

        original_id3 = ID3(self.filename)
        copied_id3 = ID3(self.blank_file)

        self.failUnless('TLEN' in original_id3)
        self.failIf('TLEN' in copied_id3)
Example #9
0
    def test_value_from_fsnative(self):
        vffs = self.get_var("value_from_fsnative")
        self.assertEqual(vffs(fsn(u"öäü\\n"), True), u"öäü\n")
        self.assertEqual(vffs(fsn(u"öäü\\n"), False), u"öäü\\n")

        if os.name != "nt" and PY3:
            se = b"\xff".decode("utf-8", "surrogateescape")
            self.assertRaises(ValueError, vffs, se, False)
Example #10
0
 def test_list(self):
     f = ID3(self.filename)
     album = f["TALB"].text[0]
     for arg in [fsn(u"-l"), fsn(u"--list")]:
         res, out = self.call(arg, self.filename)
         self.assertFalse("b'" in out)
         self.failUnlessEqual(res, 0)
         self.failUnless("TALB=" + fsn(album) in out)
Example #11
0
    def test_exclude_single_tag(self):
        self.call(fsn(u'-x'), fsn(u'TLEN'), self.filename, self.blank_file)

        original_id3 = ID3(self.filename)
        copied_id3 = ID3(self.blank_file)

        self.failUnless('TLEN' in original_id3)
        self.failIf('TLEN' in copied_id3)
Example #12
0
    def test_txxx(self):
        res, out = self.call(fsn(u"--TXXX"), fsn(u"A\\:B:C"), self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("TXXX")[0]
        self.failUnlessEqual(frame.desc, "A\\")
        self.failUnlessEqual(frame.text, ["B:C"])
Example #13
0
 def test_wcom_multiple(self):
     res, out = self.call(fsn(u"--WCOM"), fsn(u"foo"), fsn(u"--WCOM"),
                          fsn(u"bar"), self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = f.getall("WCOM")
     assert len(frames) == 1
     assert frames[0].url == "bar"
Example #14
0
    def test_comm2(self):
        res, out = self.call(fsn(u"--COMM"), fsn(u"Y:B"), self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("COMM:Y")[0]
        self.failUnlessEqual(frame.desc, "Y")
        self.failUnlessEqual(frame.text, ["B"])
Example #15
0
    def test_comm2(self):
        res, out = self.call(fsn(u"--COMM"), fsn(u"Y:B"), self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("COMM:Y")[0]
        self.failUnlessEqual(frame.desc, "Y")
        self.failUnlessEqual(frame.text, ["B"])
Example #16
0
    def test_value_from_fsnative(self):
        vffs = self.get_var("value_from_fsnative")
        self.assertEqual(vffs(fsn(u"öäü\\n"), True), u"öäü\n")
        self.assertEqual(vffs(fsn(u"öäü\\n"), False), u"öäü\\n")

        if os.name != "nt" and PY3:
            se = b"\xff".decode("utf-8", "surrogateescape")
            self.assertRaises(ValueError, vffs, se, False)
Example #17
0
 def test_list(self):
     f = ID3(self.filename)
     album = f["TALB"].text[0]
     for arg in [fsn(u"-l"), fsn(u"--list")]:
         res, out = self.call(arg, self.filename)
         self.assertFalse("b'" in out)
         self.failUnlessEqual(res, 0)
         self.failUnless("TALB=" + fsn(album) in out)
Example #18
0
 def test_txxx_multiple(self):
     res, out = self.call(
         fsn(u"--TXXX"), fsn(u"A:B"),
         fsn(u"--TXXX"), fsn(u"C:D"),
         self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     assert len(f.getall("TXXX")) == 2
Example #19
0
 def test_wxxx_escape(self):
     res, out = self.call(
         fsn(u"-e"), fsn(u"--WXXX"), fsn(u"http\\://example.com/"),
         self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = f.getall("WXXX")
     assert frames[0].url == "http://example.com/"
Example #20
0
    def test_txxx(self):
        res, out = self.call(fsn(u"--TXXX"), fsn(u"A\\:B:C"), self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("TXXX")[0]
        self.failUnlessEqual(frame.desc, "A\\")
        self.failUnlessEqual(frame.text, ["B:C"])
Example #21
0
    def setUp(self):
        super(TMid3cp, self).setUp()
        original = os.path.join(DATA_DIR, fsn(u'silence-44-s.mp3'))
        fd, self.filename = mkstemp(suffix=fsn(u'öäü.mp3'))
        os.close(fd)
        shutil.copy(original, self.filename)

        fd, self.blank_file = mkstemp(suffix=fsn(u'.mp3'))
        os.close(fd)
Example #22
0
    def setUp(self):
        super(TMid3cp, self).setUp()
        original = os.path.join(DATA_DIR, fsn(u'silence-44-s.mp3'))
        fd, self.filename = mkstemp(suffix=fsn(u'öäü.mp3'))
        os.close(fd)
        shutil.copy(original, self.filename)

        fd, self.blank_file = mkstemp(suffix=fsn(u'.mp3'))
        os.close(fd)
Example #23
0
    def test_comm2_escape(self):
        res, out = self.call(
            fsn(u"-e"), fsn(u"--COMM"), fsn(u"Y\\\\:B\\nG"), self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("COMM:")[0]
        self.failUnlessEqual(frame.desc, "")
        self.failUnlessEqual(frame.text, ["Y:B\nG"])
Example #24
0
    def test_ufid(self):
        res, out, err = self.call2(
            fsn(u"--UFID"), fsn(u"foo:bar"), self.filename)
        self.assertEqual((res, out, err), (0, "", ""))

        f = ID3(self.filename)
        frame = f.getall("UFID:foo")[0]
        self.assertEqual(frame.owner, u"foo")
        self.assertEqual(frame.data, b"bar")
Example #25
0
    def test_comm2_escape(self):
        res, out = self.call(fsn(u"-e"), fsn(u"--COMM"), fsn(u"Y\\\\:B\\nG"),
                             self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("COMM:")[0]
        self.failUnlessEqual(frame.desc, "")
        self.failUnlessEqual(frame.text, ["Y:B\nG"])
Example #26
0
    def test_ufid(self):
        res, out, err = self.call2(fsn(u"--UFID"), fsn(u"foo:bar"),
                                   self.filename)
        self.assertEqual((res, out, err), (0, "", ""))

        f = ID3(self.filename)
        frame = f.getall("UFID:foo")[0]
        self.assertEqual(frame.owner, u"foo")
        self.assertEqual(frame.data, b"bar")
Example #27
0
    def test_comm3(self):
        res, out = self.call(fsn(u"--COMM"), fsn(u"Z:B:C:D:ger"),
                             self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("COMM:Z")[0]
        self.failUnlessEqual(frame.desc, "Z")
        self.failUnlessEqual(frame.text, ["B:C:D"])
        self.failUnlessEqual(frame.lang, "ger")
Example #28
0
    def test_comm3(self):
        res, out = self.call(
            fsn(u"--COMM"), fsn(u"Z:B:C:D:ger"), self.filename)
        self.failUnlessEqual((res, out), (0, ""))

        f = ID3(self.filename)
        frame = f.getall("COMM:Z")[0]
        self.failUnlessEqual(frame.desc, "Z")
        self.failUnlessEqual(frame.text, ["B:C:D"])
        self.failUnlessEqual(frame.lang, "ger")
Example #29
0
    def setUp(self):
        super(TMOggSPlit, self).setUp()
        self.filename = get_temp_copy(
            os.path.join(DATA_DIR, fsn(u'multipagecomment.ogg')))

        # append the second file
        with open(self.filename, "ab") as first:
            to_append = os.path.join(DATA_DIR, fsn(u'multipage-setup.ogg'))
            with open(to_append, "rb") as second:
                first.write(second.read())
Example #30
0
 def test_wcom_multiple(self):
     res, out = self.call(
         fsn(u"--WCOM"), fsn(u"foo"),
         fsn(u"--WCOM"), fsn(u"bar"),
         self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = f.getall("WCOM")
     assert len(frames) == 1
     assert frames[0].url == "bar"
Example #31
0
 def test_wxxx_multiple(self):
     res, out = self.call(fsn(u"--WXXX"), fsn(u"A:B"), fsn(u"--WXXX"),
                          fsn(u"C:D"), self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = sorted(f.getall("WXXX"), key=lambda f: f.HashKey)
     assert len(frames) == 2
     assert frames[0].url == "B"
     assert frames[0].desc == "A"
     assert frames[1].url == "D"
     assert frames[1].desc == "C"
    def test_basic(self):
        base = os.path.join(fsn(u'tests'), fsn(u'data'))
        self.paths = glob.glob(os.path.join(base, "empty*"))
        self.paths += glob.glob(os.path.join(base, "silence-*"))

        for path in self.paths:
            res, out = self.call(path)
            self.failIf(res)
            self.failUnless(out.strip())
            self.failIf("Unknown file type" in out)
            self.failIf("Errno" in out)
    def test_txxx_escape(self):
        res, out = self.call(fsn(u"-e"), fsn(u"--TXXX"),
                             fsn(u"EscapeTest\\:\\:albumartist:Ex\\:ample"),
                             self.filename)
        self.failUnlessEqual(res, 0)
        self.failIf(out)

        f = ID3(self.filename)
        frame = f.getall("TXXX")[0]
        self.failUnlessEqual(frame.desc, u"EscapeTest::albumartist")
        self.failUnlessEqual(frame.text, [u"Ex:ample"])
Example #34
0
    def test_basic(self):
        d = os.path.dirname(self.filename)
        p = os.path.join(d, fsn(u"%(stream)d.%(ext)s"))
        res, out = self.call(fsn(u"--pattern"), p, self.filename)
        self.failIf(res)
        self.failIf(out)

        for stream in [1002429366, 1806412655]:
            stream_path = os.path.join(d, fsn(str(stream)) + fsn(u".ogg"))
            self.failUnless(os.path.exists(stream_path))
            os.unlink(stream_path)
Example #35
0
    def test_conv_basic(self):
        from mutagen.id3 import TALB

        for codec in CODECS:
            f = ID3(self.filename)
            f.add(TALB(text=[AMBIGUOUS.decode("latin-1")], encoding=0))
            f.save()
            res, out = self.call(fsn(u"-d"), fsn(u"-e"), fsn(str(codec)),
                                 self.filename)
            f = ID3(self.filename)
            self.failUnlessEqual(f["TALB"].encoding, 1)
            self.failUnlessEqual(f["TALB"].text[0], AMBIGUOUS.decode(codec))
Example #36
0
    def test_txxx_escape(self):
        res, out = self.call(
            fsn(u"-e"), fsn(u"--TXXX"),
            fsn(u"EscapeTest\\\\:\\\\:albumartist:Ex\\\\:ample"),
            self.filename)
        self.failUnlessEqual(res, 0)
        self.failIf(out)

        f = ID3(self.filename)
        frame = f.getall("TXXX")[0]
        self.failUnlessEqual(frame.desc, u"EscapeTest::albumartist")
        self.failUnlessEqual(frame.text, [u"Ex:ample"])
Example #37
0
 def test_wxxx_multiple(self):
     res, out = self.call(
         fsn(u"--WXXX"), fsn(u"A:B"),
         fsn(u"--WXXX"), fsn(u"C:D"),
         self.filename)
     self.failUnlessEqual((res, out), (0, ""))
     f = ID3(self.filename)
     frames = sorted(f.getall("WXXX"), key=lambda f: f.HashKey)
     assert len(frames) == 2
     assert frames[0].url == "B"
     assert frames[0].desc == "A"
     assert frames[1].url == "D"
     assert frames[1].desc == "C"
Example #38
0
    def test_encoding_with_escape(self):
        is_bytes = PY2 and os.name != "nt"

        text = u'\xe4\xf6\xfc'
        if is_bytes:
            enc = locale.getpreferredencoding()
            # don't fail in case getpreferredencoding doesn't give us a unicode
            # encoding.
            text = text.encode(enc, "replace")
        res, out = self.call(fsn(u"-e"), fsn(u"-a"), text, self.filename)
        self.failUnlessEqual((res, out), (0, ""))
        f = ID3(self.filename)
        if is_bytes:
            text = text.decode(enc)
        self.assertEqual(f.getall("TPE1")[0], text)
Example #39
0
    def test_encoding_with_escape(self):
        is_bytes = PY2 and os.name != "nt"

        text = u'\xe4\xf6\xfc'
        if is_bytes:
            enc = locale.getpreferredencoding()
            # don't fail in case getpreferredencoding doesn't give us a unicode
            # encoding.
            text = text.encode(enc, "replace")
        res, out = self.call(fsn(u"-e"), fsn(u"-a"), text, self.filename)
        self.failUnlessEqual((res, out), (0, ""))
        f = ID3(self.filename)
        if is_bytes:
            text = text.decode(enc)
        self.assertEqual(f.getall("TPE1")[0], text)
Example #40
0
    def test_comm(self):
        from mutagen.id3 import COMM

        for codec in CODECS:
            f = ID3(self.filename)
            frame = COMM(desc="", lang="eng", encoding=0,
                         text=[AMBIGUOUS.decode("latin-1")])
            f.add(frame)
            f.save()
            res, out = self.call(
                fsn(u"-d"), fsn(u"-e"), fsn(text_type(codec)), self.filename)
            f = ID3(self.filename)
            new_frame = f[frame.HashKey]
            self.failUnlessEqual(new_frame.encoding, 1)
            self.failUnlessEqual(new_frame.text[0], AMBIGUOUS.decode(codec))
Example #41
0
 def test_no_src_header(self):
     fd, blank_file2 = mkstemp(suffix=fsn(u'.mp3'))
     os.close(fd)
     try:
         err = self.call2(self.blank_file, blank_file2)[2]
         self.failUnless("No ID3 header found" in err)
     finally:
         os.unlink(blank_file2)
Example #42
0
 def test_no_src_header(self):
     fd, blank_file2 = mkstemp(suffix=fsn(u'.mp3'))
     os.close(fd)
     try:
         err = self.call2(self.blank_file, blank_file2)[2]
         self.failUnless("No ID3 header found" in err)
     finally:
         os.unlink(blank_file2)
Example #43
0
    def test_remove_v1(self):
        from mutagen.id3 import ParseID3v1
        res, out = self.call(fsn(u"--remove-v1"), self.filename)

        with open(self.filename, "rb") as h:
            h.seek(-128, 2)
            data = h.read()
            self.failUnlessEqual(len(data), 128)
            self.failIf(ParseID3v1(data))
Example #44
0
    def test_include_id3v1(self):
        self.call(fsn(u'--write-v1'), self.filename, self.blank_file)

        with open(self.blank_file, 'rb') as fileobj:
            fileobj.seek(-128, 2)
            frames = ParseID3v1(fileobj.read(128))

        # If ID3v1 frames are present, assume they've been written correctly by
        # mutagen, so no need to check them
        self.failUnless(frames)
Example #45
0
    def test_include_id3v1(self):
        self.call(fsn(u'--write-v1'), self.filename, self.blank_file)

        with open(self.blank_file, 'rb') as fileobj:
            fileobj.seek(-128, 2)
            frames = ParseID3v1(fileobj.read(128))

        # If ID3v1 frames are present, assume they've been written correctly by
        # mutagen, so no need to check them
        self.failUnless(frames)
Example #46
0
    def test_apic(self):
        image_path = os.path.join(DATA_DIR, "image.jpg")
        image_path = os.path.relpath(image_path)
        res, out, err = self.call2(
            fsn(u"--APIC"), image_path + fsn(u":fooAPIC:3:image/jpeg"),
            self.filename)
        self.failUnlessEqual((res, out, err), (0, "", ""))

        with open(image_path, "rb") as h:
            data = h.read()

        f = ID3(self.filename)
        frame = f.getall("APIC:fooAPIC")[0]
        self.assertEqual(frame.desc, u"fooAPIC")
        self.assertEqual(frame.mime, "image/jpeg")
        self.assertEqual(frame.data, data)

        res, out = self.call(fsn(u"--list"), self.filename)
        self.assertEqual(res, 0)
        self.assertTrue("fooAPIC" in out)
Example #47
0
    def test_apic(self):
        image_path = os.path.join(DATA_DIR, "image.jpg")
        image_path = os.path.relpath(image_path)
        res, out, err = self.call2(fsn(u"--APIC"),
                                   image_path + fsn(u":fooAPIC:3:image/jpeg"),
                                   self.filename)
        self.failUnlessEqual((res, out, err), (0, "", ""))

        with open(image_path, "rb") as h:
            data = h.read()

        f = ID3(self.filename)
        frame = f.getall("APIC:fooAPIC")[0]
        self.assertEqual(frame.desc, u"fooAPIC")
        self.assertEqual(frame.mime, "image/jpeg")
        self.assertEqual(frame.data, data)

        res, out = self.call(fsn(u"--list"), self.filename)
        self.assertEqual(res, 0)
        self.assertTrue("fooAPIC" in out)
Example #48
0
    def _test_text_frame(self, short, longer, frame):
        new_value = fsn(u"TEST")
        for arg in [short, longer]:
            orig = ID3(self.filename)
            frame_class = mutagen.id3.Frames[frame]
            orig[frame] = frame_class(text=[u"BLAH"], encoding=3)
            orig.save()

            res, out = self.call(arg, new_value, self.filename)
            self.failUnlessEqual(res, 0)
            self.failIf(out)
            self.failUnlessEqual(ID3(self.filename)[frame].text, [new_value])
Example #49
0
    def _test_text_frame(self, short, longer, frame):
        new_value = fsn(u"TEST")
        for arg in [short, longer]:
            orig = ID3(self.filename)
            frame_class = mutagen.id3.Frames[frame]
            orig[frame] = frame_class(text=[u"BLAH"], encoding=3)
            orig.save()

            res, out = self.call(arg, new_value, self.filename)
            self.failUnlessEqual(res, 0)
            self.failIf(out)
            self.failUnlessEqual(ID3(self.filename)[frame].text, [new_value])
Example #50
0
    def test_USLT(self):
        res, out = self.call(fsn(u"--USLT"), fsn(u"Y:foo"), self.filename)
        assert (res, out) == (0, "")

        f = ID3(self.filename)
        frame = f.getall("USLT:Y")[0]
        assert frame.desc == "Y"
        assert frame.text == "foo"
        assert frame.lang == "eng"

        res, out = self.call(fsn(u"--USLT"), fsn(u"Z:bar:ger"), self.filename)
        assert (res, out) == (0, "")

        f = ID3(self.filename)
        frame = f.getall("USLT:Z")[0]
        assert frame.desc == "Z"
        assert frame.text == "bar"
        assert frame.lang == "ger"

        res, out = self.call(fsn(u"--USLT"), fsn(u"X"), self.filename)
        assert (res, out) == (0, "")

        f = ID3(self.filename)
        frame = f.getall("USLT:")[0]
        assert frame.desc == ""
        assert frame.text == "X"
        assert frame.lang == "eng"
Example #51
0
    def test_USLT(self):
        res, out = self.call(fsn(u"--USLT"), fsn(u"Y:foo"), self.filename)
        assert (res, out) == (0, "")

        f = ID3(self.filename)
        frame = f.getall("USLT:Y")[0]
        assert frame.desc == "Y"
        assert frame.text == "foo"
        assert frame.lang == "eng"

        res, out = self.call(fsn(u"--USLT"), fsn(u"Z:bar:ger"), self.filename)
        assert (res, out) == (0, "")

        f = ID3(self.filename)
        frame = f.getall("USLT:Z")[0]
        assert frame.desc == "Z"
        assert frame.text == "bar"
        assert frame.lang == "ger"

        res, out = self.call(fsn(u"--USLT"), fsn(u"X"), self.filename)
        assert (res, out) == (0, "")

        f = ID3(self.filename)
        frame = f.getall("USLT:")[0]
        assert frame.desc == ""
        assert frame.text == "X"
        assert frame.lang == "eng"
    def test_merge_dst_no_tag(self):
        id3 = ID3(self.filename)
        id3.delete()
        id3.save(v2_version=3)

        with open(self.blank_file, "wb") as h:
            h.write(b"SOMEDATA")
        res, out, err = self.call2(
            self.filename, self.blank_file, fsn(u"--merge"))
        assert not any([res, out, err])

        result = ID3(self.blank_file)
        assert result.version == (2, 3, 0)
Example #53
0
    def test_exit_status(self):
        status, out, err = self.call2(self.filename)
        self.assertTrue(status)

        status, out, err = self.call2(self.filename, self.filename)
        self.assertFalse(status)

        status, out, err = self.call2(self.blank_file, self.filename)
        self.assertTrue(status)

        status, out, err = self.call2(fsn(u""), self.filename)
        self.assertTrue(status)

        status, out, err = self.call2(self.filename, self.blank_file)
        self.assertFalse(status)
Example #54
0
    def test_exit_status(self):
        status, out, err = self.call2(self.filename)
        self.assertTrue(status)

        status, out, err = self.call2(self.filename, self.filename)
        self.assertFalse(status)

        status, out, err = self.call2(self.blank_file, self.filename)
        self.assertTrue(status)

        status, out, err = self.call2(fsn(u""), self.filename)
        self.assertTrue(status)

        status, out, err = self.call2(self.filename, self.blank_file)
        self.assertFalse(status)
Example #55
0
    def test_invalid_escape(self):
        res, out, err = self.call2(
            fsn(u"--TALB"), fsn(u'\\xaz'), fsn(u'-e'), self.filename)
        self.failIfEqual(res, 0)
        self.failUnless("TALB" in err)

        res, out, err = self.call2(
            fsn(u"--TALB"), fsn(u'\\'), fsn(u'-e'), self.filename)
        self.failIfEqual(res, 0)
        self.failUnless("TALB" in err)
Example #56
0
    def test_merge(self):
        id3 = ID3(self.filename)
        id3.delete()
        id3.add(mutagen.id3.TALB(text=[u"foo"]))
        id3.save(v2_version=3)

        target = ID3()
        target.add(mutagen.id3.TPE1(text=[u"bar", u"quux"]))
        target.save(self.blank_file, v2_version=4)

        res, out, err = self.call2(
            self.filename, self.blank_file, fsn(u"--merge"))
        assert not any([res, out, err])

        result = ID3(self.blank_file)
        assert result.version == (2, 4, 0)
        assert result.getall("TALB")[0].text == [u"foo"]
        assert result.getall("TPE1")[0].text == [u"bar", u"quux"]
Example #57
0
 def test_genre(self):
     self._test_text_frame(fsn(u"-g"), fsn(u"--genre"), "TCON")
Example #58
0
 def test_convert(self):
     res, out = self.call(fsn(u"--convert"), self.filename)
     self.failUnlessEqual((res, out), (0, ""))