Implement author & topic filter for txt pull

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@7 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-06-18 20:45:45 +00:00
parent 57f82d4c8b
commit 58f4fb6883
2 changed files with 48 additions and 30 deletions

View File

@@ -68,6 +68,19 @@ let contains text = function
| id -> text.Text.id = id)
| _ -> prerr_endline ("Invalid record pattern"); false
let numof_texts pack = List.length (Msgpck.to_list pack.texts)
let iteri fn pack =
let of_pck i = function Msgpck.List (id::time::title::authors::topics::[]) ->
let t = match time with Msgpck.Int i -> Int32.of_int i | Msgpck.Uint32 i -> i
| x -> Msgpck.to_uint32 x in
let id = to_id id in
let title = Msgpck.to_string title in
let topics = to_str_list topics in
let authors = to_str_list authors in
fn i id t title authors topics
| _ -> prerr_endline ("\n\nInvalid record structure\n\n")
in List.iteri of_pck (Msgpck.to_list pack.texts);
(*let pack_filename ?(filename="index.pck") archive =*)
(* let dir = Store.KV.find "Export-Dir" archive.File_store.kv in (*raises Not_found*)*)