Difegue / LANraragi

Web application for archival and reading of manga/doujinshi. Lightweight and Docker-ready for NAS/servers.
https://lrr.tvc-16.science
MIT License
2.23k stars 158 forks source link

[API] Support search by filename #1044

Open Fmajor opened 3 months ago

Fmajor commented 3 months ago

Now the /api/search API seems to search in the title and tags field. Can you support search by the filename field (or add a new parameters fields to control which fields to use for search)

Difegue commented 3 months ago

the filename field isn't really meant to be exposed.. it's just saved as raw bytes in the database to avoid having to care about filesystem encoding.

What are you trying to do where filename searches would help ?

Fmajor commented 3 months ago

the filename field isn't really meant to be exposed.. it's just saved as raw bytes in the database to avoid having to care about filesystem encoding.

What are you trying to do where filename searches would help ?

filename is the unique indicator for one item in the file system. I have custom scripts to download things and then tar them to the data folder of LANraragi, and then update metatdatas of these files. I need to known the maps between arcid and filename, so that my pipeline can work.

Now the default title is the filename, but after I update the title from some metadata source, I completely lost the map between one item and its conresponding file.

e.g., I want to force update metadata of a item (by providing its filename)

gustaavv commented 3 months ago

I am in a similar situation like you, where I use scripts to automatically update the metadata.

Currently, there are no maps between arcid and filename.

The archive IDs computed by LRR are created by taking the first 512KBs of the file, and computing a SHA-1 hash from this data.

If you don't have the same archives in different paths, you can calculate the arcid of an archive on the client side, which will always be the correct one.

Difegue commented 3 months ago

Yeah I was going to recommend the same, calculating the IDs yourself is probably the easiest path forward here.
I'll still keep this issue open for tracking 👍

vuhe commented 2 months ago

Since custom scripts can directly access files through paths, they should be deployed locally in LRR.

If you need to know the mapping between arc_id and path, you can also try accessing Redis directly to obtain information. Reading only data should not affect LRR.