shithub: zuke

Download patch

ref: 09382d6f208f24076988e6ae69146adc185ab53a
parent: dd231a1c06f2da190f5d29f3f2aa01323600d1af
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Thu Mar 4 09:47:54 EST 2021

add "basename" column, put it into "title" column if track has none, and no path nor basename column is showing

--- a/README.md
+++ b/README.md
@@ -12,6 +12,12 @@
  * good metadata support
  * basic livestreams (ie IceCast) support
 
+## 2020/03/04
+
+The module music decoder of choice is now [audio/moddec, a port of
+DUMB](https://git.sr.ht/~ft/dumb`).  Please install it if you want to
+continue playing those mods.
+
 ## 2020/12/22
 
 New playlist format.  Zuke still will load old format and you can
@@ -68,7 +74,7 @@
 
 To play opus, visit [this](http://nopenopenope.net/posts/audcomp).
 
-To play ImpulseTracker mods, install [itdec](https://git.sr.ht/~ft/itdec).
+To play music mods, install [audio/moddec](https://git.sr.ht/~ft/dumb).
 
 ## Theme
 
@@ -89,11 +95,12 @@
 
 	A  artist
 	a  album
+	b  file basename
 	t  title
 	D  duration
 	d  date
 	T  track number
-	p  file path
+	p  full file path
 
 With `-s` zuke will start in shuffled mode.
 
--- a/mkplist.c
+++ b/mkplist.c
@@ -28,8 +28,8 @@
 	[Fm4a] = "m4a",
 	[Fopus] = "opus",
 	[Fwav] = "wav",
-	[Fit] = "it",
-	[Fxm] = "xm",
+	[Fit] = "mod",
+	[Fxm] = "mod",
 };
 
 static Meta *
--- a/plist.h
+++ b/plist.h
@@ -13,6 +13,7 @@
 
 	Palbum=			'a',
 	Partist=		'A',
+	Pbasename=		'b',
 	Pdate=			'd',
 	Pduration=		'D',
 	Pimage=			'i',
@@ -38,6 +39,7 @@
 	char *date;
 	char *track;
 	char *path;
+	char *basename;
 	char *imagefmt;
 	char *filefmt;
 	uvlong duration;
--- a/zuke.c
+++ b/zuke.c
@@ -68,9 +68,10 @@
 static Channel *playc;
 static Mousectl *mctl;
 static Keyboardctl *kctl;
-static int colwidth[7];
-static int mincolwidth[7];
+static int colwidth[10];
+static int mincolwidth[10];
 static char *cols = "AatD";
+static int colspath;
 static int *shuffle;
 static Rectangle seekbar;
 static int seekmx, newseekmx = -1;
@@ -149,7 +150,7 @@
 	case Palbum: return m->album;
 	case Partist: return m->artist[0];
 	case Pdate: return m->date;
-	case Ptitle: return m->title;
+	case Ptitle: return (!colspath && *m->title == 0) ? m->basename : m->title;
 	case Ptrack: snprint(tmp, sizeof(tmp), "%4s", m->track); return m->track ? tmp : nil;
 	case Ppath: return m->path;
 	case Pduration:
@@ -190,7 +191,10 @@
 			n++;
 		}
 	}
+	colspath = 0;
 	for(i = 0; cols[i] != 0; i++){
+		if(cols[i] == Ppath || cols[i] == Pbasename)
+			colspath = 1;
 		if(cols[i] == Pduration || cols[i] == Pdate || cols[i] == Ptrack)
 			colwidth[i] = mincolwidth[i];
 		else
@@ -752,7 +756,7 @@
 static Playlist *
 readplistnew(char *raw)
 {
-	char *s, *e, *a[5];
+	char *s, *e, *a[5], *b;
 	Playlist *pl;
 	int plsz;
 	Meta *m;
@@ -800,9 +804,12 @@
 		case Pfilefmt: m->filefmt = s; break;
 		case Palbum:   m->album = s; break;
 		case Pdate:    m->date = s; break;
-		case Ppath:    m->path = s; break;
 		case Ptitle:   m->title = s; break;
 		case Ptrack:   m->track = s; break;
+		case Ppath:
+			m->path = s;
+			m->basename = (b = utfrrune(s, '/')) == nil ? s : b+1;
+			break;
 		}
 	}
 	if(m != nil && m->path != nil)
@@ -816,7 +823,7 @@
 {
 	Meta *m;
 	Playlist *pl;
-	char *s, *e, *endrec;
+	char *s, *b, *e, *endrec;
 	int i, n, sz, alloc, tagsz, intval;
 
 	s = nil;
@@ -905,6 +912,7 @@
 				s = e + 1;
 			}else if(s[0] == Ppath){
 				m->path = s+2;
+				m->basename = (b = utfrrune(m->path, '/')) == nil ? m->path : b+1;
 				break; /* always the last one */
 			}else if(s[0] == Pfilefmt){
 				m->filefmt = s+2;