当前位置: 首页>>代码示例>>Python>>正文


Python Node.addVideo方法代码示例

本文整理汇总了Python中Node.Node.addVideo方法的典型用法代码示例。如果您正苦于以下问题:Python Node.addVideo方法的具体用法?Python Node.addVideo怎么用?Python Node.addVideo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node.Node的用法示例。


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

示例1: harvest

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import addVideo [as 别名]
	def harvest(self, vf):	
		if not Harvester.harvest(self, vf):
			return
		
		mvf = vf.getMeta()
		# determine grouping
		groupTag = self.opts['group']
		if groupTag == None:
			# no grouping - stuff into root node
			target = self.root
		else:
			# get the grouping value
			if groupTag not in mvf:
				grp = OTHER
			else:
				grp = mvf[groupTag]
				if type(grp) is list:
					raise ConfigError("Configuration Error - grouping item must not be a list")

			if grp in self.nodeMap:
				# if we've seen this group, then just reuse the 
				# same node
				target = self.nodeMap[grp]
			else:
				# Otherwise create a new node and link it in
				path=os.path.join(self.hpath, Legalize(grp))
				target = Node(grp, self.opts, path=path, title = "%s: %s" %(metaTranslate(groupTag), grp))
				self.pathMap[os.path.join(self.name, grp)] = path
				self.nodeMap[grp] = target
				self.root.addDir(target)
				self.gcount += 1
		
		target.addVideo(vf)
		self.count += 1
开发者ID:jbernardis,项目名称:pytivo-video-mgr2,代码行数:36,代码来源:Meta.py

示例2: harvest

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import addVideo [as 别名]
	def harvest(self, vf):
		if not Harvester.harvest(self, vf):
			return
		# get the metadata for the video
		mvf = vf.getMeta()
		groupTag = self.opts['group']
		
		addlist = []
		
		# now scan through our list of keys
		mkmatch = 0
		for mk in self.metakeys:	
			# check if the video even has this key	
			if mk in mvf:
				mkmatch += 1
				# it does - get the values and build up our worklist
				if type(mvf[mk]) is list:
					for mv in mvf[mk]:
						if mv not in addlist:
							addlist.append(mv)
				else:
					mv = mvf[mk]
					if mv not in addlist:
						addlist.append(mv)
						
		if mkmatch == 0 and self.verbose:
			print "%s does not have any of meta tag(s) %s" % (vf.getFullPath(), str(self.metakeys))
					
		# now go through the worklist and build the structure as we go
		tally = False
		for mv in addlist:
			if groupTag == None:
				# no grouping for this share OR video does not have
				# grouping metadata item
				if mv not in self.nodeMap:
					# we've not seen this value yet - create a Node
					# and link it in
					target = Node(mv, self.opts)
					self.nodeMap[mv] = target
					self.root.addDir(target)
				else:
					# otherwise we've seen it so just use it
					target = self.nodeMap[mv]
					
			else:
				# otherwise we are grouping
				if groupTag not in mvf:
					grp = OTHER
				else:
					grp = mvf[groupTag]
					if type(grp) is list:
						raise ConfigError ("Configuration Error - grouping item must not be a list")

				grpTitle = "%s: %s" % (metaTranslate(groupTag), grp)
				if grp not in self.nodeMap:
					grpNode = Node(grp, self.opts, title = grpTitle)
					self.nodeMap[grp] = grpNode
					self.root.addDir(grpNode)
					self.gcount += 1
				else:
					grpNode = self.nodeMap[grp]
					
				mvkey = grpTitle + "/" + mv
				if mvkey not in self.nodeMap:
					target = Node(mv, self.opts, title = mvkey)
					self.nodeMap[mvkey] = target
					grpNode.addDir(target)
				else:
					target = self.nodeMap[mvkey]
					
			target.addVideo(vf)
			tally = True
			
		if tally:
			self.count += 1
开发者ID:thspencer,项目名称:pytivo-video-mgr2,代码行数:77,代码来源:Meta.py


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