Home   |   Login   |   Search:  
FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
Python Script to Assist in Tagging (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 1
TOPIC: Python Script to Assist in Tagging
#8
sumdog (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Python Script to Assist in Tagging 12 Months ago Karma: -1  
Tagsistant is really the best proof-of-concept I've seen so far in creating a 'tagging' filesystem. I've been using it for a collection of videos I have. In order to make tagging more efficient, I've created the following python script. It takes a file outside of the repository, copies it in the repository and then symbolically links to that file in order to correctly associate tags.

It seems that using symbolic links in tagsistant throws a filesystem error, so I've had to ignore that error in this script.

I hope to make more scripts and eventually some GUIs. It looks like development on this project is a little stalled, but I hope it continues. It's a really good concept.

<pre>
cat /usr/local/bin/tagsissy.py
#!/usr/bin/env python
import sys
from shutil import move
from os import symlink,path,errno

tagdir = '/media/tags/'

tags = agsistant is really the best proof-of-concept I've seen so far in creating a 'tagging' filesystem. I've been using it for a collection of videos I have. In order to make tagging more efficient, I've created the following python script. It takes a file outside of the repository, copies it in the repository and then symbolically links to that file in order to correctly associate tags.

It seems that using symbolic links in tagsistant throws a filesystem error, so I've had to ignore that error in this script.

I hope to make more scripts and eventually some GUIs. It looks like development on this project is a little stalled, but I hope it continues. It's a really good concept.

<pre>
cat /usr/local/bin/tagsissy.py
#!/usr/bin/env python
import sys
from shutil import move
from os import symlink,path,errno

tagdir = '/media/tags/'

tags = []
file = sys.argv[1]

for arg in sys.argv[2:]:
tags.append(arg)
if(not path.isdir(path.join(tagdir,arg))):
print "%s is not a tag" % arg
exit(1)


coredir = path.join(tagdir,tags[0])

#print "Moving %s to %s" % (file,coredir)
print "file: %s" % file
print "tagging: %s" % tags[0]
move(file,coredir)
for t in tags[1:]:
src = path.join(coredir,file)
dest = path.join(tagdir,t,file)
#print "source:" + src
#print "dest:" + dest
print "tagging: %s" % t
try:
symlink(src,dest)
except OSError, e:
if not e.errno == errno.EEXIST:
print "error creating link" + e.errno

print "done"
</pre>
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
      Topics Author Date
    emo
Python Script to Assist in Tagging
sumdog 2009/09/09 19:05
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
Valid HTML 4.01 Transitional   Valid CSS!   hosted by gna!
Creative Commons License   This site is licensed under a
  Creative Commons Attribution-Share Alike 2.5 Italy License.