Re: Not played since filter: really working?

"Erica Lina Qi (Zenie) <[email protected]>" <[email protected]> Sat, 29 Nov 2025 13:27:31 +0000
Newsgroups gmane.emacs.emms.user
Message-ID <[email protected]>
Igor Sosa Mayor <[email protected]> writes:

I don't know if this email will get through to the server.
I keep trying to subscribe with this email as it is the
one I use in Emacs.


I haven't tested this.  I'll try to get to it today.
But here is a filter for 'has played'.
The inverse, being never played.

I made it has played to avoid the double negatives.

If the filter was 'never' has been played would be 'not never'...

Maybe a better name is simply 'played'  Its the registered name
that you see in the interface.

The function could be turned into never played with a not around 
the
emms-track-get. I try to keep the number of factories down.
Especially if they are composable.

This uses the return value for the last-played field as the 
indicator
of being played. If it isn't set, it will be nil which is 
'never-played'.
So any value will make the filter true, and will show only music 
which has
been played.

Have a nice day.

Erica, 

(defun emms-filters-make-filter-has-played ()
  "Show only tracks that have been played."
  #'(lambda (track)
      (emms-track-get track 'last-played nil)))

(emms-filters-register-filter-factory "Has played"
                          'emms-filters-make-filter-has-played
                          '())

> Hi emms-users,
>
> I have already a small problem. In this case with the filter 
> factory
> defined as "Not played since". If I filter my tracks with 
> "Played since"
> and "Not played since" 30 days, I get exactly the same 
> results... Either
> it is a problem with the way my tracks are storing the time or a 
> problem
> with the code.
>
> More precisely my question is: is this code working at expected?
>
> (defun emms-filters-make-filter-not-played-within (days)
>   "Make a not played since DAYS filter."
>   (lambda (track)
>     (funcall (emms-filters-make-filter-played-within days) 
>     track)))
>
> Thanks in advance!
>
> Best,