mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #130] API review for librespot-core #102
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @plietar on GitHub (Feb 8, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/130
As a first step we want to publish librespot-core to crates.io and start versioning it.
While we can still make breaking changes by publishing a new major version, we should do a first review pass to make sure we're not publishing in our first version anything stupid we'll want to change immediately.
Nice resource to have in mind while doing so: https://rust-lang-nursery.github.io/api-guidelines/
List of things to do
FileId's field should be private and methodto_raw/from_rawshould be added, similar toSpotifyId'sThings that have been done
authentication::get_credentialsshould take a custom prompt function rather than using stderr/rpassword directly.SpotifyId::from_base16/SpotifyId::from_base62/SpotifyId::from_rawshould returnOptionorResultutil/mod.rsshould either be removed, moved to the crate/module they are use in, or , not exposed. (Partially Done)int128::u128does not need to be exposed. Worth noting that native u128 will hopefully be in stable soon (https://github.com/rust-lang/rust/issues/35118#issuecomment-361380874).newmethod generated by thecomponent!macro does not need to be exposedsession::device_idprobably does not belong inlibrespot-coreat allSession::spawnmay not need to be exposedcomponentdoes not need to be exposed (macro is already internal only, butLazyneeds to be made more private)SessionDatadoes not need to be exposedSessionInternaldoes not need to be exposedMercuryManager::requestandMercuryRequest/MercuryMethodmay not need to be exposedSpotifyIdandFileIdshould be located in a more central place thanutil. Potentially at the root of the crate inlib.rs, or in their own module.apresolvedoes not need to be exposed (#136)AudioKeyManager::dispatchdoes not need to be exposed. (#136)Credentials::from_readerand similar probably do not need to be exposed (#136)cacheis fine, could be moved tocache.rsrather than being in a subdirectory (#136)ChannelManager::dispatchdoes not need to be exposed. (#136)connectiondoes not need to be exposed (#136)MercuryManager::dispatchdoes not need to be exposed (#136)subfilebelongs to the same crate as the playerMercurySender::newdoes not need to be exposedSessionWeakandSession::weakmay not need to be exposedconfigexceptSessionConfigcan be moved to the relevant crate.SessionConfigcan move to thesessionmodule.It is used by discoverydiffie_hellmandoes not need to be exposedIt is used by at least audio and metadataSession::send_packetmay not need to be exposedkeymasteris fine like thatversionis (probably) fine like thatFor everything which "does not need to be exposed", this generally means switching the item's visibility from `pub` to `pub(crate)`.
@plietar commented on GitHub (Feb 8, 2018):
These are pretty easy to do and can be done individually, so anyone feel free to take a few and fix them.
@sashahilton00 commented on GitHub (Feb 8, 2018):
Before we start this review, are you ok with spirc going into the core crate, or do you want it in a seperate one?
@plietar commented on GitHub (Feb 8, 2018):
No, IMO spirc belongs to its own crate, librespot-connect, which could potentially be merged with the discovery stuff.
@kingosticks commented on GitHub (Feb 8, 2018):
Since this crate won't include spirc, can I ask the possibly naive question, in what projects would the core crate be useful?
@plietar commented on GitHub (Feb 8, 2018):
@kingosticks This is just a starting point, I agree core is pretty useless on it's own, but it must be done first.
The next steps are probably metadata, audio and player. These are the crates with reasonably well defined APIs, and still have some value to 3rd party projects. spirc and discovery would come last
@awiouy commented on GitHub (Feb 9, 2018):
@plietar core::diffie_hellman is used in discovery
@plietar commented on GitHub (Feb 9, 2018):
@awiouy Could point, I've updated the list
@plietar commented on GitHub (Feb 9, 2018):
Updated the list with #136. Thanks @awiouy
@awiouy commented on GitHub (Feb 13, 2018):
@plietar
apresolve.rscould be moved tosession.rsand constants.What do you think?
@sashahilton00 commented on GitHub (Feb 22, 2018):
I believe
u128will be in stable within a week, so once that lands, we can remove theint128dependency.Most of the stuff that was in
util/mod.rshas been removed, I don't think it needs anything else being moved, as we'll be duplicating code into the connect crate otherwise.Where do you think
device_idshould be if not in the core crate? Since it's a simple function, one could maybe stick it in main.rs?imo keeping apresolve.rs in it's own file keeps things more readable.
@sashahilton00 commented on GitHub (Feb 26, 2018):
@plietar have done the last couple of things, haven't touched the
FileIdstuff as I'm not too familiar with it, but the ball is now pretty much in your court in terms of a final code review before publishing. What are your thoughts with regards to #134? It's a bug that seems to be cropping up in quite a few use cases, and thus I'm wondering if we shouldn't hold off publishing to crates.io until we have this sorted out.Furthermore, before we publish, we probably ought to think about how we want to handle development and releases from this point on, as once it's on crates.io, we can't really continue on the rolling release style that the project has used thus far, at least not in librespot (possibly in librespotd though). We probably need to think about properly tagging Github releases, and move development into a
developbranch, which we periodically merge withmasterand increment the version. Any thoughts on this or an alternative release setup would be great.Once it's published, I'll look at spending a bit more time on librespotd, and also documenting the codebase, since documentation is fairly sparse at the moment.
@plietar commented on GitHub (Feb 27, 2018):
I don't see why not. Continuous development on master with tags whenever a release is done is fine. Unless you want to backport bugfixes to the latest release.
My only concern is how to deal with releases of individual crates. Say
coreandmetadataare at version 0.5.0, and we add a new (backwards compatible) feature tometedata, what happens withcore's version number? Do we bump both crates (and all the others) to 0.5.1 and tag that, or doesmetadatabecome 0.5.1 butcorestays at 0.5.0? How does tagging work in this case?I'd be curious to see how other projects with multliple crates in the same repo deal with this.
@plietar commented on GitHub (Feb 27, 2018):
#134 can come later and shouldn't block the first release of
core. It's a non-trivial change and will take some time, especially since I don't have time/can't write code for librespot.@sashahilton00 commented on GitHub (Feb 27, 2018):
What I intended to convey was that we can't have a rolling release on crates.io. Your point about rolling on master is valid though, and thinking about it, having a develop branch is pointless if we are tagging releases.
I believe this is how serde handles things. If we take the metadata example, and implement a (backwards compatible) feature and then bump it from
0.5.0 -> 0.5.1, then core gets bumped from0.5.0 -> 0.5.1as well. If a change is then made in the connect crate, and the version gets bumped from0.5.0 -> 0.5.1, then the core crate, which uses the connect crate, gets bumped from0.5.1 -> 0.5.2.If we stick to the semver Major.Minor.Patch logic, then whenever a fix is implemented in a crate, the patch number increases for that crate, and the patch number then also increases for crates which utilise that crate. Similarly, if we publish a (small) breaking change, we can increase the minor, and that propagates through, same thing again for the major. Over time this might mean versions become differentiated amongst the crates, but as long as one applies this logic, it's pretty easy to understand and implement.
Good to know. Didn't realise you were still unable to contribute code. Anyway, I believe #134 and #21 will both require substantial portions of code to be rewritten, so perhaps this can be implementent in another minor at a later date.
@sashahilton00 commented on GitHub (Feb 28, 2018):
@plietar are you happy to sign off on
0.1.0being deployed to crates.io, and are you happy with the versioning described in the previous comment?@sashahilton00 commented on GitHub (Mar 8, 2018):
I propose we get v0.1.0 shipped to crates.io, as enough of the bugs have been fixed to make this a plausible crate. Please tick your relevant box below if you agree that we are ready to ship the code, with the current codebase and the versioning suggested above. If you have any reservations, please make them known. I propose that we prepare ship this at the end of next week, assuming the majority agrees we're ready to ship.
If anyone else has anything to contribute, please leave a note.
@ComlOnline commented on GitHub (Mar 8, 2018):
I'm happy, the bugs we do have are nothing major, the only thing I would suggest we do is to make releases at the same time that we publish a crate.
@sashahilton00 commented on GitHub (Mar 14, 2018):
I'm not sure building releases is that important, but I do think we definitely need to tag releases from the moment we publish and then going forwards.
@ComlOnline commented on GitHub (Mar 14, 2018):
Yeah that's what I was thinking. No building, just the tags and so that you can get the source code from a release.
@sashahilton00 commented on GitHub (Mar 20, 2018):
I'll upload librespot to crates.io later this week, need to get my head around multi crate uploads, think I'll have to publish a few dummy versions before I can use
[replace]to point it to git. for the initial compilation. Will give it some thought.@hrkfdn commented on GitHub (Mar 8, 2019):
Any news on the publishing? Would be nice if we could publish our own crates using librespot :)
@ashthespy commented on GitHub (Nov 6, 2019):
@hrkfdn https://crates.io/crates/librespot is up and running!
@hrkfdn commented on GitHub (Nov 6, 2019):
Awesome!