minor iprv
This commit is contained in:
22
src/main.sh
22
src/main.sh
@@ -53,10 +53,16 @@ if [ "${1:-}" = "--internal-search" ]; then
|
|||||||
[ ! "${2}" ] && exit 0
|
[ ! "${2}" ] && exit 0
|
||||||
# Save current pid
|
# Save current pid
|
||||||
echo "$$" >"$PIDFILE"
|
echo "$$" >"$PIDFILE"
|
||||||
sleep 1
|
|
||||||
touch "$LOCKFILE"
|
touch "$LOCKFILE"
|
||||||
__api_mb_search_artists "$2" |
|
__api_mb_search_artists "$2" |
|
||||||
$JQ -r '.artists[] | [.id, .type, .name, .disambiguation, .["life-span"].begin, .["life-span"].end] | join("\t")' |
|
$JQ -r '.artists[] | [
|
||||||
|
.id,
|
||||||
|
.type,
|
||||||
|
.name,
|
||||||
|
.disambiguation,
|
||||||
|
.["life-span"].begin,
|
||||||
|
.["life-span"].end
|
||||||
|
] | join("\t")' |
|
||||||
awk \
|
awk \
|
||||||
-F "\t" \
|
-F "\t" \
|
||||||
-v format_person="$FORMAT_PERSON" \
|
-v format_person="$FORMAT_PERSON" \
|
||||||
@@ -69,6 +75,14 @@ if [ "${1:-}" = "--internal-search" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${1:-}" = "--internal-list-releases-fresh" ]; then
|
||||||
|
artistid="$2"
|
||||||
|
cache_delete_artist "$artistid"
|
||||||
|
shift 2
|
||||||
|
set -- "--internal-list-releases" "$artistid"
|
||||||
|
mb_artist "$artistid" >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${1:-}" = "--internal-list-releases" ]; then
|
if [ "${1:-}" = "--internal-list-releases" ]; then
|
||||||
__api_mb_browse_release_groups "$2" |
|
__api_mb_browse_release_groups "$2" |
|
||||||
$JQ -r '."release-groups"[] | [
|
$JQ -r '."release-groups"[] | [
|
||||||
@@ -142,10 +156,12 @@ while true; do
|
|||||||
$FZF \
|
$FZF \
|
||||||
--ansi \
|
--ansi \
|
||||||
--reverse \
|
--reverse \
|
||||||
|
--cycle \
|
||||||
--delimiter="\t" \
|
--delimiter="\t" \
|
||||||
--prompt="$(printf "$ARTIST_PROMPT" "$name")" \
|
--prompt="$(printf "$ARTIST_PROMPT" "$name")" \
|
||||||
--accept-nth="{2}" \
|
--accept-nth="{2}" \
|
||||||
--with-nth="{1}"
|
--with-nth="{1}" \
|
||||||
|
--bind="ctrl-r:reload:$0 --internal-list-releases-fresh \"$2\""
|
||||||
)
|
)
|
||||||
[ "$sel" ] && set -- "--show-release" "$sel"
|
[ "$sel" ] && set -- "--show-release" "$sel"
|
||||||
;;
|
;;
|
||||||
|
@@ -27,6 +27,13 @@ __put_artist_json() {
|
|||||||
[ -s "$tmpf" ] && mv "$tmpf" "$f" || printf "{}" >"$f"
|
[ -s "$tmpf" ] && mv "$tmpf" "$f" || printf "{}" >"$f"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Delete all cache associated to the given artist
|
||||||
|
# argument $1: MusicBrainz Artist ID
|
||||||
|
cache_delete_artist() {
|
||||||
|
artistdir="$CACHEDIR/$1"
|
||||||
|
rm -rf "$artistdir"
|
||||||
|
}
|
||||||
|
|
||||||
# Returns the cached MusicBrainz data for the artist given by the MusicBrainz
|
# Returns the cached MusicBrainz data for the artist given by the MusicBrainz
|
||||||
# Artist ID in $1
|
# Artist ID in $1
|
||||||
cache_get_artist_mb() {
|
cache_get_artist_mb() {
|
||||||
|
Reference in New Issue
Block a user