Commit Graph

19 Commits

Author SHA1 Message Date
35c97e814a Code formatting - move default argument initialization 2019-10-18 16:09:31 +04:00
021d3060d4 Add -f/--format option. 2019-10-18 14:33:03 +04:00
d899c6815c Use song ID to check if song changed, not the title/album/artist.
No longer have to retrieve song information each update.
2019-10-18 12:09:44 +04:00
9ceaa0045e Add -p/--padding option 2019-10-18 01:15:39 +04:00
2424a92e4c Command line options!
Made update interval, scroll length and scroll step
settable at runtime.

Renamed meta to state, changed its structure.

Optimizations to print_status:
- Calculate full_label and padded_label (and their lengths) only when the
  song changes, rather than doing multiple sprintf's and strlen's each
  call
- Only allocate space for the printed label when doing scrolling,
  otherwise just update the label pointer directly to the full_label

Other minor changes.
2019-10-18 00:14:59 +04:00
dcaff92de2 Decrease scroll_length from 30 to 25 2019-10-17 02:02:40 +04:00
f7a240aaaf Add scroll_step to worker_meta, swap title and artist. 2019-10-17 02:01:19 +04:00
d2ae447bda Clean handling of connection loss to MPD. 2019-10-17 01:52:32 +04:00
61c69691b4 Revert "Revive connection upon error."
This reverts commit 0c401294b7.
2019-10-17 00:18:24 +04:00
1c5fb8b22d Only update scroll position on successful status update.
Set scroll_index to 0 when not playing or paused.
2019-10-16 22:29:05 +04:00
0c401294b7 Revive connection upon error.
Keep connection on input loop alive.
2019-10-16 22:23:09 +04:00
d848dc0560 Readability/sensible ordering 2019-10-16 21:47:42 +04:00
ec4be8d9dc Simplify print_status by using mpd_run calls. 2019-10-16 21:32:41 +04:00
49c1a3b904 Rework handling of input reading, fix segmentation fault.
Connection to mpd is no longer left open when invalid
input received.

Segmentation fault was a result of passing getline
an uninitialized pointer.

Also make sure to free the pointer after.
2019-10-16 20:45:17 +04:00
06a70df2c5 utf8 char handling via glib's utf8 aware string functions 2019-10-16 20:45:12 +04:00
efa0e1cb70 Revert "Add handling for utf8 chars."
This reverts commit df77d46645.

We will be handling this in a much better way with glib in the future.
2019-10-16 20:42:15 +04:00
df77d46645 Add handling for utf8 chars. 2019-10-15 23:50:43 +04:00
0ff8cc70ff Added scrolling text label for artist and song name 2019-10-15 17:54:08 +04:00
5ec151409e Initial commit 2019-10-14 23:38:14 +04:00