Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow importing from logfile #4379

Closed
Holzhaus opened this issue Jun 20, 2022 · 4 comments · Fixed by #4387
Closed

Allow importing from logfile #4379

Holzhaus opened this issue Jun 20, 2022 · 4 comments · Fixed by #4387
Labels
feature features we would like to implement

Comments

@Holzhaus
Copy link
Contributor

When importing large collections, it makes sense to do the automated import first, then do the manual part afterwards:

$ beet import -l skipped.log -q /path/to/library

It would be great if it was possible to continue the import using the logfile instead of a directory:

$ beet import skipped.log

Beets should be able to parse the logfile and call import on each directory that was skipped.

@Holzhaus
Copy link
Contributor Author

My current workaround:

$ grep -v "^import" missing.log | sed "s/^[a-z-]\+ //" | python <(cat << EOF
import sys
import os.path
for line in sys.stdin:
    print(os.path.commonpath(line.rstrip("\n").split("; ")))
EOF
) | xargs -d $'\n' beet import 

@antonellocaroli
Copy link

I use a sricpt sh for that:

date=$(date '+%Y%m%d' | cut -c 3-)

grep skip ~/.config/beets/import.log | sed 's/skip //' > ~/.config/beets/skipped_import.log

mv ~/.config/beets/import.log ~/.config/beets/import.log."$date"

manual_import() {
until [ ! -s ~/.config/beets/skipped_import.log ]
do
  chek=$(head -n 1 ~/.config/beets/skipped_import.log)
  beet import -CW "$chek" &&
  sed -i '1d' ~/.config/beets/skipped_import.log
done
}

manual_import

@wisp3rwind wisp3rwind added the feature features we would like to implement label Jun 20, 2022
@wisp3rwind
Copy link
Member

I'm pretty sure that a feature like this has been discussed before; but I can't find the issue right now.

@Holzhaus
Copy link
Contributor Author

Well, it looks like the log file format is intended to be machine-readable, so it's not really far-fetched to assume that such a feature was considered at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature features we would like to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants