Giter VIP home page Giter VIP logo

ferrispot's Introduction

Ferrispot

Crates.io docs.rs

A wrapper for the Spotify Web API that (hopefully) doesn't suck (too much) (I think).

A lot of the functionality is largely opinionated for my own use but I'm trying to make the library ergonomic and efficient to use. So far only the endpoints I care about are implemented, but if you need some endpoints implemented, feel free to open an issue.

Features

  • Type-safe clients and model.
  • Asynchronous and synchronous (blocking) clients.
  • Every OAuth authorization flow Spotify supports is implemented.
  • Supports multiple simultaneous user clients.
  • Automatically refreshes access tokens when they expire, where applicable.
  • Reacts to API rate limits using either Tokio's or async-std's sleep functions at your discretion when using an asynchronous client. Synchronous clients block the running thread.

Crate feature flags

  • async (default): enable the asynchronous API.
  • sync: enable the synchronous API.
    • In case neither API is enabled (default-features = false), the crate only includes the object model structure with minimal dependencies on serde and thiserror.
  • tokio_sleep (default): react to API rate limits using Tokio's sleep function.
  • async_std_sleep: react to API rate limits using async-std's sleep function.
    • In case both tokio_sleep and async_std_sleep are enabled, Tokio's sleep function will be used.
    • In case neither are enabled, the library will return a rate limit error when it occurs.
    • These features are meaningless unless the async feature is also enabled.
  • native-tls (default): use native system TLS library for secure connections.
  • rustls-tls: use rustls for secure connections.

Changelog

See CHANGELOG.md.

Attribution

This crate draws a lot of inspiration from:

  • aspotify by Sabrina Jewson, licensed under the MIT license
  • rspotify by Ramsay Leung and Mario Ortiz Manero, licensed under the MIT license

License

Dual-licensed under MIT or Apache 2.0.

ferrispot's People

Contributors

shaybox avatar spanfile avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

shays-forks

ferrispot's Issues

Blocking API

I'd like to use this over rspotify as this doesn't make PKCE a completely separate struct, allowing me to swap at runtime.
But I need blocking, so this is just me asking ๐Ÿ˜„

Unrelated but would you consider a way to automatically handle the Spotify callback via a tiny_http server and webbrowser?
This is my existing code using rspotify, it could be an optional feature.
image

0.3.0 InvalidClient

I updated to 0.3.0 and user_client.refresh_access_token() gives me an Unhandled authentication error: InvalidClient error (with and without pkce).
I tested 0.2.1 and it worked, 0.3.0 doesn't, normal construction and code/state are valid.

EDIT: I'm also not able to use ? on the result of refresh_access_token (and many more methods), errors never propagate and the program just freezes on error, but unwrap works.

I also wanted to ask if there's any control over playback implemented,
Such as play/pause/stop/next/prev/shuffle/mute/repeat/volume.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.