All of my important config files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

17 lines
949 B

#!/usr/bin/env zsh
response=$(curl http://localhost:9863/api/v1/state --header 'Authorization:5c5b96bc669394aa187850daa3da53dd70928b2226f6e10ba4b4acc27f3743d48ccfb1389fa3e066263a6600ae88855c4b40cf7072770f06ab7efb852f9f65cf65892cdc933627099c84fefb5802999c31e8e3f240048fb5e39501e7e49cffa5beb3a58f8f6e89bf70a999adb280c5f011042ff2d9aee92315bbbabe68b996f5f5440ebf6762aa2ed4b7ae607a27e9d96d11f60f452091cc9f17e2ee47dd585ad5624aa43a06536c203cae71922dae615792c05ecc01d98110f30c2efa7efbda0263ecb21e418bf3b03f7a707d193b8273b7499a0a18042cfe1315d7a11acb985f0927f87cb7dcda54fb9dc09c56c989e1ec760739d89609ad1fbbe36a8f8642' --fail-with-body)
responseExitCode=$?
if [ $responseExitCode -ne 0 ]; then
cat /tmp/ytm-title
exit 0
fi
title=$(echo "$response" | jq -r '.video.author+ " - " + .video.title')
# if zero exit code the request worked and we save the title
if [ $responseExitCode -eq 0 ]; then
echo $title > /tmp/ytm-title
fi
cat /tmp/ytm-title