pub struct LibraryApi { /* private fields */ }Expand description
Calls on one library. Cheap to clone; clones share the passphrase.
Implementations§
Source§impl LibraryApi
impl LibraryApi
pub fn new(client: RedseatClient, library: ServerLibraryForRead) -> Self
pub fn id(&self) -> &str
pub fn library(&self) -> &ServerLibraryForRead
Sourcepub fn client(&self) -> &RedseatClient
pub fn client(&self) -> &RedseatClient
The client of the library’s server.
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Whether files are encrypted on the client side (crypt).
Sourcepub fn has_passphrase(&self) -> bool
pub fn has_passphrase(&self) -> bool
Whether the passphrase is set.
Sourcepub async fn get_medias(&self, query: &MediaQuery) -> Result<Vec<MediaItem>>
pub async fn get_medias(&self, query: &MediaQuery) -> Result<Vec<MediaItem>>
Medias matching query. Timestamps are Unix milliseconds.
Sourcepub async fn get_medias_page(&self, query: &MediaQuery) -> Result<MediaPage>
pub async fn get_medias_page(&self, query: &MediaQuery) -> Result<MediaPage>
A page of medias. Set query.limit to the page size, then pass
next_page_key back in query.page_key for the next page.
Sourcepub async fn get_thumb_raw(&self, media_id: &str) -> Result<Vec<u8>>
pub async fn get_thumb_raw(&self, media_id: &str) -> Result<Vec<u8>>
The thumbnail as the server stores it: encrypted in an encrypted library.
Sourcepub async fn get_thumb(&self, media: &Media) -> Result<Vec<u8>>
pub async fn get_thumb(&self, media: &Media) -> Result<Vec<u8>>
The thumbnail of media, decrypted in an encrypted library (set the passphrase
first).
Sourcepub fn decrypt_thumb(&self, media: &Media, data: &[u8]) -> Result<Vec<u8>>
pub fn decrypt_thumb(&self, media: &Media, data: &[u8]) -> Result<Vec<u8>>
Decrypts a thumbnail of media fetched with Self::get_thumb_raw (or its
file, fetched without raw: both are encrypted with the media’s IV). Returns it
unchanged when the library is not encrypted.
Sourcepub async fn get_media(
&self,
media: &Media,
query: &MediaFileQuery,
) -> Result<Vec<u8>>
pub async fn get_media( &self, media: &Media, query: &MediaFileQuery, ) -> Result<Vec<u8>>
The file of a media, whole: decrypted in an encrypted library (set the
passphrase first). With query.unsupported_mime, the server converts photos
of those types (or of any type a browser cannot show, with "all") to WebP;
it cannot in an encrypted library.
Sourcepub async fn media_url(
&self,
media_id: &str,
query: &MediaFileQuery,
) -> Result<AuthorizedUrl>
pub async fn media_url( &self, media_id: &str, query: &MediaFileQuery, ) -> Result<AuthorizedUrl>
The URL of a media file and a token to open it, for a player that streams it
itself with HTTP range requests. The bytes are the stored ones: in an encrypted
library they are encrypted, and the server does not answer range requests, so
use Self::get_media there.
Sourcepub async fn open_encrypted_media(
&self,
media: &Media,
) -> Result<EncryptedMediaReader>
pub async fn open_encrypted_media( &self, media: &Media, ) -> Result<EncryptedMediaReader>
Opens a media of an encrypted library for reading by ranges, decrypted: for a
player that streams and seeks (see EncryptedMediaReader). Set the
passphrase first. Needs a server that answers range requests on encrypted
files; an older one gives an error saying it needs an update.
Sourcepub async fn get_media_metadata(
&self,
media_id: &str,
) -> Result<Option<MediaItem>>
pub async fn get_media_metadata( &self, media_id: &str, ) -> Result<Option<MediaItem>>
One media with its relations, its faces and its backups. None when the
library has no media with this id.
Sourcepub async fn get_media_by_hash(&self, hash: &str) -> Result<Option<MediaItem>>
pub async fn get_media_by_hash(&self, hash: &str) -> Result<Option<MediaItem>>
The media whose file has this hash: the one the server keeps in Media::md5, or
the hash of the original file when the server converted it. None when the
library has none.
Sourcepub async fn update_media(
&self,
media_id: &str,
update: &MediaForUpdate,
) -> Result<Media>
pub async fn update_media( &self, media_id: &str, update: &MediaForUpdate, ) -> Result<Media>
Changes a media and returns it. Only the set fields change; add_tags,
remove_tags, add_people, add_series… change its relations.
Sourcepub async fn update_medias(
&self,
media_ids: &[String],
update: &MediaForUpdate,
) -> Result<Vec<Media>>
pub async fn update_medias( &self, media_ids: &[String], update: &MediaForUpdate, ) -> Result<Vec<Media>>
Changes several medias alike and returns those changed: an id the library does not have is skipped (servers with redseat_rust #85).
Sourcepub async fn get_media_faces(
&self,
media_id: &str,
) -> Result<Vec<FaceEmbedding>>
pub async fn get_media_faces( &self, media_id: &str, ) -> Result<Vec<FaceEmbedding>>
The faces found in a media, each with the person it was given to, if any.
Sourcepub async fn detect_media_faces(
&self,
media_id: &str,
) -> Result<Vec<DetectedFaceResult>>
pub async fn detect_media_faces( &self, media_id: &str, ) -> Result<Vec<DetectedFaceResult>>
Detects a media’s faces again: the server deletes those it had, detects them and
gives them to the people it recognizes. Answers the faces found, without their
person: read them with Self::get_media_faces. Needs the write role.
Sourcepub async fn assign_faces(
&self,
face_ids: &[String],
person_id: &str,
) -> Result<()>
pub async fn assign_faces( &self, face_ids: &[String], person_id: &str, ) -> Result<()>
Gives faces to a person (taking them from the one they had). Needs the write role.
Sourcepub async fn unassign_faces(&self, face_ids: &[String]) -> Result<()>
pub async fn unassign_faces(&self, face_ids: &[String]) -> Result<()>
Takes faces from their person. Needs the write role.
Sourcepub async fn get_face_image(&self, face_id: &str) -> Result<Vec<u8>>
pub async fn get_face_image(&self, face_id: &str) -> Result<Vec<u8>>
The image of a face (the part of its media around it), as the bytes of an image file.
Has the server’s model tag a media (the web app’s “AI tag”): the tags it finds are added to the media as generated tags, with their confidence, and told by events.
Sourcepub async fn refresh_media(&self, media_id: &str) -> Result<MediaItem>
pub async fn refresh_media(&self, media_id: &str) -> Result<MediaItem>
Reads a media’s file again (its size, dimensions, codecs, EXIF…) and processes it again, then returns it.
Sourcepub async fn convert_media(
&self,
media_id: &str,
request: &VideoConvertRequest,
plugin_id: Option<&str>,
) -> Result<()>
pub async fn convert_media( &self, media_id: &str, request: &VideoConvertRequest, plugin_id: Option<&str>, ) -> Result<()>
Has the server make a new video from a media’s (trimmed, framed, re-encoded,
with overlays…): request says how, and its id names the conversion in
the server’s ServerEvent::ConvertProgress events. The
server’s own converter (ffmpeg) runs it, or a video convert plugin
(plugin_id), whose job is listed by Self::video_convert_jobs. The new
video is added to the library when done. Needs the write role.
Sourcepub async fn video_convert_jobs(&self) -> Result<Vec<PluginConvertQueueItem>>
pub async fn video_convert_jobs(&self) -> Result<Vec<PluginConvertQueueItem>>
The conversions run by video convert plugins (queued, running and ended), as the server keeps them. Conversions by the server’s own converter are only told by events.
Sourcepub async fn cancel_convert(&self, id: &str) -> Result<()>
pub async fn cancel_convert(&self, id: &str) -> Result<()>
Cancels a conversion under way, by its request’s id: one waiting in the
server’s queue leaves it, the one the server runs stops (its convert_progress
says canceled; one already past encoding ends anyway), a plugin’s job is
removed. NotFound when the server has no such conversion, or is older than
the cancel. Needs the write role.
Sourcepub async fn video_convert_plugins(&self) -> Result<Vec<VideoConvertPlugin>>
pub async fn video_convert_plugins(&self) -> Result<Vec<VideoConvertPlugin>>
The plugins that can convert this library’s videos
(Self::convert_media’s plugin_id).
Sourcepub async fn remove_video_convert_job(&self, id: &str) -> Result<()>
pub async fn remove_video_convert_job(&self, id: &str) -> Result<()>
Removes a plugin’s conversion from the server’s list, cancelling it while it runs. Needs the write role.
Sourcepub async fn watermarks(&self) -> Result<Vec<String>>
pub async fn watermarks(&self) -> Result<Vec<String>>
The names of the library’s watermarks, the images a conversion can put over a
video (VideoOverlay::path). default is the library’s unnamed one.
Sourcepub async fn get_watermark(&self, name: &str) -> Result<Vec<u8>>
pub async fn get_watermark(&self, name: &str) -> Result<Vec<u8>>
A watermark’s image, as the bytes of a PNG file.
Sourcepub async fn update_media_image(
&self,
media: &Media,
image: &[u8],
) -> Result<()>
pub async fn update_media_image( &self, media: &Media, image: &[u8], ) -> Result<()>
Sets the thumbnail of media to image, the bytes of an image file (JPEG, PNG,
WebP…): the server makes it 512 pixels wide. In an encrypted library it is
encrypted as the thumbnail its file embeds (Self::encrypt_thumb) and kept as
sent, so give one of a thumbnail’s size (servers with the encrypted thumbnail
upload; an older one fails to read it).
Sourcepub fn encrypt_thumb(&self, media: &Media, data: &[u8]) -> Result<Vec<u8>>
pub fn encrypt_thumb(&self, media: &Media, data: &[u8]) -> Result<Vec<u8>>
Encrypts a thumbnail of media as its file’s is (the media’s IV), for
Self::decrypt_thumb. Returns it unchanged when the library is not encrypted.
Sourcepub async fn set_media_progress(
&self,
media_id: &str,
progress: u64,
) -> Result<RsMediaProgress>
pub async fn set_media_progress( &self, media_id: &str, progress: u64, ) -> Result<RsMediaProgress>
Saves how far the user is in a media (a position in a video, a page of a
book…). The server stores progress as given.
Sourcepub async fn remove_medias(&self, media_ids: &[String]) -> Result<Vec<Media>>
pub async fn remove_medias(&self, media_ids: &[String]) -> Result<Vec<Media>>
Removes medias, with their files. Returns those removed: an id the library does not have is skipped.
A URL of a media file that anyone can open for 6 hours, without the user’s token: for a download manager, another app or a cast device. Needs an HTTP transport.
Sourcepub async fn download_medias(
&self,
download: &RsGroupDownload,
) -> Result<Vec<Media>>
pub async fn download_medias( &self, download: &RsGroupDownload, ) -> Result<Vec<Media>>
Adds medias from URLs: the server downloads the requests of download (as one
media with group) and returns the medias created. It can take long: see
Self::download_medias_in_background. When a request holds several files and
none is selected, the server asks for a selection and this is an error.
Sourcepub async fn download_medias_in_background(
&self,
download: &RsGroupDownload,
) -> Result<()>
pub async fn download_medias_in_background( &self, download: &RsGroupDownload, ) -> Result<()>
Like Self::download_medias, without waiting: the server downloads in the
background, and the medias come with the medias events.
Sourcepub async fn count_medias(&self, query: &MediaQuery) -> Result<u64>
pub async fn count_medias(&self, query: &MediaQuery) -> Result<u64>
The number of medias matching query (its limit and page_key are ignored).
The tags of the library matching query. With after, only those modified
strictly after it (Unix milliseconds); page with limit and offset.
Sourcepub async fn create_tag(&self, tag: &TagForAdd) -> Result<Tag>
pub async fn create_tag(&self, tag: &TagForAdd) -> Result<Tag>
Adds a tag to the library and returns it as created. The server chooses its
id; parent puts it under another tag.
Sourcepub async fn update_tag(
&self,
tag_id: &str,
update: &TagForUpdate,
) -> Result<Tag>
pub async fn update_tag( &self, tag_id: &str, update: &TagForUpdate, ) -> Result<Tag>
Changes a tag and returns it. Only the set fields change: name renames it,
parent moves it under another tag (an empty id moves it to the root), and
add_alts, remove_alts, add_otherids and remove_otherids change its
alternative names and external ids. Needs the admin role on the library.
Sourcepub async fn merge_tag(&self, tag_id: &str, into: &str) -> Result<Tag>
pub async fn merge_tag(&self, tag_id: &str, into: &str) -> Result<Tag>
Merges the tag tag_id into the tag into and removes it. Returns the tag
kept.
Sourcepub async fn remove_tag(&self, tag_id: &str) -> Result<Tag>
pub async fn remove_tag(&self, tag_id: &str) -> Result<Tag>
Removes a tag and returns it as it was.
Sourcepub async fn get_people(&self, query: &PeopleQuery) -> Result<Vec<Person>>
pub async fn get_people(&self, query: &PeopleQuery) -> Result<Vec<Person>>
The people of the library matching query, like Self::get_tags.
Sourcepub async fn get_person(&self, person_id: &str) -> Result<Option<Person>>
pub async fn get_person(&self, person_id: &str) -> Result<Option<Person>>
One person, None when the library has no person with this id.
Sourcepub async fn create_person(&self, person: &PersonForAdd) -> Result<Person>
pub async fn create_person(&self, person: &PersonForAdd) -> Result<Person>
Adds a person to the library and returns them as created. The server chooses
their id.
Sourcepub async fn update_person(
&self,
person_id: &str,
update: &PersonForUpdate,
) -> Result<Person>
pub async fn update_person( &self, person_id: &str, update: &PersonForUpdate, ) -> Result<Person>
Changes a person and returns them. Only the set fields change; add_alts,
remove_alts, add_socials, add_otherids… change their alternative names,
links and external ids.
Sourcepub async fn update_person_image(
&self,
person_id: &str,
image: &[u8],
) -> Result<()>
pub async fn update_person_image( &self, person_id: &str, image: &[u8], ) -> Result<()>
Sets the portrait of a person to image, the bytes of an image file (JPEG,
PNG, WebP…): the server converts it.
Sourcepub async fn get_person_image(
&self,
person_id: &str,
options: &ImageRequestOptions,
) -> Result<Vec<u8>>
pub async fn get_person_image( &self, person_id: &str, options: &ImageRequestOptions, ) -> Result<Vec<u8>>
The portrait of a person, as the bytes of an image file. The server has no
other image for a person: it does not read defaulting.
Sourcepub async fn remove_person(&self, person_id: &str) -> Result<Person>
pub async fn remove_person(&self, person_id: &str) -> Result<Person>
Removes a person and returns them as they were. Needs the admin role on the library.
Sourcepub async fn merge_people(&self, source: &str, target: &str) -> Result<u64>
pub async fn merge_people(&self, source: &str, target: &str) -> Result<u64>
Merges the person source into the person target, who gets their faces;
source is then removed. Returns the number of faces moved. Needs the admin
role on the library.
Sourcepub async fn get_movie_people(
&self,
movie_id: &str,
) -> Result<Vec<PersonWithRoles>>
pub async fn get_movie_people( &self, movie_id: &str, ) -> Result<Vec<PersonWithRoles>>
The people of a movie (cast and crew), with their roles in it.
Sourcepub async fn get_serie_people(
&self,
serie_id: &str,
) -> Result<Vec<PersonWithRoles>>
pub async fn get_serie_people( &self, serie_id: &str, ) -> Result<Vec<PersonWithRoles>>
The people of a series (cast and crew), with their roles in it.
Sourcepub async fn get_book_people(
&self,
book_id: &str,
) -> Result<Vec<PersonWithRoles>>
pub async fn get_book_people( &self, book_id: &str, ) -> Result<Vec<PersonWithRoles>>
The people of a book (authors…), with their roles in it.
Sourcepub async fn get_series(
&self,
query: &SerieQuery,
) -> Result<Vec<ItemWithRelations<Serie>>>
pub async fn get_series( &self, query: &SerieQuery, ) -> Result<Vec<ItemWithRelations<Serie>>>
The series of the library matching query, with their relations, like
Self::get_tags.
Sourcepub async fn create_serie(
&self,
serie: &ItemWithRelations<Serie>,
) -> Result<ItemWithRelations<Serie>>
pub async fn create_serie( &self, serie: &ItemWithRelations<Serie>, ) -> Result<ItemWithRelations<Serie>>
Adds a series to the library, with its relations (tags, people), and returns it
as created. The server chooses its id, and refuses a series whose external
ids (imdb, tmdb…) the library already has.
Sourcepub async fn update_serie(
&self,
serie_id: &str,
update: &SerieForUpdate,
) -> Result<ItemWithRelations<Serie>>
pub async fn update_serie( &self, serie_id: &str, update: &SerieForUpdate, ) -> Result<ItemWithRelations<Serie>>
Changes a series and returns it, with its relations. Only the set fields change. Needs the admin role on the library.
Sourcepub async fn update_serie_image(
&self,
serie_id: &str,
kind: ImageType,
image: &[u8],
) -> Result<()>
pub async fn update_serie_image( &self, serie_id: &str, kind: ImageType, image: &[u8], ) -> Result<()>
Sets an image of a series (kind: its poster, background, card…) to image,
the bytes of an image file (JPEG, PNG, WebP…): the server converts it. A
Custom type is refused.
Sourcepub async fn get_serie_image(
&self,
serie_id: &str,
options: &ImageRequestOptions,
) -> Result<Vec<u8>>
pub async fn get_serie_image( &self, serie_id: &str, options: &ImageRequestOptions, ) -> Result<Vec<u8>>
An image of a series, as the bytes of an image file: its poster, or the
options.kind asked. With defaulting, the background stands in for a missing
card.
Sourcepub async fn get_episode_image(
&self,
serie_id: &str,
season: u32,
number: u32,
options: &ImageRequestOptions,
) -> Result<Vec<u8>>
pub async fn get_episode_image( &self, serie_id: &str, season: u32, number: u32, options: &ImageRequestOptions, ) -> Result<Vec<u8>>
The still of an episode, as the bytes of an image file. The server does not
read options.kind. With defaulting, the card of the series, or else its
background, stands in for a missing still.
Sourcepub async fn remove_serie(
&self,
serie_id: &str,
delete_medias: bool,
) -> Result<Serie>
pub async fn remove_serie( &self, serie_id: &str, delete_medias: bool, ) -> Result<Serie>
Removes a series and returns it as it was. With delete_medias, its medias are
removed too, with their files (a virtual file’s source stays).
Sourcepub async fn set_episode_watched(
&self,
serie_id: &str,
season: u32,
number: u32,
date: i64,
) -> Result<()>
pub async fn set_episode_watched( &self, serie_id: &str, season: u32, number: u32, date: i64, ) -> Result<()>
Marks an episode watched by the user at date (Unix milliseconds), or not
watched with a date of 0.
Sourcepub async fn set_episode_progress(
&self,
serie_id: &str,
season: u32,
number: u32,
progress: u64,
) -> Result<()>
pub async fn set_episode_progress( &self, serie_id: &str, season: u32, number: u32, progress: u64, ) -> Result<()>
Saves how far the user is in an episode. The server stores progress as given.
Sourcepub async fn add_searched_episode_media(
&self,
serie_id: &str,
season: u32,
number: u32,
request: &RsRequest,
) -> Result<Media>
pub async fn add_searched_episode_media( &self, serie_id: &str, season: u32, number: u32, request: &RsRequest, ) -> Result<Media>
Adds a file found by a source search to an episode: the server downloads
request and returns the media created.
Sourcepub async fn get_movies(
&self,
query: &MovieQuery,
) -> Result<Vec<ItemWithRelations<Movie>>>
pub async fn get_movies( &self, query: &MovieQuery, ) -> Result<Vec<ItemWithRelations<Movie>>>
The movies of the library matching query, with their relations, like
Self::get_tags.
Sourcepub async fn create_movie(
&self,
movie: &ItemWithRelations<Movie>,
) -> Result<ItemWithRelations<Movie>>
pub async fn create_movie( &self, movie: &ItemWithRelations<Movie>, ) -> Result<ItemWithRelations<Movie>>
Adds a movie to the library, with its relations (tags, people), and returns it
as created. The server chooses its id, and refuses a movie whose external
ids (imdb, tmdb…) the library already has.
Sourcepub async fn update_movie(
&self,
movie_id: &str,
update: &MovieForUpdate,
) -> Result<ItemWithRelations<Movie>>
pub async fn update_movie( &self, movie_id: &str, update: &MovieForUpdate, ) -> Result<ItemWithRelations<Movie>>
Changes a movie and returns it, with its relations. Only the set fields change.
Sourcepub async fn get_movie_image(
&self,
movie_id: &str,
options: &ImageRequestOptions,
) -> Result<Vec<u8>>
pub async fn get_movie_image( &self, movie_id: &str, options: &ImageRequestOptions, ) -> Result<Vec<u8>>
An image of a movie, as the bytes of an image file: its poster, or the
options.kind asked. With defaulting, the background stands in for a missing
card.
Sourcepub async fn remove_movie(
&self,
movie_id: &str,
delete_medias: bool,
) -> Result<Movie>
pub async fn remove_movie( &self, movie_id: &str, delete_medias: bool, ) -> Result<Movie>
Removes a movie and returns it as it was. With delete_medias, its medias are
removed too, with their files (a virtual file’s source stays).
Sourcepub async fn set_movie_watched(&self, movie_id: &str, date: i64) -> Result<()>
pub async fn set_movie_watched(&self, movie_id: &str, date: i64) -> Result<()>
Marks a movie watched by the user at date (Unix milliseconds), or not watched
with a date of 0.
Sourcepub async fn set_movie_progress(
&self,
movie_id: &str,
progress: u64,
) -> Result<()>
pub async fn set_movie_progress( &self, movie_id: &str, progress: u64, ) -> Result<()>
Saves how far the user is in a movie. The server stores progress as given.
Sourcepub async fn add_searched_movie_media(
&self,
movie_id: &str,
request: &RsRequest,
) -> Result<Media>
pub async fn add_searched_movie_media( &self, movie_id: &str, request: &RsRequest, ) -> Result<Media>
Adds a file found by a source search to a movie: the server downloads
request and returns the media created.
Sourcepub async fn get_episodes(&self, query: &EpisodeQuery) -> Result<Vec<Episode>>
pub async fn get_episodes(&self, query: &EpisodeQuery) -> Result<Vec<Episode>>
The episodes of the library matching query (of all series without
serie_ref), like Self::get_tags. An episode’s id is
Episode::id: series, season and number.
Sourcepub async fn get_books(
&self,
query: &BookQuery,
) -> Result<Vec<ItemWithRelations<Book>>>
pub async fn get_books( &self, query: &BookQuery, ) -> Result<Vec<ItemWithRelations<Book>>>
The books of the library matching query, with their relations, like
Self::get_tags.
Sourcepub async fn get_book(&self, book_id: &str) -> Result<ItemWithRelations<Book>>
pub async fn get_book(&self, book_id: &str) -> Result<ItemWithRelations<Book>>
One book, with its relations.
Sourcepub async fn create_book(
&self,
book: &ItemWithRelations<Book>,
upsert_tags: bool,
upsert_people: bool,
upsert_serie: bool,
) -> Result<ItemWithRelations<Book>>
pub async fn create_book( &self, book: &ItemWithRelations<Book>, upsert_tags: bool, upsert_people: bool, upsert_serie: bool, ) -> Result<ItemWithRelations<Book>>
Adds a book to the library, with its relations, and returns it as created. The
server chooses its id. With upsert_tags, upsert_people or upsert_serie,
the tags, people or series its relations give in full (tags_details,
people_details, series_details) are created when the library lacks them.
Sourcepub async fn update_book(
&self,
book_id: &str,
update: &BookForUpdate,
) -> Result<ItemWithRelations<Book>>
pub async fn update_book( &self, book_id: &str, update: &BookForUpdate, ) -> Result<ItemWithRelations<Book>>
Changes a book and returns it, with its relations. Only the set fields change.
Sourcepub async fn get_book_image(
&self,
book_id: &str,
options: &ImageRequestOptions,
) -> Result<Vec<u8>>
pub async fn get_book_image( &self, book_id: &str, options: &ImageRequestOptions, ) -> Result<Vec<u8>>
An image of a book, as the bytes of an image file: its poster, or the
options.kind asked. With defaulting, the poster stands in for a missing
image of another type.
Sourcepub async fn remove_book(
&self,
book_id: &str,
delete_medias: bool,
) -> Result<Book>
pub async fn remove_book( &self, book_id: &str, delete_medias: bool, ) -> Result<Book>
Removes a book and returns it as it was. With delete_medias, its medias are
removed too, with their files (a virtual file’s source stays).
Sourcepub async fn set_book_watched(&self, book_id: &str, date: i64) -> Result<()>
pub async fn set_book_watched(&self, book_id: &str, date: i64) -> Result<()>
Marks a book read by the user at date (Unix milliseconds), or not read with a
date of 0.
Sourcepub async fn update_book_poster(
&self,
book_id: &str,
image: &[u8],
) -> Result<()>
pub async fn update_book_poster( &self, book_id: &str, image: &[u8], ) -> Result<()>
Sets the poster of a book to image, the bytes of an image file (JPEG, PNG,
WebP…): the server converts it.
Sourcepub async fn get_channels(&self, query: &ChannelQuery) -> Result<Vec<Channel>>
pub async fn get_channels(&self, query: &ChannelQuery) -> Result<Vec<Channel>>
The channels of the library matching query, with their tags and their
variants (one per quality). Page with limit and offset.
Sourcepub async fn get_channel_image(
&self,
channel_id: &str,
options: &ImageRequestOptions,
) -> Result<Vec<u8>>
pub async fn get_channel_image( &self, channel_id: &str, options: &ImageRequestOptions, ) -> Result<Vec<u8>>
The logo of a channel, as the bytes of an image file. The server has no other
image for a channel: it does not read defaulting.
Sourcepub async fn channel_image_url(
&self,
channel_id: &str,
options: &ImageRequestOptions,
) -> Result<AuthorizedUrl>
pub async fn channel_image_url( &self, channel_id: &str, options: &ImageRequestOptions, ) -> Result<AuthorizedUrl>
The URL of a channel’s logo and a token to open it, for an image view that fetches it itself. Needs an HTTP transport.
Sourcepub async fn add_tag_to_channel(
&self,
channel_id: &str,
tag_id: &str,
) -> Result<()>
pub async fn add_tag_to_channel( &self, channel_id: &str, tag_id: &str, ) -> Result<()>
Adds a tag to a channel.
Sourcepub async fn remove_tag_from_channel(
&self,
channel_id: &str,
tag_id: &str,
) -> Result<()>
pub async fn remove_tag_from_channel( &self, channel_id: &str, tag_id: &str, ) -> Result<()>
Removes a tag from a channel.
Sourcepub async fn channel_stream_url(
&self,
channel_id: &str,
quality: Option<&str>,
) -> Result<AuthorizedUrl>
pub async fn channel_stream_url( &self, channel_id: &str, quality: Option<&str>, ) -> Result<AuthorizedUrl>
The URL of a channel’s stream and a token to open it, for a player. quality
picks one of the channel’s variants; without it the server picks the best.
Needs an HTTP transport.
Sourcepub async fn channel_hls_url(
&self,
channel_id: &str,
quality: Option<&str>,
) -> Result<AuthorizedUrl>
pub async fn channel_hls_url( &self, channel_id: &str, quality: Option<&str>, ) -> Result<AuthorizedUrl>
The URL of a channel’s HLS playlist and a token to open it, for players that
need HLS: the server starts converting the stream when the playlist is read.
Stop it with Self::stop_channel_hls. Needs an HTTP transport.
Sourcepub async fn stop_channel_hls(&self, channel_id: &str) -> Result<()>
pub async fn stop_channel_hls(&self, channel_id: &str) -> Result<()>
Stops the HLS conversion of a channel, started by reading
Self::channel_hls_url.
Sourcepub async fn search_movies_stream(
&self,
lookup: &RsLookupMovie,
sources: &[String],
) -> Result<SearchStream<SearchResultGroup>>
pub async fn search_movies_stream( &self, lookup: &RsLookupMovie, sources: &[String], ) -> Result<SearchStream<SearchResultGroup>>
Searches the library’s metadata sources (plugins) for movies: by lookup.name,
narrowed by its people, series and tags. Each item is what one source
found. sources keeps only these sources (source paths or plugin ids; empty:
all). For more results of a source, send its next_page_key back in
lookup.page_key, with that source alone in sources. The server reads no
lookup.ids here.
Sourcepub async fn search_series_stream(
&self,
lookup: &RsLookupSerie,
sources: &[String],
) -> Result<SearchStream<SearchResultGroup>>
pub async fn search_series_stream( &self, lookup: &RsLookupSerie, sources: &[String], ) -> Result<SearchStream<SearchResultGroup>>
Searches the library’s metadata sources for series, like
Self::search_movies_stream.
Sourcepub async fn search_books_stream(
&self,
lookup: &RsLookupBook,
sources: &[String],
) -> Result<SearchStream<SearchResultGroup>>
pub async fn search_books_stream( &self, lookup: &RsLookupBook, sources: &[String], ) -> Result<SearchStream<SearchResultGroup>>
Searches the library’s metadata sources for books, like
Self::search_movies_stream, also by lookup.author and by the ISBN-13 of
lookup.ids (the only id the server reads here). The server refuses a search
with none of a name, an author, an ISBN or a filter.
Sourcepub async fn search_people_stream(
&self,
lookup: &RsLookupPerson,
sources: &[String],
) -> Result<SearchStream<SearchResultGroup>>
pub async fn search_people_stream( &self, lookup: &RsLookupPerson, sources: &[String], ) -> Result<SearchStream<SearchResultGroup>>
Searches the library’s metadata sources for people by lookup.name, like
Self::search_movies_stream, without filters.
Sourcepub async fn search_movie_medias_stream(
&self,
movie_id: &str,
name: Option<&str>,
sources: &[String],
page_key: Option<&str>,
) -> Result<SearchStream<SseLookupSearchEvent>>
pub async fn search_movie_medias_stream( &self, movie_id: &str, name: Option<&str>, sources: &[String], page_key: Option<&str>, ) -> Result<SearchStream<SseLookupSearchEvent>>
Searches the library’s sources (plugins) for files of a movie. Each item is
what one source found: its downloads, and their requests one by one in
results. Add one to the library with Self::add_searched_movie_media.
name replaces the movie’s name in the search. sources keeps only these
sources (source paths or plugin ids; empty: all). For more results of a
source, send its next_page_key back in page_key, with that source alone
in sources: the server refuses a page key otherwise.
Sourcepub async fn search_episode_medias_stream(
&self,
serie_id: &str,
season: u32,
number: u32,
name: Option<&str>,
sources: &[String],
page_key: Option<&str>,
) -> Result<SearchStream<SseLookupSearchEvent>>
pub async fn search_episode_medias_stream( &self, serie_id: &str, season: u32, number: u32, name: Option<&str>, sources: &[String], page_key: Option<&str>, ) -> Result<SearchStream<SseLookupSearchEvent>>
Searches the library’s sources for files of an episode, like
Self::search_movie_medias_stream; name replaces the name of the series.
Add one with Self::add_searched_episode_media.
Sourcepub async fn search_book_medias_stream(
&self,
book_id: &str,
name: Option<&str>,
sources: &[String],
page_key: Option<&str>,
) -> Result<SearchStream<SseLookupSearchEvent>>
pub async fn search_book_medias_stream( &self, book_id: &str, name: Option<&str>, sources: &[String], page_key: Option<&str>, ) -> Result<SearchStream<SseLookupSearchEvent>>
Searches the library’s sources for files of a book, like
Self::search_movie_medias_stream. Add one with Self::download_medias.
Sourcepub async fn process_request(&self, request: &RsRequest) -> Result<RsRequest>
pub async fn process_request(&self, request: &RsRequest) -> Result<RsRequest>
Runs a request through the library’s plugins and returns it processed: a link
turned into a direct one, a status that says what to do next
(RsRequest::status)…
Sourcepub async fn process_request_bytes(
&self,
request: &RsRequest,
) -> Result<Vec<u8>>
pub async fn process_request_bytes( &self, request: &RsRequest, ) -> Result<Vec<u8>>
Runs a request through the library’s plugins and returns what it gives, whole: an image behind a protected link, for example.
Sourcepub async fn check_request_permanent(
&self,
request: &RsRequest,
) -> Result<RsRequest>
pub async fn check_request_permanent( &self, request: &RsRequest, ) -> Result<RsRequest>
Asks the library’s plugins for a link to request that does not expire, to
keep it. Returns the request with that link and permanent set.
Sourcepub async fn add_request(
&self,
request: &RsRequest,
media_ref: Option<&str>,
) -> Result<RsRequestProcessing>
pub async fn add_request( &self, request: &RsRequest, media_ref: Option<&str>, ) -> Result<RsRequestProcessing>
Hands a request to a plugin that prepares it in the background (a debrid
service fetching a torrent, for example). Returns the task; its progress comes
with the request_processing events. media_ref ties it to a media.
A URL that streams what the request URL url gives, through the server and
its plugins, that anyone can open for 6 hours without the user’s token: for a
player. Needs an HTTP transport.
Sourcepub async fn get_deleted(&self, query: &DeletedQuery) -> Result<Vec<RsDeleted>>
pub async fn get_deleted(&self, query: &DeletedQuery) -> Result<Vec<RsDeleted>>
What was deleted from the library: with after, strictly after it (Unix
milliseconds). Page with limit and offset.
Sourcepub async fn set_passphrase(&self, passphrase: &str) -> Result<()>
pub async fn set_passphrase(&self, passphrase: &str) -> Result<()>
Sets the passphrase of an encrypted library. It is checked on the thumbnail of
one media when there is one: a wrong passphrase gives
Error::InvalidPassphrase, and a failure to fetch that thumbnail its own error.
Sourcepub fn clear_passphrase(&self)
pub fn clear_passphrase(&self)
Forgets the passphrase.