Exemple #1
0
def get_tag(tag, parent=None):
	if parent:
		return get_tag_with_parent(tag, parent)
	tags = []
	for t in tag.split(" "):
		tags.append(t)
	return [f.strip() for f in sh.tmsu("files", "--", tags)]
Exemple #2
0
def get_tag(tag, parent=None):
    if parent:
        return get_tag_with_parent(tag, parent)
    tags = []
    for t in tag.split(" "):
        tags.append(t)
    return [f.strip() for f in sh.tmsu("files", "--", tags)]
Exemple #3
0
 def refresh_cache(self):
     self.cache = []
     for tag in sh.tmsu("tags", "--all"):
         tag = tag.strip()
         if tag.find(":") > -1:
             subtags = tag.split(":")
             create_tag(self.cache, subtags)
         else:
             create_tag(self.cache, [tag])
Exemple #4
0
	def refresh_cache(self):
		self.cache = []
		for tag in sh.tmsu("tags", "--all"):
			tag = tag.strip()
			if tag.find(":") > -1:
				subtags = tag.split(":")
				create_tag(self.cache, subtags)
			else:
				create_tag(self.cache, [tag])
Exemple #5
0
def get_tag_with_parent(tag, parent):
    tags = []
    for t in tag.split(" "):
        if t.startswith("%s:" % parent) or tag.startswith("-%s:" % parent):
            tags.append(t)
        elif t.startswith("-"):
            tags.append("-%s:%s" % (parent, t[1:]))
        else:
            tags.append("%s:%s" % (parent, t))
    return [f.strip() for f in sh.tmsu("files", "--", tags)]
Exemple #6
0
def get_tag_with_parent(tag, parent):
	tags = []
	for t in tag.split(" "):
		if t.startswith("%s:" % parent) or tag.startswith("-%s:" % parent):
			tags.append(t)
		elif t.startswith("-"):
			tags.append("-%s:%s" % (parent, t[1:]))
		else:
			tags.append("%s:%s" % (parent, t))
	return [f.strip() for f in sh.tmsu("files", "--", tags)]
Exemple #7
0
 def remove_tag(self, tag, validator):
     # Function is idempotent, will not error for removing a tag or files
     # that have already been removed
     files = [f.strip() for f in sh.tmsu("files", "--", tag)]
     for fn in files:
         self.remove_file(fn, validator)
     try:
         tags.remove(tag)
     except:
         pass
Exemple #8
0
	def remove_tag(self, tag, validator):
		# Function is idempotent, will not error for removing a tag or files
		# that have already been removed
		files = [f.strip() for f in sh.tmsu("files", "--", tag)]
		for fn in files:
			self.remove_file(fn, validator)
		try:
			tags.remove(tag)
		except:
			pass
Exemple #9
0
 def add_tag(self, tag, validator):
     files = [f.strip() for f in sh.tmsu("files", "--", tag)]
     for fn in files:
         self.add_file(fn, validator)
     self.tags.add(tag)
Exemple #10
0
	def add_tag(self, tag, validator):
		files = [f.strip() for f in sh.tmsu("files", "--", tag)]
		for fn in files:
			self.add_file(fn, validator)
		self.tags.add(tag)