shithub: zuke

Download patch

ref: eac2af266c6a009cee2d49dfb3e2165736ea6406
parent: 283868a78a5ecaadebd697505034e9094322621b
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Oct 12 08:53:30 EDT 2020

status width: fix for online streams with no known duration

--- a/zuke.c
+++ b/zuke.c
@@ -265,13 +265,13 @@
 
 	vlong msec = 0;
 	if(pcurplaying >= 0){
-		snprint(tmp, sizeof(tmp), "%s%P/%P 100%%",
-			shuffle != nil ? "∫ " : "",
-			getmeta(pcurplaying)->duration/1000,
-			getmeta(pcurplaying)->duration/1000);
-		w = stringwidth(f, tmp);
 		msec = byteswritten*1000/Bps;
 		if(getmeta(pcurplaying)->duration != 0){
+			snprint(tmp, sizeof(tmp), "%s%P/%P 100%%",
+				shuffle != nil ? "∫ " : "",
+				getmeta(pcurplaying)->duration/1000,
+				getmeta(pcurplaying)->duration/1000);
+			w = stringwidth(f, tmp);
 			msec = MIN(msec, getmeta(pcurplaying)->duration);
 			snprint(tmp, sizeof(tmp), "%s%P/%P %d%%",
 				shuffle != nil ? "∫ " : "",
@@ -280,6 +280,11 @@
 				volume);
 			seekmx = newseekmx;
 		}else{
+			snprint(tmp, sizeof(tmp), "%s%P %d%%",
+				shuffle != nil ? "∫ " : "",
+				getmeta(pcurplaying)->duration/1000,
+				100);
+			w = stringwidth(f, tmp);
 			snprint(tmp, sizeof(tmp), "%s%P %d%%",
 				shuffle != nil ? "∫ " : "",
 				(int)msec/1000,