Skip to content

Commit af8e17e

Browse files
committed
Update root documentation
1 parent 0150d71 commit af8e17e

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

src/lib.rs

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! # crunchyroll-rs
22
//!
3-
//! A easy-to-use, batteries-included library for the undocumented
3+
//! An easy-to-use, batteries-included library for the undocumented
44
//! [Crunchyroll](https://www.crunchyroll.com/) api, completely written in Rust.
55
//!
66
//! You can use a premium account as well as a non-premium account to use this library, but you
@@ -61,38 +61,38 @@
6161
//! [`media::Stream`] has all required information to access the streams.
6262
//!
6363
//! ```
64-
//! let streams = episode
65-
//! .streams()
64+
//! let stream = episode
65+
//! .stream()
6666
//! .await?;
6767
//! ```
6868
//!
69-
//! Crunchyroll uses the [HLS] and [DASH] video streaming formats to distribute their streams. The
70-
//! logic to work with this formats is already implemented
71-
//! into this crate.
72-
//!
73-
//! The feature `hls-stream` and / or `dash-stream` must be activated to get streams. `hls-stream`
74-
//! is activated by default and should be used if you want to get the video + audio combined
75-
//! ([`media::Stream::hls_streaming_data`]). `dash-stream` should be used if you want to get
76-
//! the audio and video streams separately ([`media::Stream::dash_streaming_data`]).
69+
//! Crunchyroll uses the [DASH] video streaming format to distribute their streams. The logic to
70+
//! work with this formats is already implemented into this crate.
7771
//!
7872
//! ```
79-
//! let streaming_data = streams
80-
//! .hls_streaming_data(None)
81-
//! .await?;
73+
//! let (video_streams, audio_streams) = stream
74+
//! .stream_data(None)
75+
//! .await?
76+
//! .unwrap();
8277
//!
83-
//! // sort the streams to get the stream with the best resolution at first
84-
//! streaming_data.sort_by(|a, b| a.resolution.width.cmp(&b.resolution.width).reverse());
78+
//! // sort the streams to get the stream with the best resolution / bitrate at first
79+
//! video_streams.sort_by(|a, b| a.bandwidth.cmp(&b.bandwidth).reverse());
80+
//! audio_streams.sort_by(|a, b| a.bandwidth.cmp(&b.bandwidth).reverse());
8581
//!
8682
//! let sink = &mut std::io::sink();
8783
//!
8884
//! // get the segments / video chunks of the first stream (which is the best after it got sorted
8985
//! // above)
90-
//! let segments = streaming_data[0].segments().await?;
86+
//! let video_segments = video_streams[0].segments();
87+
//! let audio_segments = audio_streams[0].segments();
9188
//! // iterate through every segment and write it to the provided writer (which is a sink in this
9289
//! // case; it drops its input immediately). writer can be anything which implements `std::io::Write`
9390
//! // like a file, a pipe, ...
94-
//! for segment in segments {
95-
//! segment.write_to(sink).await?;
91+
//! for video_segment in video_segments {
92+
//! video_segment.write_to(sink).await?;
93+
//! }
94+
//! for audio_segment in audio_segments {
95+
//! audio_segments.write_to(sink).await?;
9696
//! }
9797
//! ```
9898
//!
@@ -117,8 +117,6 @@
117117
//!
118118
//! # Features
119119
//!
120-
//! - **hls-stream** *(enabled by default)*: Enables processing of [HLS] video streams.
121-
//! - **dash-stream**: Enables processing of [DASH] video streams.
122120
//! - **parse** *(enabled by default)*: Enables url parsing.
123121
//! - **tower**: Enables the usage of a [tower](https://docs.rs/tower) compatible middleware.
124122
//! - **experimental-stabilizations**: Provides some functions to maybe fix broken api results. See
@@ -130,7 +128,6 @@
130128
//! that no fields were added or removed from an api response, otherwise the associated test will
131129
//! fail.
132130
//!
133-
//! [HLS]: https://en.wikipedia.org/wiki/HTTP_Live_Streaming
134131
//! [DASH]: https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP
135132
136133
#![cfg_attr(docsrs, feature(doc_cfg))]

0 commit comments

Comments
 (0)