feat: only show recent additions to library by default

This commit is contained in:
Paul Campbell 2024-12-02 19:43:22 +00:00
parent f98f175974
commit 40141e0c0b
2 changed files with 31 additions and 5 deletions

View file

@ -92,6 +92,9 @@ just fetch-library
This will create a new file `library-{date}.txt`, that contains a list of everything available in your account.
On subsequent runs (on a different day!) it will create a file `library-recent.txt` that contains any new additions to your
library since the previous run.
### Select, download and convert
The recommended workflow is to run the default recipe which will present you with a searchable list of your library.
@ -99,6 +102,16 @@ From here you can select items to download by pressing `TAB` (for selecting mutl
```shell
just
# or
just select-download-recent
```
This will use the `library-recent.txt` file, showing only new additions to your library.
To select from your full library:
```shell
just select-download-full
```
Once you have made your selection, the `.aax` and/or `.aaxc/.voucher` files will be downloaded, via a `./TEMP/` directory,

View file

@ -1,4 +1,4 @@
default: select-download convert refile
default: select-download-recent convert refile
@tree M4B/
doctor:
@ -17,9 +17,15 @@ _doc_require_exec exec:
echo "- OKAY : {{ exec }} => ${EXEC}"
fi
select-download:
select-download-recent:
just select-download library-recent.txt
select-download-full:
just select-download $(just latest-library)
select-download library:
#!/usr/bin/env bash
SELECTION=$(cat $(just latest-library) | sort -k 2 | fzf -e -m)
SELECTION=$(cat {{library}} | sort -k 2 | fzf -e -m)
ASINS=""
while IFS= read -r LINE ; do
echo "$LINE"
@ -30,10 +36,17 @@ select-download:
just _download-asin $ASINS
fetch-library:
audible library list > library-$(date +%Y-%m-%d).txt
#!/usr/bin/env bash
set -e
PREVIOUS=$(just latest-library)
audible library list | sort > library-$(date +%Y-%m-%d).txt
CURRENT=$(just latest-library)
comm -23 $CURRENT $PREVIOUS > library-recent.txt
echo "New additions:"
cat library-recent.txt
@latest-library:
ls library-*.txt | tail -n 1
ls library-*.txt | grep -v recent | tail -n 1
_require_dir *dirs:
mkdir {{ dirs }} 2>/dev/null || true