From b729fcd4756fb9bd8904f4a5888cd84e6c3823de Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 17 Jul 2023 21:44:55 -0700 Subject: feat(x): open both flag --- src/x_command.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/x_command.sh') diff --git a/src/x_command.sh b/src/x_command.sh index 67ee42a..9e6e297 100644 --- a/src/x_command.sh +++ b/src/x_command.sh @@ -39,6 +39,18 @@ if [[ "${args[--mal]}" = 1 ]]; then else xdg-open https://myanimelist.net/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.idMal' || true)" fi +elif [[ "${args[--both]}" = 1 ]]; then + if [[ "${args[--social]}" = 1 ]]; then + FULL_URL=$(curl --silent \ + "https://api.jikan.moe/v4/anime/$(echo "${ID}" | + jq '.data.Media.idMal')/full" || true) + + xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)"/social + xdg-open "$(echo "${FULL_URL}" | jq -r '.data.url' || true)/forum" + else + xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)" + xdg-open https://myanimelist.net/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.idMal' || true)" + fi else if [[ "${args[--social]}" = 1 ]]; then xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)"/social -- cgit v1.2.3