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

Python datetime.duck函数代码示例

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

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



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

示例1: searchJobs

    def searchJobs(self, init=False, key=None, value=None):
        """
        obj.searchJobs(**kwars) -> list of Job objects

        Supports the following keywords:
            chanid,     starttime,  type,       status,     hostname,
            title,      subtitle,   flags,      olderthan,  newerthan
        """
        if init:
            init.table = 'jobqueue'
            init.handler = Job
            init.joins = (init.Join(table='recorded',
                                    tableto='jobqueue',
                                    fields=('chanid','starttime')),)

        if key in ('chanid','type','status','hostname'):
            return ('jobqueue.%s=%%s' % key, value, 0)
        if key in ('title','subtitle'):
            return ('recorded.%s=%%s' % key, value, 1)
        if key == 'flags':
            return ('jobqueue.flags&%s', value, 0)

        if key == 'starttime':
            return ('jobqueue.starttime=%s', datetime.duck(value), 0)
        if key == 'olderthan':
            return ('jobqueue.inserttime>%s', datetime.duck(value), 0)
        if key == 'newerthan':
            return ('jobqueue.inserttime<%s', datetime.duck(value), 0)
        return None
开发者ID:Openivo,项目名称:mythtv,代码行数:29,代码来源:methodheap.py


示例2: searchJobs

    def searchJobs(self, init=False, key=None, value=None):
        """
        obj.searchJobs(**kwars) -> list of Job objects

        Supports the following keywords:
            chanid,     starttime,  type,       status,     hostname,
            title,      subtitle,   flags,      olderthan,  newerthan
        """
        if init:
            init.table = "jobqueue"
            init.handler = Job
            init.joins = (init.Join(table="recorded", tableto="jobqueue", fields=("chanid", "starttime")),)
            return None

        if key in ("chanid", "type", "status", "hostname"):
            return ("jobqueue.%s=?" % key, value, 0)
        if key in ("title", "subtitle"):
            return ("recorded.%s=?" % key, value, 1)
        if key == "flags":
            return ("jobqueue.flags&?", value, 0)

        if key == "starttime":
            return ("jobqueue.starttime=?", datetime.duck(value), 0)
        if key == "olderthan":
            return ("jobqueue.inserttime>?", datetime.duck(value), 0)
        if key == "newerthan":
            return ("jobqueue.inserttime<?", datetime.duck(value), 0)
        return None
开发者ID:mdda,项目名称:mythtv,代码行数:28,代码来源:methodheap.py


示例3: searchGuide

    def searchGuide(self, init=False, key=None, value=None):
        """
        obj.searchGuide(**args) -> list of Guide objects

        Supports the following keywords:
            chanid,     starttime,  endtime,    title,      subtitle,
            category,   airdate,    stars,      previouslyshown,
            stereo,     subtitled,  hdtv,       closecaptioned,
            partnumber, parttotal,  seriesid,   originalairdate,
            showtype,   programid,  generic,    syndicatedepisodenumber,
            ondate,     cast,       startbefore,startafter
            endbefore,  endafter
        """
        if init:
            init.table = "program"
            init.handler = Guide
            init.joins = (
                init.Join(table="credits", tableto="program", fields=("chanid", "starttime")),
                init.Join(table="people", tableto="credits", fields=("person",)),
            )

        if key in (
            "chanid",
            "title",
            "subtitle",
            "category",
            "airdate",
            "stars",
            "previouslyshown",
            "stereo",
            "subtitled",
            "hdtv",
            "closecaptioned",
            "partnumber",
            "parttotal",
            "seriesid",
            "originalairdate",
            "showtype",
            "syndicatedepisodenumber",
            "programid",
            "generic",
        ):
            return ("%s=%%s" % key, value, 0)
        if key in ("starttime", "endtime"):
            return ("%s=%%s" % key, datetime.duck(value), 0)
        if key == "ondate":
            return ("DATE(starttime)=%s", value, 0)
        if key == "cast":
            return ("people.name", "credits", 2, 0)
        if key == "startbefore":
            return ("starttime<%s", datetime.duck(value), 0)
        if key == "startafter":
            return ("starttime>%s", datetime.duck(value), 0)
        if key == "endbefore":
            return ("endtime<%s", datetime.duck(value), 0)
        if key == "endafter":
            return ("endtime>%s", datetime.duck(value), 0)
        return None
开发者ID:JackOfMostTrades,项目名称:mythtv,代码行数:58,代码来源:methodheap.py


