๐Ÿ“ฆโž”๐Ÿฆ‹ Store and retrieve files on the Atmosphere
35
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve examples

Ducky 7f8cf4ae 07eade62

+14 -57
+1
.gitignore
··· 1 1 .test_files/* 2 2 *~ 3 3 bin/* 4 + examples/.gitignore/*
-57
examples/atfile-radio.sh
··· 1 - #!/usr/bin/env bash 2 - 3 - source "../atfile.sh" 4 - 5 - library=() 6 - library_item_separator="|" 7 - 8 - function get_library_item_fragment() { 9 - track="$1" 10 - index="$2" 11 - 12 - echo "$(echo $track | cut -d "${library_item_separator}" -f $index)" 13 - } 14 - 15 - while : ; do 16 - uploads="$(atfile.invoke.list $uploads_cursor)" # BUG: jq error when empty 17 - [[ $uploads == *"\"error\":"* ]] && break 18 - uploads_cursor="$(echo $uploads | jq -r '.cursor')" 19 - uploads_list="$(echo $uploads | jq -c '.uploads[]')" 20 - 21 - while IFS=$"\n" read -r c; do 22 - key="$(atfile.util.get_rkey_from_at_uri "$(echo $c | jq -r '.uri')")" 23 - meta_type="$(echo "$c" | jq -r ".value.meta.\"\$type\"")" 24 - mime="$(echo $c | jq -r '.value.file.mimeType')" 25 - name="$(echo "$c" | jq -r ".value.file.name")" 26 - 27 - unset artist 28 - unset title 29 - 30 - if [[ $meta_type == "blue.zio.atfile.meta#audio" ]]; then 31 - artist="$(echo "$c" | jq -r ".value.meta.tags.artist")" 32 - title="$(echo "$c" | jq -r ".value.meta.tags.title")" 33 - fi 34 - 35 - if [[ $mime == audio/* ]]; then 36 - library+=("${key}${library_item_separator}${artist}${library_item_separator}$title") 37 - fi 38 - done <<< "$uploads_list" 39 - done 40 - 41 - library=($(printf "%s\n" "${library[@]}" | shuf)) 42 - 43 - trap exit SIGINT 44 - 45 - for track in "${library[@]}"; do 46 - key="$(get_library_item_fragment "$track" 1)" 47 - artist="$(get_library_item_fragment "$track" 2)" 48 - title="$(get_library_item_fragment "$track" 3)" 49 - 50 - [[ -z "$artist" ]] && artist="(Unknown Artist)" 51 - [[ -z "$title" ]] && title="(Unknown Track)" 52 - 53 - echo "๐ŸŽต [$key] $artist - $title" 54 - atfile.invoke.print $key | ffplay - -autoexit -hide_banner -loglevel error -nodisp 55 - done 56 - 57 - #echo $library
+13
examples/example.sh
··· 1 + #!/usr/bin/env bash 2 + 3 + _atfile_path="$(dirname "$(realpath "$0")")/../atfile.sh" 4 + 5 + if [[ ! -f "$_atfile_path" ]]; then 6 + echo -e "\033[1;31mError: ATFile not found (download: https://zio.sh/atfile)\033[0m" 7 + exit 0 8 + fi 9 + 10 + # shellcheck disable=SC1090 11 + source "$_atfile_path" 12 + 13 + atfile.bsky_profile "ducky.ws"