Esempio n. 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)]
Esempio n. 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)]
Esempio n. 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])
Esempio n. 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])
Esempio n. 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)]
Esempio n. 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)]
Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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)