shithub: zuke

Download patch

ref: c611a7b488e89d1ac3bd8698fff5580b5cea66c1
parent: 811526f2abc5687de350ec4df3bd1588ef9a9ab3
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Feb 29 16:20:11 EST 2016

mkplist: allow files without tags

--- a/mkplist.c
+++ b/mkplist.c
@@ -120,7 +120,7 @@
 static int
 scan(char **dir, int depth)
 {
-	char *path;
+	char *path, *s;
 	Dir *buf, *d;
 	long n;
 	int dirfd, len, flen;
@@ -166,10 +166,16 @@
 					fprint(2, "%s: %r\n", path);
 				else if((curr = newmeta()) == nil)
 					sysfatal("no memory");
-				else if(tagsget(&ctx) != 0){
-					fprint(2, "%s: no tags\n", path);
-					freemeta(curr);
-				}else{
+				else{
+					if(tagsget(&ctx) != 0)
+						fprint(2, "%s: no tags\n", path);
+					if(curr->title == nil){
+						path[len] = 0;
+						if((s = utfrrune(path, '/')) == nil)
+							s = &path[len];
+						path[len] = '/';
+						curr->title = strdup(s+1);
+					}
 					curr->path = strdup(path);
 					curr->duration = ctx.duration;
 					curr->samplerate = ctx.samplerate;