Permalink
Browse files

Implement searching for album and corresponding test.

  • Loading branch information...
1 parent 91d11d1 commit ea21db2ad170d1cc868abb9e6833499831e7c673 Albin Stjerna committed Feb 10, 2013
Showing with 15 additions and 2 deletions.
  1. +4 −1 db/xapian_music.py
  2. +11 −1 test/test.py
View
@@ -13,12 +13,15 @@
'title' : 'S',
'year' : 'Y',
'path' : 'U',
+ 'album' : 'XALBUM',
'mtime' : 'XMTIME',
'title' : 'XTITLE',
'tracknumber' : 'XTRACKNR'}
+NUMERIC_PREFIXES = {}
+
# Use slot #1 for tags
-XAPIAN_TAGS = 1
+#XAPIAN_TAGS = 1
def index(datapath, dbpath):
# Create or open the database we're going to be writing to.
View
@@ -241,7 +241,17 @@ def test_remove_tags():
assert False
def test_search_album():
- assert False
+
+ def search_album(db):
+ q = 'album:"Automatic"'
+ songs = search(db, q)
+ assert len(songs) == 1
+ song_data = songs[0]['data']
+ assert song_data['title'] == "Streamline"
+ assert song_data['path'] == os.path.join(TESTDIR,
+ "music_dir/06-streamline.mp3")
+
+ with_index(search_album)
def test_sort_mtime():
assert False

0 comments on commit ea21db2

Please sign in to comment.