rls-discogs/README.md

77 lines
2.6 KiB
Markdown
Raw Normal View History

2022-03-26 20:04:42 -04:00
# rls-discogs
2022-03-26 20:50:13 -04:00
scene release to discogs release
# using
- [fish](https://fishshell.com/)
- [discogs-xml-to-elasticsearch](https://github.com/SuperToma/discogs-xml-to-elasticsearch)
- [curl](https://curl.se/)
- [jq](https://stedolan.github.io/jq/)
- [websocat](https://github.com/vi/websocat)
# flow
scene rls name > parse > artist / title / year as .tsv > search discogs > .json
# tools
- `in-ws-predb.ovh.sh` read scene release names from predb websocket
- `parse-rls.fish` parse scene release name
- `search-discogs-api.fish` search discogs release using Discogs REST API
- `search-discogs-elastic.fish` search discogs release using ElasticSearch
2022-03-27 19:21:52 -04:00
- `search-deezer-api.fish` search for album with Deezer REST API
2022-03-26 20:50:13 -04:00
- `out-fallback.jq` fallback search helper
- `out-ids.jq` filter ids from json output
- `out-simple.jq` filter genre from json output
# usage
parse rls name as tab separated values
2022-03-26 20:56:30 -04:00
```sh
2022-03-26 20:50:13 -04:00
$ echo 'Kraftwerk-Autobahn-Remastered-CD-FLAC-2009-BCC' | ./parse-rls.fish | column -t -s "$(printf '\t')"
Kraftwerk-Autobahn-Remastered-CD-FLAC-2009-BCC Kraftwerk Autobahn CD Remastered 2009
```
parse rls name as json
2022-03-26 20:56:30 -04:00
```sh
2022-03-26 20:50:13 -04:00
$ echo 'Kraftwerk-Autobahn-Remastered-CD-FLAC-2009-BCC' | ./parse-rls.fish -j | jq .
{
"artist": "Kraftwerk",
"barcode": null,
"catno": null,
"edition": "Remastered",
"format": "CD",
"rls": "Kraftwerk-Autobahn-Remastered-CD-FLAC-2009-BCC",
"title": "Autobahn",
"year": "2009"
}
```
parse rls name, search local ElasticSearch, output discogs ids
2022-03-26 20:56:30 -04:00
```sh
2022-03-26 20:50:13 -04:00
$ echo 'Kraftwerk-Autobahn-Remastered-CD-FLAC-2009-BCC' | ./parse-rls.fish | ./search-discogs-elastic.fish | ./out-ids.jq
{"artist_id":4654,"master_id":2994,"release_id":1966322,"rls":"Kraftwerk-Autobahn-Remastered-CD-FLAC-2009-BCC"}
```
get rls names from websocket, parse rls name, search with api.discogs.com, write .json
2022-03-26 20:56:30 -04:00
```sh
$ ./in-ws-predb.ovh.sh | ./parse-rls.fish | search-discogs-api.fish > out.api.json
2022-03-26 20:50:13 -04:00
```
parse rls name, search local ElasticSearch, write json, filter empty results and convert json to tsv, fallback search with Discogs API, write json
2022-03-26 20:56:30 -04:00
```sh
2022-03-26 21:03:43 -04:00
$ echo 'Band_Of_Horses-Things_Are_Great-CD-2022-FATHEAD' | ./parse-rls.fish | ./search-discogs-elastic.fish | \
tee out.es.json | ./out-fallback.jq | ./search-discogs-api.fish > out.api.json
2022-03-26 20:50:13 -04:00
$ jq ._search_result_count out.es.json out.api.json
0
1
```
2022-03-27 19:21:52 -04:00
With fish shell:
parse rls names from local folder, search Deezer, filter cover URL, download cover image into local folder
```sh
ls -1 /path/ | ./parse-rls.fish | ./search-deezer-api.fish | ./out-deezer-cover.jq | while read -l RLS COVER ; if not test -f "/path/$RLS/cover.jpg"; curl -s -o "/path/$RLS/cover.jpg" "$COVER"; end; end
```