Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Add fish shell CLI wrapper #1758

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

heyarne
Copy link
Contributor

@heyarne heyarne commented Jun 16, 2020

I have written a simple command line wrapper in fish that I've been using happily for the past couple of months. It depends on httpie and checks for the presence of that command when executed. It reduces dupliction immensely when intercting with the REST API.

Here's an example of how it's used:

Getting a list of all podcasts:

airsonic -u $user -p $pass getPodcasts includeEpisodes==1

Filtering for downloaded (and therefore streamable episodes):

airsonic -u $user -p $pass getPodcasts includeEpisodes==1 | jq '.["subsonic-response"].podcasts.channel[].episode[] | select(.status == "completed")'

Initiating an episode download works like this:

airsonic -u $user -p $pass downloadPodcastEpisode id==$id

You can get the correct id parameter from the getPodcasts response above.

Each episode has a property streamId, which you can use to stream it:

airsonic -u $user -p $pass stream id==$streamId

So putting it togehter:

# select random podcast episode
episode="$(airsonic -u $user -p $pass getPodcasts includeEpisodes==1 | jq -c '.["subsonic-response"].podcasts.channel[].episode[] | select(.status == "completed")' | shuf -n 1)"
# play episode
airsonic -u $user -p $pass stream id==$(echo $episode | jq '.streamId') | play

@stale
Copy link

stale bot commented Sep 14, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale This label will be removed soon label Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale This label will be removed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant