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

Python util.parse_time函数代码示例

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

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



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

示例1: __check_entry

 def __check_entry(self, add, time, name):
     try:
         util.parse_time(time.get_text(), None)
     except:
         add.set_sensitive(False)
     else:
         add.set_sensitive(bool(name.get_text()))
开发者ID:LudoBike,项目名称:quodlibet,代码行数:7,代码来源:bookmarks.py


示例2: _seek

 def _seek(self, time, library, window, player):
     seek_to = player.get_position()
     if time[0] == "+": seek_to += util.parse_time(time[1:]) * 1000
     elif time[0] == "-": seek_to -= util.parse_time(time[1:]) * 1000
     else: seek_to = util.parse_time(time) * 1000
     seek_to = min(player.song.get("~#length", 0) * 1000 -1,
                   max(0, seek_to))
     player.seek(seek_to)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:8,代码来源:remote.py


示例3: _seek

def _seek(app, time):
    player = app.player
    if not player.song:
        return
    seek_to = player.get_position()
    if time[0] == "+":
        seek_to += util.parse_time(time[1:]) * 1000
    elif time[0] == "-":
        seek_to -= util.parse_time(time[1:]) * 1000
    else:
        seek_to = util.parse_time(time) * 1000
    seek_to = min(player.song.get("~#length", 0) * 1000 - 1, max(0, seek_to))
    player.seek(seek_to)
开发者ID:SimonLarsen,项目名称:quodlibet,代码行数:13,代码来源:commands.py


示例4: __add

 def __add(self, model, time, name):
     try:
         time = util.parse_time(time.get_text(), None)
     except:
         pass
     else:
         model.append([time, name.get_text()])
开发者ID:LudoBike,项目名称:quodlibet,代码行数:7,代码来源:bookmarks.py


示例5: __edit_time

 def __edit_time(self, render, path, new, model):
     try:
         time = util.parse_time(new, None)
     except:
         pass
     else:
         model[path][0] = time
开发者ID:LudoBike,项目名称:quodlibet,代码行数:7,代码来源:bookmarks.py


示例6: bookmarks

    def bookmarks(self):
        """Parse and return song position bookmarks, or set them.
        Accessing this returns a copy, so song.bookmarks.append(...)
        will not work; you need to do

            marks = song.bookmarks
            marks.append(...)
            song.bookmarks = marks
        """

        marks = []
        invalid = []
        for line in self.list("~bookmark"):
            try:
                time, mark = line.split(" ", 1)
            except:
                invalid.append((-1, line))
            else:
                try:
                    time = util.parse_time(time, None)
                except:
                    invalid.append((-1, line))
                else:
                    if time >= 0:
                        marks.append((time, mark))
                    else:
                        invalid.append((-1, line))
        marks.sort()
        marks.extend(invalid)
        return marks
开发者ID:elfalem,项目名称:quodlibet,代码行数:30,代码来源:_audio.py


示例7: __fill_af

    def __fill_af(feed, af):
        try: af["title"] = feed.title or _("Unknown")
        except: af["title"] = _("Unknown")
        try: af["date"] = "%04d-%02d-%02d" % feed.modified_parsed[:3]
        except (AttributeError, TypeError): pass

        for songkey, feedkey in [
            ("website", "link"),
            ("description", "tagline"),
            ("language", "language"),
            ("copyright", "copyright"),
            ("organization", "publisher"),
            ("license", "license")]:
            try: value = getattr(feed, feedkey)
            except: pass
            else:
                if value and value not in af.list(songkey):
                    af.add(songkey, value)

        try: author = feed.author_detail
        except AttributeError:
            try: author = feed.author
            except AttributeError: pass
            else:
                if author and author not in af.list("artist"):
                    af.add('artist', author)
        else:
            try:
                if author.email and author.email not in af.list("contact"):
                    af.add("contact", author.email)
            except AttributeError: pass
            try:
                if author.name and author.name not in af.list("artist"):
                    af.add("artist", author.name)
            except AttributeError: pass

        try: values = feed.contributors
        except AttributeError: pass
        else:
            for value in values:
                try: value = value.name
                except AttributeError: pass
                else:
                    if value and value not in af.list("performer"):
                        af.add("performer", value)

        try: af["~#length"] = util.parse_time(feed.itunes_duration)
        except (AttributeError, ValueError): pass

        try: values = dict(feed.categories).values()
        except AttributeError: pass
        else:
            for value in values:
                if value and value not in af.list("genre"):
                    af.add("genre", value)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:55,代码来源:audiofeeds.py


示例8: __get_bookmarks

 def __get_bookmarks(self):
     marks = []
     invalid = []
     for line in self.list("~bookmark"):
         try: time, mark = line.split(" ", 1)
         except: invalid.append((-1, line))
         else:
             try: time = util.parse_time(time, None)
             except: invalid.append((-1, line))
             else:
                 if time >= 0: marks.append((time, mark))
                 else: invalid.append((-1, line))
     marks.sort()
     marks.extend(invalid)
     return marks
开发者ID:silkecho,项目名称:glowing-silk,代码行数:15,代码来源:_audio.py


示例9: test_negative

 def test_negative(self):
     self.failUnlessEqual(util.parse_time("-2:04"), -124)
开发者ID:brunob,项目名称:quodlibet,代码行数:2,代码来源:test_util.py


示例10: test_roundtrip

 def test_roundtrip(self):
     # The values are the ones tested for Tformat_time, so we know they
     # will be formatted correctly. They're also representative of
     # all the major patterns.
     for i in [0, 59, 60, 60 * 59 + 59, 60 * 60, 60 * 60 + 60 * 59 + 59]:
         self.failUnlessEqual(util.parse_time(util.format_time(i)), i)
开发者ID:brunob,项目名称:quodlibet,代码行数:6,代码来源:test_util.py


示例11: test_empty

 def test_empty(self):
     self.failUnlessEqual(util.parse_time(""), 0)
开发者ID:brunob,项目名称:quodlibet,代码行数:2,代码来源:test_util.py


示例12: test_invalid

 def test_invalid(self):
     self.failUnlessEqual(util.parse_time("not a time"), 0)
开发者ID:brunob,项目名称:quodlibet,代码行数:2,代码来源:test_util.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.pattern函数代码示例发布时间:2022-05-26
下一篇:
Python util.is_windows函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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