Refactoring
This commit is contained in:
parent
07836f5763
commit
981d4a1b5f
2 changed files with 23 additions and 20 deletions
|
|
@ -7,14 +7,15 @@ function upload_to_streamtape () {
|
|||
|
||||
filepath=$( readlink -f "$filepath" )
|
||||
# echo "filepath: $filepath" >&2
|
||||
|
||||
|
||||
filesize=$(stat -c%s "$filepath")
|
||||
# echo "filesize: $filesize" >&2
|
||||
|
||||
|
||||
filesha256=$( sha256sum "$filepath")
|
||||
filesha256=${filesha256%% *}
|
||||
|
||||
echo "filesha256 $filesha256" >&2
|
||||
echo "https://api.streamtape.com/file/ul?login=$api_user&key=$api_key&sha256=$filesha256" >&2
|
||||
|
||||
upload_server=$(curl -s -X GET "https://api.streamtape.com/file/ul?login=$api_user&key=$api_key&sha256=$filesha256" -H "Content-Type: application/json")
|
||||
echo "Upload_URL $upload_server" >&2
|
||||
|
|
@ -34,22 +35,22 @@ function upload_to_streamtape () {
|
|||
|
||||
function streamtape_check_if_file_is_alive () {
|
||||
file_url=$1
|
||||
|
||||
|
||||
file_id=${file_url%/*}
|
||||
# >&2 echo "File ID: $file_id"
|
||||
file_id=${file_id##*/}
|
||||
# >&2 echo "File ID: $file_id"
|
||||
|
||||
|
||||
response=$(curl -s -X GET "https://api.streamtape.com/file/info?file=$file_id" -H "Content-Type: application/json" )
|
||||
# >&2 echo "Response: $response"
|
||||
|
||||
|
||||
is_alive=$(echo $response | jq ".result")
|
||||
is_alive=$(echo $is_alive | jq "first(.[])")
|
||||
is_alive=$(echo $is_alive | jq ".status")
|
||||
|
||||
|
||||
# echo $is_alive
|
||||
|
||||
if [ $is_alive = '404' ]; then
|
||||
|
||||
if [ $is_alive == '404' ]; then
|
||||
echo "false"
|
||||
# elif [ $is_alive = '500' ]; then
|
||||
# echo "false"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue