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

Add fish shell CLI wrapper#1758

Open
rrrnld wants to merge 2 commits into
airsonic:masterfrom
rrrnld:feature/cli-wrapper
Open

Add fish shell CLI wrapper#1758
rrrnld wants to merge 2 commits into
airsonic:masterfrom
rrrnld:feature/cli-wrapper

Conversation

@rrrnld

@rrrnld rrrnld commented Jun 16, 2020

Copy link
Copy Markdown
Contributor

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

stale Bot commented Sep 14, 2020

Copy link
Copy Markdown

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.

1 participant