Commits

Anonymous committed e7b4876

some minor changes

Comments (0)

Files changed (2)

xboomx/bin/xboomx_sort.py

 import shelve
 import fileinput
+import os
 
 
 def main():
     # open db
-    db = shelve.open('~/.xboomx/xboomx.db')
+    db = shelve.open(os.getenv("HOME") + '/.xboomx/xboomx.db')
 
     # read lines and set weight according to db
     items = []
 
     for input_item in fileinput.input():
+        input_item = input_item.strip('\n')
         items.append((db.get(input_item, 0), input_item))
 
 
     # sort items
-    items.sort(key= lambda x: x[0])
+    items.sort(key= lambda x: x[0], reverse=True)
 
     # print items
     for item in items:

xboomx/bin/xboomx_update.py

 import shelve
 import fileinput
+import os
 
 
 def main():
     # open db
-    db = shelve.open('~/.xboomx/xboomx.db')
+    db = shelve.open(os.getenv("HOME") + '/.xboomx/xboomx.db')
 
     # get item to update
     item = fileinput.input().next()
+    item = item.strip('\n')
 
     # update item
     db[item] = db.get(item, 0) + 1