{"id":541,"date":"2024-12-08T00:54:43","date_gmt":"2024-12-07T22:54:43","guid":{"rendered":"https:\/\/grummfy.be\/blog\/?p=541"},"modified":"2024-12-08T00:54:43","modified_gmt":"2024-12-07T22:54:43","slug":"recherche-depub-watermarker","status":"publish","type":"post","link":"https:\/\/grummfy.be\/blog\/541","title":{"rendered":"Recherche d&rsquo;epub watermarker"},"content":{"rendered":"\n<p>Pour un besoin r\u00e9cent, j&rsquo;avais besoin de retrouver tout les epub que j&rsquo;avais acheter chez un vendeur d&rsquo;epub qui n&rsquo;existe plus (feedbooks). Du coup, j&rsquo;ai fait un script pour aller chercher dans ma biblioth\u00e8que. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nif &#91; $# -lt 2 ]\nthen\n\techo\n\techo \"Usage: ${0} &lt;path-to-epub-directory (aka calibre root biblio)> &lt;name to search>\"\n\techo \"export VERBOSE=1 to add verbosity or VERBOSE=1 ${0} ...\"\n\techo\n\texit\nfi\n\nCUR_DIR=$(dirname \"$0\")\nPATH_TO_SEARCH=$1\nPATTERN_TO_SEARCH=$2\n\necho \"Searching in ${PATH_TO_SEARCH} about ${PATTERN_TO_SEARCH}...\"\n\nmapfile FILES &lt; &lt;(find \"$PATH_TO_SEARCH\" -type f -name '*.epub')\n\nN=\"${#FILES&#91;@]}\"\n\necho \"... found ${N} epubs!\"\n\nfor ((I=0; I&lt;N; I++))\ndo\n\tepub_file=$(echo \"${CUR_DIR}\/${FILES&#91;$I]}\" | sed 's\/\\n\/\/')\n\tfileloc=$(unzip -l \"${epub_file}\" | grep -o 'OEBPS\/.*.xhtml')\n\tfound=0\n\tfor xhtml in $fileloc\n\tdo\n\t\tmetafound=$(zipgrep \"${PATTERN_TO_SEARCH}\" \"${epub_file}\" \"${xhtml}\")\n\t\tif &#91; \"$metafound\" != \"\" ]; then\n\t\t\t# display only once that we have found it\n\t\t\tif &#91;&#91; \"$found\" -eq \"0\" ]]; then\n\t\t\t\techo \"Found in ${epub_file}\"\n\t\t\tfi\n\n\t\t\tfound=1\n\t\t\tif &#91;&#91; \"$VERBOSE\" -eq \"1\" ]]; then\n\t\t\t\tprintf \"\\t|_ %s\\n\" \"$metafound\"\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tfi\n\t\tfi\n\tdone\ndone\n\necho\necho 'EOL'\necho\nexit\n<\/code><\/pre>\n\n\n\n<p>On ne sait jamais que cela vous serve<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pour un besoin r\u00e9cent, j&rsquo;avais besoin de retrouver tout les epub que j&rsquo;avais acheter chez un vendeur d&rsquo;epub qui n&rsquo;existe plus (feedbooks). Du coup, j&rsquo;ai fait un script pour aller chercher dans ma biblioth\u00e8que. On ne sait jamais que cela vous serve<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-general"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":1,"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":542,"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions\/542"}],"wp:attachment":[{"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grummfy.be\/blog\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}