feat(chroma): add chromasearch command#6486
feat(chroma): add chromasearch command#6486ShimmerGlass wants to merge 1 commit intobeetbox:masterfrom
Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
ac41f5a to
c146a5a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6486 +/- ##
==========================================
+ Coverage 70.06% 70.11% +0.04%
==========================================
Files 147 147
Lines 18562 18622 +60
Branches 3026 3038 +12
==========================================
+ Hits 13005 13056 +51
+ Misses 4924 4923 -1
- Partials 633 643 +10
🚀 New features to boost your workflow:
|
0469115 to
ad89644
Compare
snejus
left a comment
There was a problem hiding this comment.
Looks great. Would you mind adding a test?
There was a problem hiding this comment.
Pull request overview
grug see PR add new chroma plugin CLI command chromasearch to search local beets library by chromaprint fingerprint similarity, computing missing fingerprints on demand.
Changes:
- add
chromasearchsubcommand with--search,--count,--full, plus format/path output support - extend
fingerprint_itemwithquietflag to reduce logging in some paths - add small
TopN+ScoredItemhelper for keeping best matches
Comments suppressed due to low confidence (1)
beetsplug/chroma.py:436
- grug see fingerprint_item got quiet flag, but still log info for "no duration" and "fingerprinting" even when quiet=True. chromasearch pass quiet=True so grug expect less spam. grug think wrap these info logs with
if not quiet:too, or rename flag to say what it really do.
if not item.length:
log.info("{.filepath}: no duration available", item)
elif item.acoustid_fingerprint:
if not quiet:
if write:
log.info("{.filepath}: fingerprint exists, skipping", item)
else:
log.info("{.filepath}: using existing fingerprint", item)
return item.acoustid_fingerprint
else:
log.info("{.filepath}: fingerprinting", item)
try:
4e290d2 to
e04902b
Compare
|
@snejus answered comments and added tests! lmk what you think :) |
test/plugins/test_chroma.py
Outdated
| def test_chroma_search_exact(self, compare_fingerprints): | ||
| self.setup_lib() | ||
| compare_fingerprints.side_effect = self.compare_fingerprints | ||
|
|
||
| output = self.run_search(FINGERPRINT_2) | ||
| assert self.line_count(output) == 1 | ||
| assert TEST_TITLE_2 in output | ||
|
|
||
| output = self.run_search(FINGERPRINT_1) | ||
| assert self.line_count(output) == 1 | ||
| assert TEST_TITLE_1 in output | ||
|
|
||
| def test_chroma_search_close(self, compare_fingerprints): | ||
| self.setup_lib() | ||
| compare_fingerprints.side_effect = self.compare_fingerprints | ||
|
|
||
| output = self.run_search(FINGERPRINT_1_CLOSE) | ||
| assert self.line_count(output) == 2 | ||
| assert TEST_TITLE_1 in output.split("\n")[0] |
There was a problem hiding this comment.
Move tests below the setup methods to make it consistent with the rest of the tests.
4b4d8a1 to
5886db5
Compare
|
@snejus added docs and changelog :) |
This command lets user search the database by chromaprint fingerprint similarity. Database item fingerprints are computed on the fly if needed. This is useful for example to check if an unknown / untagged audio file already exists in the database.
5886db5 to
6049f1a
Compare
Description
Add a new command to the
chromaplugin:chromasearch.This command lets user search the database by chromaprint fingerprint similarity.
Database item fingerprints are computed on the fly if needed. This is useful for example to check if an unknown / untagged audio file already exists in the database.
Will update changelog and doc once naming & co are sorted.
To Do
docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)