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

Ignore paths that begin with underscore #73

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

nytamin
Copy link
Contributor

@nytamin nytamin commented Jan 22, 2024

The problem:

I continously get a LOT of error messages in the log, on the form Only reserved document ids may start with underscore..

{"level":50,"time":1705906640456,"pid":25528,"hostname":"NYTAMIN-STATION4","name":"scanner","err":{"type":"PouchError","message":"Only reserved document ids may start with underscore.","st
ack":"Error\n    at new CustomPouchError (C:\\git\\media-scanner\\node_modules\\pouchdb-node\\lib\\index.js:656:21)\n    at createError (C:\\git\\media-scanner\\node_modules\\pouchdb-node\
\lib\\index.js:665:10)\n    at invalidIdError (C:\\git\\media-scanner\\node_modules\\pouchdb-node\\lib\\index.js:794:11)\n    at PouchDB.<anonymous> (C:\\git\\media-scanner\\node_modules\\
pouchdb-node\\lib\\index.js:1754:3)\n    at PouchDB.<anonymous> (C:\\git\\media-scanner\\node_modules\\pouchdb-node\\lib\\index.js:290:21)\n    at PouchDB.<anonymous> (C:\\git\\media-scann
er\\node_modules\\argsarray\\index.js:14:18)\n    at C:\\git\\media-scanner\\node_modules\\pouchdb-node\\lib\\index.js:229:21\n    at new Promise (<anonymous>)\n    at PouchDB.<anonymous>
(C:\\git\\media-scanner\\node_modules\\pouchdb-node\\lib\\index.js:216:19)\n    at PouchDB.put (C:\\git\\media-scanner\\node_modules\\argsarray\\index.js:14:18)","status":400,"name":"bad_r
equest","error":true},"msg":"Only reserved document ids may start with underscore."}

Because I have a folder structure with folders that begin with underscore: /media/_oldClips/clip.mp4

The fix

A simple quick fix:
Ignore any ids that begin with underscore, since they cannot be stored in PouchDB anyway, so this should result in no changes in the data written to the DB.

Caveat

This works for me, since I mark folders with underscore in order to ignore them anyway.

But if anyone in the future wishes to scan folders with names that begin with underscore, we could instead change how we generate the ID into a hash (but that's for a later PR).

src/scanner.ts Outdated Show resolved Hide resolved
src/scanner.ts Outdated Show resolved Hide resolved
Copy link
Member

@Julusian Julusian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about this being a breaking change, but as it fails to save them I agree that this is a minor fix.

we could instead change how we generate the ID into a hash

tbh, I want to replace pouchdb at some point anyway, which could end up fixing this in another way #72

nytamin and others added 2 commits January 22, 2024 13:47
Co-authored-by: Julian Waller <git@julusian.co.uk>
@Julusian Julusian merged commit b5c979d into CasparCG:master Jan 22, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants