Next: , Previous: Browser Interface, Up: The Browser

20.2 Filtering Tracks

If you want to display a subset of your collection (such as a directory of 80s music, only avi files, etc.) then you can extend the Browser by defining “filters”.

Show everything:

     (emms-browser-make-filter "all" 'ignore)

Set "all" as the default filter:

     (emms-browser-set-filter (assoc "all" emms-browser-filters))

Show all files (no streamlists, etc):

      "all-files" (emms-browser-filter-only-type 'file))

Show only tracks in one folder:

      "80s" (emms-browser-filter-only-dir "~/Mp3s/80s"))

Show all tracks played in the last month:

      "last-month" (emms-browser-filter-only-recent 30))

After executing the above commands, you can use M-x emms-browser-show-all, emms-browser-show-80s, etc to toggle between different collections. Alternatively you can use '<' and '>' to cycle through the available filters.

The second argument to make-filter is a function which returns t if a single track should be filtered. You can write your own filter functions to check the type of a file, etc.

Show only tracks not played in the last year:

     (emms-browser-make-filter "not-played"
      (lambda (track)
       (not (funcall (emms-browser-filter-only-recent 365) track))))

Show all files that are not in the pending directory:

      (lambda (track)
         (funcall (emms-browser-filter-only-type 'file) track)
         (not (funcall
               (emms-browser-filter-only-dir "~/Media/pending") track)))))