示例4: getProgramDetails

 def getProgramDetails(self, chanid, starttime):
     """
     Returns a Program object for the matching show.
     """
     starttime = datetime.duck(starttime)
     args = {"ChanId": chanid, "StartTime": starttime.isoformat()}
     return Program.fromJSON(self._request("Guide/GetProgramDetails", **args).readJSON()["Program"], db=self.db)
开发者ID:mdda,项目名称:mythtv,代码行数:7,代码来源:methodheap.py


示例5: searchArtwork

    def searchArtwork(self, init=False, key=None, value=None):
        """
        obj.searchArtwork(**kwargs) -> list of RecordedArtwork objects

        Supports the following keywords:
            inetref,    season,     host,   chanid,     starttime
            title,      subtitle
        """

        if init:
            # table and join descriptor
            init.table = "recordedartwork"
            init.handler = RecordedArtwork
            init.joins = (
                init.Join(
                    table="recorded",
                    tableto="recordedartwork",
                    fieldsfrom=("inetref", "season", "hostname"),
                    fieldsto=("inetref", "season", "host"),
                ),
            )
            return None

        if key in ("inetref", "season", "host"):
            return ("recordedartwork.%s=?" % key, value, 0)

        if key in ("chanid", "title", "subtitle"):
            return ("recorded.%s=?" % key, value, 1)

        if key == "starttime":
            return ("recorded.%s=?" % key, datetime.duck(value), 1)

        return None
开发者ID:mdda,项目名称:mythtv,代码行数:33,代码来源:methodheap.py


示例6: searchOldRecorded

    def searchOldRecorded(self, init=False, key=None, value=None):
        """
        obj.searchOldRecorded(**kwargs) -> list of OldRecorded objects

        Supports the following keywords:
            title,      subtitle,   chanid,     starttime,  endtime,
            category,   seriesid,   programid,  station,    duplicate,
            generic,    recstatus,  inetref,    season,     episode
        """

        if init:
            init.table = "oldrecorded"
            init.handler = OldRecorded
            return None

        if key in (
            "title",
            "subtitle",
            "chanid",
            "category",
            "seriesid",
            "programid",
            "station",
            "duplicate",
            "generic",
            "recstatus",
            "inetref",
            "season",
            "episode",
        ):
            return ("oldrecorded.%s=?" % key, value, 0)
            # time matches
        if key in ("starttime", "endtime"):
            return ("oldrecorded.%s=?" % key, datetime.duck(value), 0)
        return None
开发者ID:mdda,项目名称:mythtv,代码行数:35,代码来源:methodheap.py


示例7: searchArtwork

    def searchArtwork(self, init=False, key=None, value=None):
        """
        obj.searchArtwork(**kwargs) -> list of RecordedArtwork objects

        Supports the following keywords:
            inetref,    season,     host,   chanid,     starttime
            title,      subtitle
        """

        if init:
            # table and join descriptor
            init.table = 'recordedartwork'
            init.handler = RecordedArtwork
            init.joins = (init.Join(table='recorded',
                                    tableto='recordedartwork',
                                    fieldsfrom=('inetref','season','hostname'),
                                    fieldsto=('inetref','season','host')),)
            return None

        if key in ('inetref', 'season', 'host'):
            return ('recordedartwork.%s=?' % key, value, 0)

        if key in ('chanid', 'title', 'subtitle'):
            return ('recorded.%s=?' % key, value, 1)

        if key == 'starttime':
            return ('recorded.%s=?' % key, datetime.duck(value), 1)

        return None
开发者ID:camdbug,项目名称:mythtv,代码行数:29,代码来源:methodheap.py


示例8: getLastGuideData

 def getLastGuideData(self):
     """
     Returns the last dat for which guide data is available
     """
     try:
         return datetime.duck(self.backendCommand('QUERY_GUIDEDATATHROUGH'))
     except ValueError:
         return None
开发者ID:Openivo,项目名称:mythtv,代码行数:8,代码来源:methodheap.py


示例9: __init__

 def __init__(self, data=None, db=None):
     if data is not None:
         if None not in data:
             data = [data[0], datetime.duck(data[1])]
     DBDataWrite.__init__(self, data, db)
     if self.future:
         raise MythDBError(MythError.DB_RESTRICT, "'future' OldRecorded " +\
                     "instances are not usable from the bindings.")
开发者ID:DocOnDev,项目名称:mythtv,代码行数:8,代码来源:dataheap.py


示例10: getPreviewImage

    def getPreviewImage(self, chanid, starttime, width=None, \
                                                 height=None, secsin=None):
        starttime = datetime.duck(starttime)
        args = {'ChanId':chanid, 'StartTime':starttime.isoformat()}
        if width: args['Width'] = width
        if height: args['Height'] = height
        if secsin: args['SecsIn'] = secsin

        return self._result('Content/GetPreviewImage', **args).read()
