-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: music action: commit revision: path_from: revision_from: 23b4da80a0fa86a5b7808c75e64be05ba4b24b35: path_to: revision_to:
commit 23b4da80a0fa86a5b7808c75e64be05ba4b24b35 Author: epoch <epoch@enzo.thebackupbox.net> Date: Sat Nov 13 01:51:10 2021 +0000 lots of changes. see previous commit diff --git a/music-fileinfo b/music-fileinfo
--- a/music-fileinfo +++ b/music-fileinfo @@ -1,34 +1,71 @@ #!/bin/bash -ext="$(printf "$1" | rev | cut -d. -f1 | rev)" -l="$(music-length "$1" | cut -d. -f1)" +if [ -e "${1}.id3" ];then + meta="${1}.id3" +else + file="${1}" + meta="${1}" +fi +ext="$(printf "$file" | rev | cut -d. -f1 | rev)" +l="$(music-length "$file" | cut -d. -f1)" if grep : <<< "$l" >/dev/null ;then song_length="$l" else - song_length="$(elapsedtime -s $(music-length "$1" | cut -d. -f1))" + if [ "$l" ];then + song_length="$(elapsedtime -s $(music-length "$file" | cut -d. -f1))" + fi +fi + +if [ -f "${PREFIX}/run/music/player.pid" ];then + length="$(elapsedtime -s $[$(date +%s) - $(stat -c %Z "/proc/$(cat "${PREFIX}/run/music/player.pid")")])/${song_length}" +else + if [ "${song_length}" ];then + length="[???/${song_length}]" + else + length="" + fi fi -length="$(elapsedtime -s $[$(date +%s) - $(stat -c %Z "/proc/$(cat "${PREFIX}/run/music/player.pid")")])/${song_length}" -if [ "$ext" = "mp3" ];then - data="$(id3v2 -R "$1")" + + +if [ "$meta" != "$file" ];then + data="$(id3v2 -R "$meta")" #echo $data artist="$(printf "%s\n" "$data" | grep '^TPE1: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" title="$(printf "%s\n" "$data" | grep '^TIT2: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" album="$(printf "%s\n" "$data" | grep '^TALB: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" year="$(printf "%s\n" "$data" | grep '^TYER: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" -fi -if [ "$ext" = "flac" ];then - artist="$(metaflac --show-tag=artist "$1" | cut -d= -f2-)" - title="$(metaflac --show-tag=title "$1" | cut -d= -f2-)" - album="$(metaflac --show-tag=album "$1" | cut -d= -f2-)" - year="$(metaflac --show-tag=date "$1" | cut -d= -f2-)" -fi -if [ "$ext" = "ogg" ];then - artist="$(vorbiscomment "$1" | grep "^ARTIST=" | cut -d= -f2-)" - title="$(vorbiscomment "$1" | grep "^TITLE=" | cut -d= -f2-)" - album="$(vorbiscomment "$1" | grep "^ALBUM=" | cut -d= -f2-)" - year="$(vorbiscomment "$1" | grep "^DATE=" | cut -d= -f2-)" +else + if [ "$ext" = "mp3" ];then + data="$(id3v2 -R "$meta")" + #echo $data + artist="$(printf "%s\n" "$data" | grep '^TPE1: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" + title="$(printf "%s\n" "$data" | grep '^TIT2: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" + album="$(printf "%s\n" "$data" | grep '^TALB: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" + year="$(printf "%s\n" "$data" | grep '^TYER: ' | cut '-d ' -f2- | tr -s ' ' | sed 's/^ *//g;s/ *$//g')" + fi + if [ "$ext" = "flac" ];then + artist="$(metaflac --show-tag=artist "$file" | cut -d= -f2-)" + title="$(metaflac --show-tag=title "$file" | cut -d= -f2-)" + album="$(metaflac --show-tag=album "$file" | cut -d= -f2-)" + year="$(metaflac --show-tag=date "$file" | cut -d= -f2-)" + fi + if [ "$ext" = "ogg" ];then + artist="$(vorbiscomment "$file" | grep "^ARTIST=" | cut -d= -f2-)" + title="$(vorbiscomment "$file" | grep "^TITLE=" | cut -d= -f2-)" + album="$(vorbiscomment "$file" | grep "^ALBUM=" | cut -d= -f2-)" + year="$(vorbiscomment "$file" | grep "^DATE=" | cut -d= -f2-)" + fi fi if [ "$artist" -a "$title" -a "$album" -a "$year" ];then printf '"%s" by %s on %s (%s) [%s]\n' "$title" "$artist" "$album" "$year" "$length" +elif [ "$artist" -a "$title" -a "$year" ];then + printf '"%s" by %s (%s) [%s]\n' "$title" "$artist" "$year" "$length" +elif [ "$artist" -a "$title" ];then + printf '"%s" by %s [%s]\n' "$title" "$artist" "$length" else - printf "%s [%s]\n" "$(printf "%s\n" "$1" | sed "s|$HOME/Music/||")" "$length" + printf "%s [%s]" "$(printf "%s\n" "$file" | sed "s|$HOME/Music/||")" "$length" + if [ "$artist$title$album$year" ];then + echo "misc metadata:" "$artist" "$title" "$album" "$year" + else + echo + fi fi
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 17:34:56 2024