Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching song duration related info #75

Closed
UtkarshVerma opened this issue May 23, 2018 · 5 comments
Closed

Fetching song duration related info #75

UtkarshVerma opened this issue May 23, 2018 · 5 comments
Milestone

Comments

@UtkarshVerma
Copy link

As far as I know, playerctl doesn't have any commands for fetching the song length(full duration). While playerctl position returns the current position of playback in seconds, it would be better if it were formattable, in (minute):(second) format.
It would be great to implement this.

@acrisci
Copy link
Member

acrisci commented May 23, 2018

You can get it with a command like playerctl metadata mpris:length, but the time units are a little weird.

How do you propose to do the formatting?

@UtkarshVerma
Copy link
Author

UtkarshVerma commented May 24, 2018

I am currently using a bash script for the formatting but it would be better if playerctl also formatted the time like audtool does, i.e. 3:40(min:sec).
Link to my script: https://github.com/UtkarshVerma/scripts/blob/master/formatTime

Usage: https://github.com/UtkarshVerma/i3blocklets/blob/master/music

@acrisci
Copy link
Member

acrisci commented Oct 2, 2018

We've got the basics for this feature in #73 now with the format parser.

I know it's a bit over the top, but I think it would be cool if we put helper functions in the little template language.

So like this:

playerctl metadata --format 'position: {{ minutes(mpris:length) }}:{{ seconds(mpris:length) }}'

@acrisci
Copy link
Member

acrisci commented Oct 3, 2018

eh, maybe simpler like playerctl metadata --format 'position: {{ formatduration(mpris:length) }}'.

@acrisci acrisci closed this as completed in ce9c8e2 Oct 4, 2018
@acrisci acrisci added this to the 1.0.0 milestone Oct 13, 2018
@UtkarshVerma
Copy link
Author

UtkarshVerma commented Oct 16, 2018

@acrisci I just noticed this issue and the other ones. Sorry for being unresponsive. I just have stopped developing temporarily. Glad to know you implemented it. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants