示例#1
0
	def get(self, media_type=None):
		if self.sources is None:
			self.sources = []
			for t in self.xml_tree.getroot():
				m_type = t.tag
				if media_type is not None and m_type != media_type:
					continue
				for s in t.findall('source'):
					label = s.find('name').text
					path = filesystem.normpath(s.find('path').text)
					self.sources.append(Source(m_type, path, label))
		return self.sources
示例#2
0
 def get(self, media_type=None, normalize=True):
     if self.sources is None:
         self.sources = []
         for t in self.xml_tree.getroot():
             m_type = t.tag
             if media_type is not None and m_type != media_type:
                 continue
             for s in t.findall('source'):
                 label = s.find('name').text
                 if normalize:
                     path = filesystem.normpath(s.find('path').text)
                 else:
                     path = s.find('path').text
                 self.sources.append(Source(m_type, path, label))
     return self.sources
示例#3
0
 def has(self, media_type=None, label=None, path=None):
     if path:
         path = filesystem.normpath(path)
     return any((comp_str_nc(s.path, path) or path is None) and (
         s.label == label or label is None) for s in self.get(media_type))
示例#4
0
	def has(self, media_type=None, label=None, path=None):
		if path:
			path = filesystem.normpath(path)
		return any((comp_str_nc(s.path, path) or path is None) and (s.label == label or label is None)
				   for s in self.get(media_type))