rg caching, improved display
This commit is contained in:
@@ -2,6 +2,7 @@ CACHEDIR="$HOME/.cache/$APP_NAME"
|
||||
[ -d "$CACHEDIR" ] || mkdir "$CACHEDIR"
|
||||
|
||||
artist_mb_filename="musicbrainz.json"
|
||||
artist_mb_releasegroups_filename="releasegroups.json"
|
||||
artist_discogs_filename="discogs.json"
|
||||
artist_wikidata_filename="wikidata.json"
|
||||
artist_enwikipedia_filename="enwikipedia.json"
|
||||
@@ -40,6 +41,12 @@ cache_get_artist_mb() {
|
||||
__get_artist_json "$1" "$artist_mb_filename"
|
||||
}
|
||||
|
||||
# Returns the cached MusicBrainz release-group data for the artist given by the
|
||||
# MusicBrainz Artist ID in $1
|
||||
cache_get_artist_mb_releasegroups() {
|
||||
__get_artist_json "$1" "$artist_mb_releasegroups_filename"
|
||||
}
|
||||
|
||||
# Returns the cached Discogs data for the artist given by the MusicBrainz
|
||||
# Artist ID in $1
|
||||
cache_get_artist_discogs() {
|
||||
@@ -62,6 +69,23 @@ cache_put_artist_mb() {
|
||||
cat | __put_artist_json "$1" "$artist_mb_filename"
|
||||
}
|
||||
|
||||
# Read from stdin the MusicBrainz release-group data for the artist given by
|
||||
# the MusicBrainz Artist ID in $1, and cache it.
|
||||
cache_put_artist_mb_releasegroups() {
|
||||
cat | __put_artist_json "$1" "$artist_mb_releasegroups_filename"
|
||||
}
|
||||
|
||||
# Read from stdin the MusicBrainz release-group data for the artist given by
|
||||
# the MusicBrainz Artist ID in $1, and append it to the current cache.
|
||||
cache_append_artist_mb_releasegroups() {
|
||||
tmpf=$(mktemp)
|
||||
cat >"$tmpf"
|
||||
updated=$(mktemp)
|
||||
f="$CACHEDIR/$1/$artist_mb_releasegroups_filename"
|
||||
$JQ -r --slurpfile n "$tmpf" '."release-groups" += ($n[0]|."release-groups")' "$f" >"$updated" && mv "$updated" "$f"
|
||||
rm -f "$tmpf"
|
||||
}
|
||||
|
||||
# Read from stdin the Discogs data for the artist given by the MusicBrainz
|
||||
# Artist ID in $1, and cache it.
|
||||
cache_put_artist_discogs() {
|
||||
|
Reference in New Issue
Block a user