當前位置: 首頁>>代碼示例>>Python>>正文


Python Ontology.clone方法代碼示例

本文整理匯總了Python中ontology.Ontology.clone方法的典型用法代碼示例。如果您正苦於以下問題:Python Ontology.clone方法的具體用法?Python Ontology.clone怎麽用?Python Ontology.clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ontology.Ontology的用法示例。


在下文中一共展示了Ontology.clone方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: transform

# 需要導入模塊: from ontology import Ontology [as 別名]
# 或者: from ontology.Ontology import clone [as 別名]
 def transform(self, template):
     # apply overrides on the pivot location from the template
     if 'override' in template:
         for k,v in template['override'].iteritems():
             self.location[k] = v
             
     # apply track rules from the template
     if 'track' in template:
         for rule in template['track']:
             for branch in rule['branch']:
                 taken = False
                 for stream in self.resource.stream:
                     if stream.match(branch):
                         taken = True
                         s = Ontology.clone(stream)
                         s['resource path digest'] = self.resource.location['path digest']
                         if 'override' in rule:
                             for k,v in rule['override'].iteritems(): s[k] = v
                         self.stream.append(s)
                         
                         if rule['mode'] == 'choose':
                             break
                             
                 if taken and rule['mode'] == 'choose':
                     break
                     
     return self.taken
開發者ID:moonwatcher,項目名稱:mp4pack.py,代碼行數:29,代碼來源:__init__.py

示例2: _transcode_ac3

# 需要導入模塊: from ontology import Ontology [as 別名]
# 或者: from ontology.Ontology import clone [as 別名]
 def _transcode_ac3(self, task):
     product = task.produce(task.ontology)
     if product:
         taken = False
         
         for pivot in task.transform.pivot.values():
             for stream in pivot.stream:
                 if not taken and stream['stream kind'] == 'audio':
                     taken = True
                     
                     # Clone the hint ontology
                     product.hint = Ontology.clone(self.hint)
                     
                     command = self.env.initialize_command('ffmpeg', self.log)
                     if command:
                         # make ffmpeg not check for overwrite, we already do this check
                         command.append(u'-y')
                         
                         # set the number of processing threads
                         command.append(u'-threads')
                         command.append(unicode(self.env.system['threads']))
                         
                         # set the input file
                         command.append(u'-i')
                         command.append(self.path)
                         
                         for k,v in stream['ffmpeg parameters'].iteritems():
                             command.append(k)
                             if v is not None: command.append(unicode(v))
                             
             if taken: break
         if taken and self.env.check_path_available(product.path, task.ontology['overwrite']):
             command.append(product.path)
             message = u'Transcode {} --> {}'.format(self.path, product.path)
             self.env.execute(command, message, task.ontology['debug'], pipeout=True, pipeerr=False, log=self.log)
開發者ID:moonwatcher,項目名稱:mp4pack.py,代碼行數:37,代碼來源:material.py

示例3: produce

# 需要導入模塊: from ontology import Ontology [as 別名]
# 或者: from ontology.Ontology import clone [as 別名]
 def produce(self, override=None):
     # copy the location ontology
     p = Ontology.clone(self.location)
     
     # allow the location to recalculate those concepts 
     del p['volume path']
     del p['file name']
     del p['directory']
     
     # explicitly set the volume and host from the task
     p['host'] = self.env.host
     p['volume'] = self.ontology['volume']
     
     # for copy and move we try to set a profile from the source
     if self.ontology['action'] in set(('copy', 'move', 'pack')):
         if self.resource.meta['profile']:
             p['profile'] = self.resource.meta['profile']
             
     # for transcode we try to set the profile from the transform
     elif self.ontology['action'] == 'transcode':
         for pivot in self.transform.pivot.values():
             if 'profile' in pivot.location:
                 p['profile'] = pivot.location['profile']
                 
     # whatever happened, if a profile has been explicitly provided by the task
     # it will override anything we set implicitly
     if self.ontology['profile']:
         p['profile'] = self.ontology['profile']
         
     # if an override was given set some concepts from it 
     if override:
         for i in set((
             'kind', 
             'language',
             'stream order',
             'resource path digest',
             'routing type'
         )):
             if i in override: p[i] = override[i]
             
     # try to produce a product
     product = self.resource.asset.locate_resource(p)
     if product:
         self.product.append(product)
     else:
         self.log.error(u'Could not determine destination path from:\n%s', self.env.encode_json(p))
         
     return product
開發者ID:moonwatcher,項目名稱:mp4pack.py,代碼行數:50,代碼來源:queue.py

示例4: __init__

# 需要導入模塊: from ontology import Ontology [as 別名]
# 或者: from ontology.Ontology import clone [as 別名]
 def __init__(self, resource):
     self.resource = resource
     self.location = Ontology.clone(resource.location)
     self.stream = []
開發者ID:moonwatcher,項目名稱:mp4pack.py,代碼行數:6,代碼來源:__init__.py


注:本文中的ontology.Ontology.clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。