~thisfred/+junk/scripts

« back to all changes in this revision

Viewing changes to autosearch.py

  • Committer: Eric Casteleijn
  • Date: 2012-02-12 21:53:24 UTC
  • Revision ID: eric.casteleijn@canonical.com-20120212215324-r449e9p5w8l6h29k
and more precise searches

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
            tag_search = ''
44
44
            if artists:
45
45
                aa = ','.join(
46
 
                    ["|(artist=/\\b%s\\b/,performer=/\\b%s\\b/)" %
 
46
                    ["|(artist=/(^|\W)%s($|\W)/,performer=/(^|\W)%s($|\W)/)" %
47
47
                     (a, a) for a in artists])
48
48
                if aa:
49
49
                    artist_search = "|(%s)" % aa
50
50
            if title:
51
 
                title_search = "title=/\\b%s\\b/" % title
 
51
                title_search = "title=/(^|\W)%s($|\W)/" % title
52
52
                tag_search = "grouping=/^%s$/" % title
53
53
            if filename:
54
 
                filename_search = "~basename=/%s/" % filename
 
54
                filename_search = "~basename=/%s($|\W)/" % filename
55
55
            if album:
56
 
                album_search = "album=/\\b%s\\b/" % album
 
56
                album_search = "album=/(^|\W)%s($|\W)/" % album
57
57
            search = ("|(%s)" % ','.join([s for s in [
58
58
                artist_search, title_search, filename_search, album_search,
59
59
                tag_search] if s]))