Advertisement
clockworkpc

TiddlyWiki Tag Generator

Aug 3rd, 2012
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. #!/usr/bin/python
  2. #/home/clockworkpc/bin/tiddlytagfilecreator.py
  3.  
  4. # Released under a GPLv3 Licence by Clockwork PC 2012
  5. # www.clockworkpc.com.au
  6.  
  7. # You are entitled to the following four freedoms:
  8. # Freedom 0: To run this program for any purpose
  9. # Freedom 1: To study how this program works and change it to make it do what you wish
  10. # Freedom 2: To redistribute copies so you can help your neighbour
  11. # Freedom 3: To distribute copies of your modified version to others
  12.  
  13. import os
  14. import fileinput
  15.  
  16. masterTagFile = (os.getenv("HOME")+"/Dropbox/Deakin/Tiddlywiki/TiddlyTags/MasterFiles/master_tiddlytags.txt")
  17. os.system("touch " + masterTagFile)
  18.  
  19. tagDirectory = (os.getenv("HOME")+"/Dropbox/Deakin/Tiddlywiki/TiddlyTags/")
  20. tagSubject = raw_input("Which subject is this for? ")
  21. tagFileName = raw_input("What do you want to call the tag file? ")
  22. tagFile = tagDirectory + tagSubject + "_" + tagFileName + ".txt"
  23. os.system("touch " + tagFile)
  24.  
  25. print tagFile
  26.  
  27. def createList():
  28.     a = open(masterTagFile, "a")
  29.     a.write('\n' + tagFileName + " = []"+'\n')
  30.     a.close()
  31.  
  32. createList()
  33.  
  34. def createTag():
  35.     newTag = raw_input("Enter the name of the new tag: ")
  36.    
  37.     f = open(tagFile, "a")
  38.     f.write("!!!![["+newTag+"]]"+'\n')
  39.     f.close()
  40.    
  41.     print '\n' + "You are updating this topic: " + tagFileName + '\n'
  42.  
  43.     g = open(masterTagFile, "a")
  44.     g.write(newTag+'\n')
  45.     g.close()
  46.    
  47. running = True
  48. while running:
  49.     createTag()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement