diff options
Diffstat (limited to 'operators')
| -rw-r--r-- | operators/callback_tags.zsh | 17 | ||||
| -rw-r--r-- | operators/command_source.zsh | 1 | ||||
| -rw-r--r-- | operators/inline_search.zsh | 26 | ||||
| -rw-r--r-- | operators/url_parser.zsh | 33 |
4 files changed, 37 insertions, 40 deletions
diff --git a/operators/callback_tags.zsh b/operators/callback_tags.zsh index 803c0dd..a2cda2c 100644 --- a/operators/callback_tags.zsh +++ b/operators/callback_tags.zsh @@ -26,17 +26,16 @@ then return fi -ib_file_size="$(jq -r ".${ib_iarray}[0].${ib_isize}" "${ib_file}")" -ib_file_url="$(jq -r ".${ib_iarray}[0].${ib_ifile}" "${ib_file}")" -ib_sample_url="$(jq -r ".${ib_iarray}[0].${ib_isample}" "${ib_file}")" -ib_preview_url="$(jq -r ".${ib_iarray}[0].${ib_ipreview}" "${ib_file}")" -ib_width="$(jq -r ".${ib_iarray}[0].${ib_iwidth}" "${ib_file}")" -ib_height="$(jq -r ".${ib_iarray}[0].${ib_iheight}" "${ib_file}")" -ib_tags=($(jq -r ".${ib_iarray}[0].${ib_itags}" "${ib_file}")) +ib_file_size="$(jq -r ".[0].${ib_isize}" "${ib_file}")" +ib_file_url="$(jq -r ".[0].${ib_ifile}" "${ib_file}")" +ib_sample_url="$(jq -r ".[0].${ib_isample}" "${ib_file}")" +ib_preview_url="$(jq -r ".[0].${ib_ipreview}" "${ib_file}")" +ib_width="$(jq -r ".[0].${ib_iwidth}" "${ib_file}")" +ib_height="$(jq -r ".[0].${ib_iheight}" "${ib_file}")" +ib_tags=($(jq -r ".[0].${ib_itags}" "${ib_file}")) ib_groups_offset=${1:-0} ib_tags_offset=${1:-0} -source "${units}/ib_size.zsh" source "${units}/ib_meta.zsh" if [[ -z "${ib_tags}" || "${ib_tags}" == "null" ]] @@ -49,7 +48,7 @@ fi while [[ ${#ib_groups} -ge 2 ]] do - ib_group_tags=($(jq -r ".${ib_iarray}[0].${ib_groups[1]}" "${ib_file}" | htmlescape)) + ib_group_tags=($(jq -r ".[0].${ib_groups[1]}" "${ib_file}" | htmlescape)) ib_group_name="${ib_groups[2]}" if [[ -z "${ib_group_tags}" || "${ib_group_tags}" == "null" ]] diff --git a/operators/command_source.zsh b/operators/command_source.zsh index e22b6aa..347fe28 100644 --- a/operators/command_source.zsh +++ b/operators/command_source.zsh @@ -40,7 +40,6 @@ fi booru_table=( danbooru_id d "Danbooru" - gelbooru_id g "Gelbooru" idol_id i "Idol Complex" konachan_id k "Konachan.com" sankaku_id s "Sankaku Channel" diff --git a/operators/inline_search.zsh b/operators/inline_search.zsh index 5c3a755..f32f456 100644 --- a/operators/inline_search.zsh +++ b/operators/inline_search.zsh @@ -94,26 +94,26 @@ then return fi -ib_ids=("${(@f)$(jq -r ".${ib_iarray}[].${ib_iid}" "${ib_file}")}") +ib_ids=("${(@f)$(jq -r ".[].${ib_iid}" "${ib_file}")}") case "${ib_mode}" in (l) - ib_created_ats=("${(@f)$(jq -r ".${ib_iarray}[].${ib_icreated}" "${ib_file}")}") - ib_pools=("${(@f)$(jq -r ".${ib_iarray}[].${ib_ipool}" "${ib_file}")}") - ib_counts=("${(@f)$(jq -r ".${ib_iarray}[].${ib_icount}" "${ib_file}")}") + ib_created_ats=("${(@f)$(jq -r ".[].${ib_icreated}" "${ib_file}")}") + ib_pools=("${(@f)$(jq -r ".[].${ib_ipool}" "${ib_file}")}") + ib_counts=("${(@f)$(jq -r ".[].${ib_icount}" "${ib_file}")}") ;; (p) - ib_created_ats=("${(@f)$(jq -r ".${ib_iarray}[].${ib_icreated}" "${ib_file}")}") - ib_file_sizes=("${(@f)$(jq -r ".${ib_iarray}[].${ib_isize}" "${ib_file}")}") - ib_file_urls=("${(@f)$(jq -r ".${ib_iarray}[].${ib_ifile}" "${ib_file}")}") - ib_sample_urls=("${(@f)$(jq -r ".${ib_iarray}[].${ib_isample}" "${ib_file}")}") - ib_preview_urls=("${(@f)$(jq -r ".${ib_iarray}[].${ib_ipreview}" "${ib_file}")}") - ib_widths=("${(@f)$(jq -r ".${ib_iarray}[].${ib_iwidth}" "${ib_file}")}") - ib_heights=("${(@f)$(jq -r ".${ib_iarray}[].${ib_iheight}" "${ib_file}")}") + ib_created_ats=("${(@f)$(jq -r ".[].${ib_icreated}" "${ib_file}")}") + ib_file_sizes=("${(@f)$(jq -r ".[].${ib_isize}" "${ib_file}")}") + ib_file_urls=("${(@f)$(jq -r ".[].${ib_ifile}" "${ib_file}")}") + ib_sample_urls=("${(@f)$(jq -r ".[].${ib_isample}" "${ib_file}")}") + ib_preview_urls=("${(@f)$(jq -r ".[].${ib_ipreview}" "${ib_file}")}") + ib_widths=("${(@f)$(jq -r ".[].${ib_iwidth}" "${ib_file}")}") + ib_heights=("${(@f)$(jq -r ".[].${ib_iheight}" "${ib_file}")}") ;; (t) - ib_tags=("${(@f)$(jq -r ".${ib_iarray}[].${ib_itag}" "${ib_file}")}") - ib_counts=("${(@f)$(jq -r ".${ib_iarray}[].${ib_icount}" "${ib_file}")}") + ib_tags=("${(@f)$(jq -r ".[].${ib_itag}" "${ib_file}")}") + ib_counts=("${(@f)$(jq -r ".[].${ib_icount}" "${ib_file}")}") ;; esac diff --git a/operators/url_parser.zsh b/operators/url_parser.zsh index 187af40..050ce21 100644 --- a/operators/url_parser.zsh +++ b/operators/url_parser.zsh @@ -3,36 +3,35 @@ # SPDX-License-Identifier: Apache-2.0 url_table=( - a / 3 "safebooru.donmai.us/posts/" - d / 3 "danbooru.donmai.us/posts/" - g = 4 "gelbooru.com/index.php?page=post&s=view&id=" - i / 4 "www.idolcomplex.com/.*/posts/" - i / 4 "idolcomplex.com/.*/posts/" - i / 3 "www.idolcomplex.com/posts/" - i / 3 "idolcomplex.com/posts/" - k / 4 "konachan.com/post/show/" - s / 4 "www.sankakucomplex.com/.*/posts/" - i / 4 "sankakucomplex.com/.*/posts/" - s / 3 "www.sankakucomplex.com/posts/" - i / 3 "sankakucomplex.com/posts/" - y / 4 "yande.re/post/show/" + a 3 "safebooru.donmai.us/posts/" + d 3 "danbooru.donmai.us/posts/" + i 4 "www.idolcomplex.com/.*/posts/" + i 4 "idolcomplex.com/.*/posts/" + i 3 "www.idolcomplex.com/posts/" + i 3 "idolcomplex.com/posts/" + k 4 "konachan.com/post/show/" + s 4 "www.sankakucomplex.com/.*/posts/" + i 4 "sankakucomplex.com/.*/posts/" + s 3 "www.sankakucomplex.com/posts/" + i 3 "sankakucomplex.com/posts/" + y 4 "yande.re/post/show/" ) ib_mode="p" -while [[ ${#url_table} -ge 4 ]] +while [[ ${#url_table} -ge 3 ]] do - if url_line="$(grep -o "https://\?${url_table[4]}.*" <<< "${command} ${@}")" + if url_line="$(grep -o "https://\?${url_table[3]}.*" <<< "${command} ${@}")" then url_line="$(sed -e 's/https:\/\///' -e 's/ .*//' <<< "${url_line}")" ib_board="${url_table[1]}" - ib_post_id="$(cut -d ${url_table[2]} -f ${url_table[3]} <<< "${url_line}" | cut -d '?' -f 1)" + ib_post_id="$(cut -d '/' -f ${url_table[2]} <<< "${url_line}" | cut -d '?' -f 1)" break fi - shift 4 url_table + shift 3 url_table done if [[ -z "${ib_post_id}" ]] |