开发者ID:Openivo,项目名称:mythtv,代码行数:9,代码来源:methodheap.py


示例11: getProgramDetails

 def getProgramDetails(self, chanid, starttime):
     """
     Returns a Program object for the matching show.
     """
     starttime = datetime.duck(starttime)
     args = {"ChanId": chanid, "StartTime": starttime.isoformat()}
     tree = self._queryTree("GetProgramDetails", **args)
     prog = tree.find("ProgramDetails").find("Program")
     return Program.fromEtree(prog, self.db)
开发者ID:scolbeck,项目名称:mythtv,代码行数:9,代码来源:methodheap.py


示例12: searchGuide

    def searchGuide(self, init=False, key=None, value=None):
        """
        obj.searchGuide(**args) -> list of Guide objects

        Supports the following keywords:
            chanid,     starttime,  endtime,    title,      subtitle,
            category,   airdate,    stars,      previouslyshown,
            stereo,     subtitled,  hdtv,       closecaptioned,
            partnumber, parttotal,  seriesid,   originalairdate,
            showtype,   programid,  generic,    syndicatedepisodenumber,
            ondate,     cast,       startbefore,startafter
            endbefore,  endafter
        """
        if init:
            init.table = 'program'
            init.handler = Guide
            init.joins = (init.Join(table='credits',
                                    tableto='program',
                                    fields=('chanid','starttime')),
                          init.Join(table='people',
                                    tableto='credits',
                                    fields=('person',)))

        if key in ('chanid','title','subtitle',
                        'category','airdate','stars','previouslyshown','stereo',
                        'subtitled','hdtv','closecaptioned','partnumber',
                        'parttotal','seriesid','originalairdate','showtype',
                        'syndicatedepisodenumber','programid','generic'):
            return ('%s=%%s' % key, value, 0)
        if key in ('starttime','endtime'):
            return ('%s=%%s' % key, datetime.duck(value), 0)
        if key == 'ondate':
            return ('DATE(starttime)=%s', value, 0)
        if key == 'cast':
            return ('people.name', 'credits', 2, 0)
        if key == 'startbefore':
            return ('starttime<%s', datetime.duck(value), 0)
        if key == 'startafter':
            return ('starttime>%s', datetime.duck(value), 0)
        if key == 'endbefore':
            return ('endtime<%s', datetime.duck(value), 0)
        if key == 'endafter':
            return ('endtime>%s', datetime.duck(value), 0)
        return None
开发者ID:Openivo,项目名称:mythtv,代码行数:44,代码来源:methodheap.py


示例13: getProgramDetails

 def getProgramDetails(self, chanid, starttime):
     """
     Returns a Program object for the matching show.
     """
     starttime = datetime.duck(starttime)
     args = {'ChanId': chanid, 'StartTime': starttime.isoformat()}
     return Program.fromJSON(
             self._request('Guide/GetProgramDetails', **args)\
                 .readJSON()['Program'],
             db=self.db)
开发者ID:Openivo,项目名称:mythtv,代码行数:10,代码来源:methodheap.py


示例14: getProgramGuide

    def getProgramGuide(self, starttime, endtime, startchan, numchan=None):
        """
        Returns a list of Guide objects corresponding to the given time period.
        """
        starttime = datetime.duck(starttime)
        endtime = datetime.duck(endtime)
        args = {'StartTime':starttime.isoformat().rsplit('.',1)[0],
                'EndTime':endtime.isoformat().rsplit('.',1)[0], 
                'StartChanId':startchan, 'Details':1}
        if numchan:
            args['NumOfChannels'] = numchan
        else:
            args['NumOfChannels'] = 1

        tree = self._queryTree('GetProgramGuide', **args)
        for chan in tree.find('ProgramGuide').find('Channels').getchildren():
            chanid = int(chan.attrib['chanId'])
            for guide in chan.getchildren():
                yield Guide.fromEtree((chanid, guide), self.db)
开发者ID:Cougar,项目名称:mythtv,代码行数:19,代码来源:methodheap.py


示例15: getProgramGuide

    def getProgramGuide(self, starttime, endtime, startchan, numchan=None):
        """
        Returns a list of Guide objects corresponding to the given time period.
        """
        starttime = datetime.duck(starttime)
        endtime = datetime.duck(endtime)
        args = {'StartTime':starttime.isoformat().rsplit('.',1)[0],
                'EndTime':endtime.isoformat().rsplit('.',1)[0], 
                'StartChanId':startchan, 'Details':1}
        if numchan:
            args['NumOfChannels'] = numchan
        else:
            args['NumOfChannels'] = 1

        dat = self._request('Guide/GetProgramGuide', **args).readJSON()
        for chan in dat['ProgramGuide']['Channels']:
            for prog in chan['Programs']:
                prog['ChanId'] = chan['ChanId']
                yield Guide.fromJSON(prog, self.db)
