Subject: bug#41493: 26.3; Error in MPC directory browser

From: john muhl <[email-masked]>
Date: Wed, 01 Jan 2025 21:27:55 -0600

Stefan Monnier <[email-masked]> writes:

> Hi John,
>
> Hmm... IIUC the output we receive is a list of pairs made of sublists of
> the form either:
>
>     (directory . <...>)
>     (Last-Modified . <...>)
>
> or
>
>     (file . <...>)
>     (Last-Modified . <...>)
>     (Format . <...>)
>     (Title . <...>)
>     ...

That’s what I see in the (fairly recent) versions of mpd I tried.

> IIUC when I wrote the code there were no such `Last-Modified` entries.
>
> We're interested in extracting a list of the files (where each file is
> represented by its alist), so I just stripped away all the `directory`
> entries and that was it.  But now that `directory` can be followed by
> info about that directory (currently only `Last-Modified`), we should
> arguably be more careful to also remove everything between
> `directory` and the next `file` or `directory`.
>
> So I think the patch below is "more robust".
> WDYT?

Yeah that makes more sense.

> I also think it's a good opportunity to add some comments/docstrings
> because it took me a while to understand what this was trying to do.

No objections from me :)