From 9aee322c4e70ea5e430857a44911b12a3f9c1209 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 6 Nov 2023 12:11:44 -0700 Subject: [PATCH] drop old --- cmd/xfer/all_from_todo_server_to_pttodo.sh | 21 --------- cmd/xfer/from_todo_server_to_pttodo.sh | 55 ---------------------- 2 files changed, 76 deletions(-) delete mode 100644 cmd/xfer/all_from_todo_server_to_pttodo.sh delete mode 100644 cmd/xfer/from_todo_server_to_pttodo.sh diff --git a/cmd/xfer/all_from_todo_server_to_pttodo.sh b/cmd/xfer/all_from_todo_server_to_pttodo.sh deleted file mode 100644 index bf69ced..0000000 --- a/cmd/xfer/all_from_todo_server_to_pttodo.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/bash - -main() { - cd "$(dirname "$BASH_SOURCE")" - source ./from_todo_server_to_pttodo.sh - type from_todo_server_to_pttodo_main - list_lists | jq .list[] | jq -c . | while read -r line; do - local name="$(echo "$line" | jq -r .name | sed 's/^Today$/todo/g' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')" - local id="$(echo "$line" | jq -r .id)" - echo $name, $id - TODO_SERVER_LIST="$id" from_todo_server_to_pttodo_main > ./$name.yaml - done -} - -list_lists() { - todo_server_curl "$TODO_SERVER_URL/ajax.php?loadLists=&rnd=0.9900282499544026" -} - -if [ "$0" == "$BASH_SOURCE" ]; then - main "$@" -fi diff --git a/cmd/xfer/from_todo_server_to_pttodo.sh b/cmd/xfer/from_todo_server_to_pttodo.sh deleted file mode 100644 index 25a58ef..0000000 --- a/cmd/xfer/from_todo_server_to_pttodo.sh +++ /dev/null @@ -1,55 +0,0 @@ -#! /bin/bash - -export TODO_SERVER_URL="${TODO_SERVER_URL:-"https://todo-server.remote.blapointe.com"}" -export TODO_SERVER_HEADERS="${TODO_SERVER_HEADERS:-"Cookie: BOAuthZ=$TODO_SERVER_BOAUTHZ"}" -export TODO_SERVER_LIST="${TODO_SERVER_LIST:-"2548023766"}" - -main() { - from_todo_server_to_pttodo_main "$@" -} - -from_todo_server_to_pttodo_main() { - set -e - set -o pipefail - local tasks_in_todo="$(fetch_tasks_in_list | format_tasks_in_list)" - local schedule_tasks_in_flight="$(COMPL=1 LOOPING=1 fetch_tasks_in_list | format_tasks_in_list)" - echo "{\"todo\": $tasks_in_todo, \"scheduled\": $schedule_tasks_in_flight, \"done\": []}" | yq -P eval - -} - -format_tasks_in_list() { - jq -c .list[] | while read -r line; do - echo "$line" \ - | jq '{ - todo: .title, - details:.note, - ts: (if .compl == 1 then (.dateCompleted | strptime("%d %b %Y %I:%M %p") | mktime) else .dateEditedInt end), - subtasks: [], - tags: .tags, - schedule: (if (.cron != "") then (.cron) else (.loop) end) - }' \ - | jq -c . - done | jq -sc | yq -P eval - | grep -v -E ' (""|\[]|0s)$' | yq -j eval - | jq -c . -} - -fetch_tasks_in_list() { - todo_server_curl "$TODO_SERVER_URL/ajax.php?loadTasks=&list=$TODO_SERVER_LIST&compl=${COMPL:-0}&looping=${LOOPING:-0}" -} - -todo_server_curl() { - local csv_headers="$TODO_SERVER_HEADERS" - local headers=() - while [ "$csv_headers" != "" ]; do - header="${csv_headers%%,*}" - headers+=("-H" "${header%%:*}: ${header#*:}") - if echo "$csv_headers" | grep -q ,; then - csv_headers="${csv_headers#*,}" - else - csv_headers="" - fi - done - curl -sS "${headers[@]}" "$@" -} - -if [ "$0" == "$BASH_SOURCE" ]; then - main "$@" -fi