mihirlad55 / polybar-spotify-module

A collection of lightweight programs for use with a Polybar Spotify Module
GNU General Public License v3.0
140 stars 9 forks source link

Status formatting options #8

Closed mihirlad55 closed 4 years ago

mihirlad55 commented 4 years ago

Add commandline options for formatting status output.

p0da commented 4 years ago

Any progress made on this issue?

mihirlad55 commented 4 years ago

Hey, sorry I got caught up with finals and this kinda slipped my mind. No progress yet.

Anyways, I'll try to put in some work this week. If you have any specific suggestions on what options you'd like to see, I can take them into consideration when developing this feature.

p0da commented 4 years ago

Nothing really specific, only thing I would say is to add an option to truncate strings exceeding a given length.

mihirlad55 commented 4 years ago

Ok, I'm planning to add options to specify the format and max length of the track and artist. Specifically the following:

In terms of specifying the command, maybe something along the lines of:

spotifyctl status \
    --format "%artist%: %title%" \
    --max-artist-length 15 \
    --max-title-length 10 \
    --max-length 20

By the way, there is some logic to specify these lengths hardcoded in the program if you would like to re-compile it with your own specific lengths while I work on the feature: https://github.com/mihirlad55/polybar-spotify-module/blob/master/src/spotifyctl.c#L27

p0da commented 4 years ago

Got it, will definitely look into recompiling.

mihirlad55 commented 4 years ago

The feature is almost ready. I'm just organizing them into separate commits right now. Unfortunately, there seems to be some minor memory leaks caused by the new feature which I will have to look into, but I should have at least a working version up within the hour if you would like to test it.

mihirlad55 commented 4 years ago

Okay, its all been pushed: https://github.com/mihirlad55/polybar-spotify-module/tree/feature-status-formatting

Main feature related commits:

After I fix the memory leaks and do some quick testing, I will make an official release and push this to master.

To do for this issue:

mihirlad55 commented 4 years ago

A few new commits were pushed to fix the memory leaks that were found after some further testing

mihirlad55 commented 4 years ago

Some more commits were just added. If max length is specified, artist and title will not be truncated if the entire output satisfies the max length constraint.