GNU bug report logs - #76350
[PATCH] Add MPD stats viewer to 'mpc'

Previous Next

Package: emacs;

Reported by: jm <at> pub.pink

Date: Sun, 16 Feb 2025 20:07:01 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 76350 <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 76350 <at> debbugs.gnu.org
Subject: Re: bug#76350: [PATCH] Add MPD stats viewer to 'mpc'
Date: Mon, 17 Feb 2025 15:03:51 -0600
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> +;;; Stats viewer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>> +
>> +(defcustom mpc-mpd-stats-date-format "%c"
>> +  "Format used for dates in `mpc-mpd-stats'.
>> +See `format-time-string' for formatting details."
>> +  :version "31.1"
>> +  :type 'string)
>> +
>> +(defcustom mpc-mpd-stats-duration-format "%Y, %D, %z%h:%.2m:%.2s"
>> +  "Format used for durations in `mpc-mpd-stats'.
>> +See `format-seconds' for formatting details."
>> +  :version "31.1"
>> +  :type 'string)
>
> Do we need this level of customization?

I hope not.

>> +         :objects (let-alist (mpc-proc-cmd-to-alist (list "stats"))
>> +                    `(("Artists" ,.artists)
>> +                      ("Albums" ,.albums)
>> +                      ("Songs" ,.songs)
>> +                      ("Play Time" ,(mpc--mpd-stats-duration .playtime))
>> +                      ("Uptime" ,(mpc--mpd-stats-duration .uptime))
>> +                      ("DB Play Time" ,(mpc--mpd-stats-duration .db_playtime))
>> +                      ("DB Updated" ,(mpc--mpd-stats-date .db_update))))))
>
> But here I'd be tempted not to hardcode the list, so it will always
> print all the info returned by the server:
>
> - Maybe have a generic heuristic to make the keys pretty (e.g. turn
>   "albums" into "Albums" and "db_update" into "DB Update")
> - Provide ad-hoc elements for those specific entries where we want to
>   prettify the raw value before displaying it (i.e. where we want to
>   apply `mpc--mpd-stats-duration` or `mpc--mpd-stats-date`).
>
> WDYT?

Sounds good. How about the attached?

[0001-Add-MPD-stats-viewer-to-mpc-Bug-76350.patch (text/x-patch, attachment)]

This bug report was last modified 95 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.