repo: music
action: commit
revision: 
path_from: 
revision_from: bfbfc1994353c02fa1b055b8d0df7f9e90ebbab3:
path_to: 
revision_to: 
git.thebackupbox.net
music
git clone git://git.thebackupbox.net/music
commit bfbfc1994353c02fa1b055b8d0df7f9e90ebbab3
Author: epoch 
Date:   Thu Sep 3 23:17:52 2020 -0500

    id3sort now works for id3v1 and id3v2 tags. was broken for v1. also, now id3sort is in the makefile install target

diff --git a/Makefile b/Makefile
index 8e8599f743061b07c15e6ee20182b537acb2ac9c..
index ..114963377394822798bf4f40b3cd8542afff88e3 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ clean:
 icy-metadata: icy-metadata.c

 install: all
+	install id3sort	$(PREFIX)/bin/
 	install qargs $(PREFIX)/bin/
 	install music-player $(PREFIX)/bin/
 	install music-playpause $(PREFIX)/bin/
diff --git a/id3sort b/id3sort
index f37a53393bf870c8af847eea2572f405415ca937..
index ..009a4550ac9c8e05d05a7e501b1110db4a19df77 100755
--- a/id3sort
+++ b/id3sort
@@ -1,8 +1,10 @@
-#!/bin/sh
-id3v2 -R "$@" \
-  | egrep '^File|TRCK' \
-  | cut '-d ' -f2- \
+#!/bin/bash
+### this is done this way so it works with both v1 and v2
+id3v2 -l "$@" \
+  | egrep '^id3v2 tag info for |^Comment:|^/' \
+  | sed 's/^.* Track: //g' \
+  | sed 's|id3v2 tag info for \(.*\):$|\1|g' \
+  | sed 's/: No ID3v2 tag$//g' \
   | paste - - \
-  | tr '\t' ':' \
-  | sort -t: -n -k2 \
-  | cut -d: -f1
+  | sort -t$'\t' -n -k1 \
+  | cut -f2

-----END OF PAGE-----