예제 #1
0
파일: fred.py 프로젝트: albins/music-tools
def main(args):
    start_time = time.time()
    
    db.index(datapath = MUSIC_DIR, dbpath = DBPATH)
    
    #db.tag(dbpath=DBPATH, querystring=" ".join(args[1:]), tags=["inbox", "fisk"])
    
    matches = db.search(dbpath=DBPATH, querystring=" ".join(args[1:]))
    for match in matches:
        print u"{tracknumber} {artist} – »{title}« from {album} {year} ({length} s). Last modified {mtime}. Tagged {tags}.".format(**match['data'])
    print "N: Found %i tracks in  in %f ms.\n" % (len(matches), (time.time() - start_time)*1000)
예제 #2
0
파일: test.py 프로젝트: krl/music-tools
def with_index(f):
  from db.xapian_music import index
  from shutil import rmtree as remove
  
  MUSIC_DIR = os.path.join(TESTDIR, "music_dir") 
  DBPATH = os.path.join(TESTDIR, "music.db")

  index(MUSIC_DIR, DBPATH)
  
  try:
    f(DBPATH)
  finally:
    remove(DBPATH)