• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python _toolsutil.fsn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mutagen._toolsutil.fsn函数的典型用法代码示例。如果您正苦于以下问题:Python fsn函数的具体用法?Python fsn怎么用?Python fsn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fsn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp

 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 isfsn(self.filename)
     os.close(fd)
     shutil.copy(original, self.filename)
开发者ID:akerbis,项目名称:mutagen,代码行数:7,代码来源:test_tools_mid3v2.py


示例2: test_artist_escape

 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")
开发者ID:akerbis,项目名称:mutagen,代码行数:7,代码来源:test_tools_mid3v2.py


示例3: test_list

 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)
开发者ID:akerbis,项目名称:mutagen,代码行数:8,代码来源:test_tools_mid3v2.py


示例4: test_value_from_fsnative

    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)
开发者ID:akerbis,项目名称:mutagen,代码行数:8,代码来源:test_tools_mid3v2.py


示例5: test_comm2

    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"])
开发者ID:akerbis,项目名称:mutagen,代码行数:8,代码来源:test_tools_mid3v2.py


示例6: test_exclude_single_tag

    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)
开发者ID:douglaskastle,项目名称:mutagen,代码行数:8,代码来源:test_tools_mid3cp.py


示例7: test_txxx

    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"])
开发者ID:akerbis,项目名称:mutagen,代码行数:8,代码来源:test_tools_mid3v2.py


示例8: setUp

    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)
开发者ID:douglaskastle,项目名称:mutagen,代码行数:9,代码来源:test_tools_mid3cp.py


示例9: test_comm2_escape

    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"])
开发者ID:akerbis,项目名称:mutagen,代码行数:9,代码来源:test_tools_mid3v2.py


示例10: test_ufid

    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")
开发者ID:gdelfresno,项目名称:mutagen,代码行数:9,代码来源:test_tools_mid3v2.py


示例11: test_comm3

    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")
开发者ID:akerbis,项目名称:mutagen,代码行数:10,代码来源:test_tools_mid3v2.py


示例12: test_basic

    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)
开发者ID:akerbis,项目名称:mutagen,代码行数:11,代码来源:test_tools_mutagen_inspect.py


示例13: test_basic

    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(text_type(stream)) + fsn(u".ogg"))
            self.failUnless(os.path.exists(stream_path))
            os.unlink(stream_path)
开发者ID:akerbis,项目名称:mutagen,代码行数:12,代码来源:test_tools_moggsplit.py


示例14: test_txxx_escape

    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"])
开发者ID:akerbis,项目名称:mutagen,代码行数:12,代码来源:test_tools_mid3v2.py


示例15: test_conv_basic

    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(text_type(codec)), self.filename)
            f = ID3(self.filename)
            self.failUnlessEqual(f["TALB"].encoding, 1)
            self.failUnlessEqual(f["TALB"].text[0], AMBIGUOUS.decode(codec))
开发者ID:akerbis,项目名称:mutagen,代码行数:12,代码来源:test_tools_mid3iconv.py


示例16: setUp

    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
        first = open(self.filename, "ab")
        to_append = os.path.join(
            DATA_DIR, fsn(u'multipage-setup.ogg'))
        second = open(to_append, "rb")
        first.write(second.read())
        second.close()
        first.close()
开发者ID:gdelfresno,项目名称:mutagen,代码行数:13,代码来源:test_tools_moggsplit.py


示例17: test_encoding_with_escape

    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)
开发者ID:akerbis,项目名称:mutagen,代码行数:15,代码来源:test_tools_mid3v2.py


示例18: test_comm

    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))
开发者ID:akerbis,项目名称:mutagen,代码行数:15,代码来源:test_tools_mid3iconv.py


示例19: setUp

    def setUp(self):
        super(TMOggSPlit, self).setUp()
        original = os.path.join(
            DATA_DIR, fsn(u'multipagecomment.ogg'))
        fd, self.filename = mkstemp(suffix=fsn(u'.ogg'))
        os.close(fd)
        shutil.copy(original, self.filename)

        # append the second file
        first = open(self.filename, "ab")
        to_append = os.path.join(
            DATA_DIR, fsn(u'multipage-setup.ogg'))
        second = open(to_append, "rb")
        first.write(second.read())
        second.close()
        first.close()
开发者ID:akerbis,项目名称:mutagen,代码行数:16,代码来源:test_tools_moggsplit.py


示例20: test_no_src_header

 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)
开发者ID:douglaskastle,项目名称:mutagen,代码行数:8,代码来源:test_tools_mid3cp.py



注:本文中的mutagen._toolsutil.fsn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _util.delete_bytes函数代码示例发布时间:2022-05-27
下一篇:
Python _compat.xrange函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap