3 # debugging hack - add . to path
5 local_module_dir = os.path.join(os.path.dirname(sys.argv[0]), '..')
6 if os.path.isdir(local_module_dir):
7 sys.path.append(local_module_dir)
9 from jamaendo.api import LocalDB, Queries, refresh_dump
12 class Refresher(object):
20 def progress(self, percent):
21 if percent - self.last_percent >= 5:
22 print "\r%d%%" % (percent),
23 self.last_percent = percent
26 refresh_dump(self.complete, self.progress, force=False)
33 print json.dumps(x, sort_keys=True, indent=4)
41 result = Queries.albums_today()
43 elif query == 'tracks_this_month':
44 result = Queries.tracks_this_month()
46 elif query == 'artist':
50 for artist in db.search_artists(q):
52 elif query == 'album':
56 for album in db.search_albums(q):
59 if __name__=="__main__":