开发者ID:Openivo,项目名称:mythtv,代码行数:19,代码来源:methodheap.py


示例16: getRecording

 def getRecording(self, chanid, starttime):
     """FileOps.getRecording(chanid, starttime) -> Program object"""
     starttime = datetime.duck(starttime)
     res = self.backendCommand('QUERY_RECORDING TIMESLOT %s %s' \
                     % (chanid, starttime.mythformat()))\
                 .split(BACKEND_SEP)
     if res[0] == 'ERROR':
         return None
     else:
         return Program(res[1:], db=self.db)
开发者ID:camdbug,项目名称:mythtv,代码行数:10,代码来源:mythproto.py


示例17: getPreviewImage

    def getPreviewImage(self, chanid, starttime, width=None, height=None, secsin=None):
        starttime = datetime.duck(starttime)
        args = {"ChanId": chanid, "StartTime": starttime.isoformat()}
        if width:
            args["Width"] = width
        if height:
            args["Height"] = height
        if secsin:
            args["SecsIn"] = secsin

        return self._result("Content/GetPreviewImage", **args).read()
开发者ID:mdda,项目名称:mythtv,代码行数:11,代码来源:methodheap.py


示例18: getProgramGuide

    def getProgramGuide(self, starttime, endtime, startchan, numchan=None):
        """
        Returns a list of Guide objects corresponding to the given time period.
        """
        starttime = datetime.duck(starttime)
        endtime = datetime.duck(endtime)
        args = {
            "StartTime": starttime.isoformat().rsplit(".", 1)[0],
            "EndTime": endtime.isoformat().rsplit(".", 1)[0],
            "StartChanId": startchan,
            "Details": 1,
        }
        if numchan:
            args["NumOfChannels"] = numchan
        else:
            args["NumOfChannels"] = 1

        dat = self._request("Guide/GetProgramGuide", **args).readJSON()
        for chan in dat["ProgramGuide"]["Channels"]:
            for prog in chan["Programs"]:
                prog["ChanId"] = chan["ChanId"]
                yield Guide.fromJSON(prog, self.db)
开发者ID:mdda,项目名称:mythtv,代码行数:22,代码来源:methodheap.py


示例19: getProgramGuide

    def getProgramGuide(self, starttime, endtime, startchan, numchan=None):
        """
        Returns a list of Guide objects corresponding to the given time period.
        """
        starttime = datetime.duck(starttime)
        endtime = datetime.duck(endtime)
        args = {
            "StartTime": starttime.isoformat().rsplit(".", 1)[0],
            "EndTime": endtime.isoformat().rsplit(".", 1)[0],
            "StartChanId": startchan,
            "Details": 1,
        }
        if numchan:
            args["NumOfChannels"] = numchan
        else:
            args["NumOfChannels"] = 1

        tree = self._queryTree("GetProgramGuide", **args)
        for chan in tree.find("ProgramGuide").find("Channels").getchildren():
            chanid = int(chan.attrib["chanId"])
            for guide in chan.getchildren():
                yield Guide.fromEtree((chanid, guide), self.db)
开发者ID:scolbeck,项目名称:mythtv,代码行数:22,代码来源:methodheap.py


示例20: searchOldRecorded

    def searchOldRecorded(self, init=False, key=None, value=None):
        """
        obj.searchOldRecorded(**kwargs) -> list of OldRecorded objects

        Supports the following keywords:
            title,      subtitle,   chanid,     starttime,  endtime,
            category,   seriesid,   programid,  station,    duplicate,
            generic,    recstatus
        """

        if init:
            init.table = 'oldrecorded'
            init.handler = OldRecorded

        if key in ('title','subtitle','chanid',
                        'category','seriesid','programid','station',
                        'duplicate','generic','recstatus'):
            return ('oldrecorded.%s=%%s' % key, value, 0)
                # time matches
        if key in ('starttime','endtime'):
            return ('oldrecorded.%s=%%s' % key, datetime.duck(value), 0)
        return None
开发者ID:Openivo,项目名称:mythtv,代码行数:22,代码来源:methodheap.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python db_utility.db_command函数代码示例发布时间:2022-05-26
下一篇:
Python date_time.date_time函数代码示例发布时间: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