forked from mirrors/series-troxide
Fix typos (#91)
This commit is contained in:
@@ -71,6 +71,6 @@ Dockerized `Series Troxide` can be obtained [here](https://github.com/linuxserve
|
||||
|
||||
## Credits
|
||||
- The API used has been provided by TVmaze, you can check out the site [here](https://www.tvmaze.com/).
|
||||
- The Icons used have been provided by boostrap icons, you can check out the site [here](https://icons.getbootstrap.com/).
|
||||
- The Icons used have been provided by bootstrap icons, you can check out the site [here](https://icons.getbootstrap.com/).
|
||||
- The Graphical User Interface has been made using Iced, you can check out the site [here](https://iced.rs/).
|
||||
- The UI design has been inspired by the [Hobi Mobile app](https://hobiapp.com/)
|
||||
|
||||
@@ -58,7 +58,7 @@ pub mod import_shows {
|
||||
}
|
||||
|
||||
mod convert {
|
||||
//! Convert Trakt Shows to SerieTroxides' database Shows
|
||||
//! Convert Trakt Shows to SeriesTroxides' database Shows
|
||||
|
||||
use std::mem::ManuallyDrop;
|
||||
|
||||
@@ -217,7 +217,7 @@ pub mod user_credentials {
|
||||
use thiserror::Error;
|
||||
use tokio::fs;
|
||||
|
||||
use super::{authenication::TokenResponse, user_settings::UserSettings, ApiError};
|
||||
use super::{authentication::TokenResponse, user_settings::UserSettings, ApiError};
|
||||
use crate::core::paths;
|
||||
|
||||
const CREDENTIALS_FILENAME: &str = "credentials";
|
||||
@@ -560,7 +560,7 @@ pub mod trakt_data {
|
||||
}
|
||||
}
|
||||
|
||||
pub mod authenication {
|
||||
pub mod authentication {
|
||||
//! Authenticate the program to access user's trakt account
|
||||
|
||||
use super::{trakt_data::TraktStatusCode, ApiError};
|
||||
|
||||
@@ -9,7 +9,7 @@ const EPISODE_LIST_ADDRESS: &str = "https://api.tvmaze.com/shows/SERIES-ID/episo
|
||||
|
||||
/// # An `Episode` data according to the TVmaze api
|
||||
///
|
||||
/// This data discribes an episode found in a season of a particular series
|
||||
/// This data describes an episode found in a season of a particular series
|
||||
///
|
||||
/// ## Note
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ pub enum OriginalType {
|
||||
|
||||
/// Loads the image from the provided url
|
||||
///
|
||||
/// Since Original images from TvMaze may have extremely high resultion up to 4k which can cause `wgpu` to crash,
|
||||
/// Since Original images from TvMaze may have extremely high resolution up to 4k which can cause `wgpu` to crash,
|
||||
/// this function will thumbnail the original image to the size that is good enough to be displayed in the GUI.
|
||||
pub async fn load_image(image_url: String, image_type: ImageType) -> Option<Bytes> {
|
||||
loop {
|
||||
|
||||
@@ -10,7 +10,7 @@ const SCHEDULE_ON_DATE_ADDRESS: &str = "https://api.tvmaze.com/schedule/web?date
|
||||
// replace "COUNTRY" with an actual country ISO in ISO 3166-1 format
|
||||
const SCHEDULE_WITH_COUNTRY: &str = "https://api.tvmaze.com/schedule?country=COUNTRY";
|
||||
|
||||
// retreives list of all future episodes known to TVmaze, regardless of their country
|
||||
// retrieves list of all future episodes known to TVmaze, regardless of their country
|
||||
const FULL_SCHEDULE: &str = "https://api.tvmaze.com/schedule/full";
|
||||
|
||||
/// Retrieves episodes aired on a specific date through the provided optional &str
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::core::{
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
static ref TRACKED_SERIES_INFORMATIONS_REQUEST_LOCK: tokio::sync::Mutex<()> =
|
||||
static ref TRACKED_SERIES_INFORMATION_REQUEST_LOCK: tokio::sync::Mutex<()> =
|
||||
tokio::sync::Mutex::new(());
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ impl SeriesList {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub async fn get_untracked_series_informations(
|
||||
pub async fn get_untracked_series_information(
|
||||
&self,
|
||||
) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
let untracked_ids: Vec<u32> = self
|
||||
@@ -61,22 +61,22 @@ impl SeriesList {
|
||||
.map(|id| tokio::spawn(series_information::get_series_main_info_with_id(*id)))
|
||||
.collect();
|
||||
|
||||
let mut series_informations = Vec::with_capacity(handles.len());
|
||||
let mut series_information = Vec::with_capacity(handles.len());
|
||||
for handle in handles {
|
||||
series_informations.push(handle.await??)
|
||||
series_information.push(handle.await??)
|
||||
}
|
||||
|
||||
Ok(series_informations)
|
||||
Ok(series_information)
|
||||
}
|
||||
|
||||
pub async fn get_tracked_series_informations(
|
||||
pub async fn get_tracked_series_information(
|
||||
&self,
|
||||
) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
// Since diferrent methods can end up calling this same method, they will end up doing
|
||||
// multiple unecessary api request if the data is not cached, this lock makes the first
|
||||
// Since different methods can end up calling this same method, they will end up doing
|
||||
// multiple unnecessary api request if the data is not cached, this lock makes the first
|
||||
// code to call this method to do all the work first and the other methods will eventually
|
||||
// read from the cache
|
||||
let _ = TRACKED_SERIES_INFORMATIONS_REQUEST_LOCK.lock().await;
|
||||
let _ = TRACKED_SERIES_INFORMATION_REQUEST_LOCK.lock().await;
|
||||
|
||||
let tracked_ids: Vec<u32> = self
|
||||
.get_tracked_series_ids()
|
||||
@@ -95,17 +95,17 @@ impl SeriesList {
|
||||
.map(|id| tokio::spawn(series_information::get_series_main_info_with_id(*id)))
|
||||
.collect();
|
||||
|
||||
let mut series_informations = Vec::with_capacity(handles.len());
|
||||
let mut series_information = Vec::with_capacity(handles.len());
|
||||
for handle in handles {
|
||||
series_informations.push(handle.await??)
|
||||
series_information.push(handle.await??)
|
||||
}
|
||||
|
||||
Ok(series_informations)
|
||||
Ok(series_information)
|
||||
}
|
||||
|
||||
/// Gets the series informations of all the series in the database
|
||||
pub async fn get_all_series_informations(&self) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
let _ = TRACKED_SERIES_INFORMATIONS_REQUEST_LOCK.lock().await;
|
||||
/// Gets the series information of all the series in the database
|
||||
pub async fn get_all_series_information(&self) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
let _ = TRACKED_SERIES_INFORMATION_REQUEST_LOCK.lock().await;
|
||||
|
||||
let handles: Vec<_> = self
|
||||
.series_list
|
||||
@@ -116,40 +116,40 @@ impl SeriesList {
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut series_informations = Vec::with_capacity(handles.len());
|
||||
let mut series_information = Vec::with_capacity(handles.len());
|
||||
for handle in handles {
|
||||
series_informations.push(handle.await??)
|
||||
series_information.push(handle.await??)
|
||||
}
|
||||
|
||||
Ok(series_informations)
|
||||
Ok(series_information)
|
||||
}
|
||||
|
||||
pub async fn get_running_tracked_series_informations(
|
||||
pub async fn get_running_tracked_series_information(
|
||||
&self,
|
||||
) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
Ok(self
|
||||
.get_tracked_series_informations()
|
||||
.get_tracked_series_information()
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter(|series_info| series_info.status != "Ended")
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub async fn get_ended_tracked_series_informations(
|
||||
pub async fn get_ended_tracked_series_information(
|
||||
&self,
|
||||
) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
Ok(self
|
||||
.get_tracked_series_informations()
|
||||
.get_tracked_series_information()
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter(|series_info| series_info.status == "Ended")
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub async fn get_waiting_release_series_informations(
|
||||
pub async fn get_waiting_release_series_information(
|
||||
&self,
|
||||
) -> anyhow::Result<Vec<SeriesMainInformation>> {
|
||||
let series_infos = self.get_running_tracked_series_informations().await?;
|
||||
let series_infos = self.get_running_tracked_series_information().await?;
|
||||
|
||||
let mut episode_list_handles = Vec::with_capacity(series_infos.len());
|
||||
for series_info in series_infos.iter() {
|
||||
@@ -171,10 +171,10 @@ impl SeriesList {
|
||||
Ok(waiting_releases_series_infos)
|
||||
}
|
||||
|
||||
pub async fn get_upcoming_release_series_informations_and_episodes(
|
||||
pub async fn get_upcoming_release_series_information_and_episodes(
|
||||
&self,
|
||||
) -> anyhow::Result<Vec<(SeriesMainInformation, Episode, EpisodeReleaseTime)>> {
|
||||
let series_infos = self.get_running_tracked_series_informations().await?;
|
||||
let series_infos = self.get_running_tracked_series_information().await?;
|
||||
let mut waiting_releases_series_infos = Vec::with_capacity(series_infos.len());
|
||||
|
||||
let handles: Vec<_> = series_infos
|
||||
|
||||
@@ -61,7 +61,7 @@ pub mod cli_handler {
|
||||
|
||||
let mut paths = paths::PATHS.write().expect("failed to write to paths");
|
||||
|
||||
// Priotizing the cli paths over the settings config paths
|
||||
// Prioritizing the cli paths over the settings config paths
|
||||
if let Some(cache_dir_path) = cli.cache_dir {
|
||||
paths.set_cache_dir_path(cache_dir_path)
|
||||
} else if let Some(cache_dir_path) = settings_custom_paths.cache_dir.clone() {
|
||||
|
||||
@@ -85,7 +85,7 @@ impl Database {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// get series ids and their corrensponding series structures
|
||||
/// get series ids and their corresponding series structures
|
||||
pub fn get_ids_and_series(&self) -> Vec<(String, Series)> {
|
||||
self.db
|
||||
.iter()
|
||||
@@ -190,7 +190,7 @@ impl Series {
|
||||
/// # Note
|
||||
/// This method is automatically called when Series object goes out of scope
|
||||
/// as self.update() is called in it's drop implementation, hence no need of
|
||||
/// calling it unless if you want imediate update i.e. there is some code that
|
||||
/// calling it unless if you want immediate update i.e. there is some code that
|
||||
/// would take time to run before the object is dropped.
|
||||
pub fn update(&self) {
|
||||
DB.add_series(self.id, self);
|
||||
|
||||
@@ -86,7 +86,7 @@ impl TroxideNotify {
|
||||
Signal::NotificationSent => {
|
||||
/*
|
||||
When a new episode has been notified, when can't keep on using the same obtained episode releases as it might
|
||||
turn out that that series is being released regulary(weekly) and thus the currently obtained releases won't
|
||||
turn out that that series is being released regularly(weekly) and thus the currently obtained releases won't
|
||||
have that information. So we just abort all the handles to reobtain all the releases information in the next
|
||||
iteration of the loop.
|
||||
*/
|
||||
@@ -134,7 +134,7 @@ impl TroxideNotify {
|
||||
async fn get_releases_with_duration_to_release() -> Vec<(SeriesMainInformation, Episode, Duration)>
|
||||
{
|
||||
series_list::SeriesList::new()
|
||||
.get_upcoming_release_series_informations_and_episodes()
|
||||
.get_upcoming_release_series_information_and_episodes()
|
||||
.await
|
||||
.context("failed to get upcoming series releases")
|
||||
.unwrap()
|
||||
|
||||
@@ -120,7 +120,7 @@ pub mod time {
|
||||
///
|
||||
/// For example, if in the split you got 5 days as the longest duration, the duration
|
||||
/// returned will be 1 day
|
||||
/// This is usefull in refreshing the upcoming episodes in the gui as if an episode is released
|
||||
/// This is useful in refreshing the upcoming episodes in the gui as if an episode is released
|
||||
/// in 5 hours, we want to refresh every 1 hour, or say 10 minutes, we will want to refresh in every
|
||||
/// minute and so on
|
||||
pub fn get_longest_unit_duration(&self) -> Option<Duration> {
|
||||
|
||||
@@ -281,7 +281,7 @@ mod cast_poster {
|
||||
text(format!("as {}", &self.cast.character.name)).size(11)
|
||||
]);
|
||||
|
||||
// A little bit of space between cast name and other informations
|
||||
// A little bit of space between cast name and other information
|
||||
cast_info = cast_info.push(horizontal_space(20));
|
||||
|
||||
if let Some(gender) = self.cast.person.gender.as_ref() {
|
||||
|
||||
@@ -43,7 +43,7 @@ impl<'a> MyShows<'a> {
|
||||
Command::perform(
|
||||
async {
|
||||
caching::series_list::SeriesList::new()
|
||||
.get_ended_tracked_series_informations()
|
||||
.get_ended_tracked_series_information()
|
||||
.await
|
||||
},
|
||||
move |res| Message::SeriesInformationReceived(res.ok()),
|
||||
@@ -63,7 +63,7 @@ impl<'a> MyShows<'a> {
|
||||
Command::perform(
|
||||
async {
|
||||
caching::series_list::SeriesList::new()
|
||||
.get_waiting_release_series_informations()
|
||||
.get_waiting_release_series_information()
|
||||
.await
|
||||
},
|
||||
|res| Message::SeriesInformationReceived(res.ok()),
|
||||
@@ -83,7 +83,7 @@ impl<'a> MyShows<'a> {
|
||||
Command::perform(
|
||||
async {
|
||||
caching::series_list::SeriesList::new()
|
||||
.get_untracked_series_informations()
|
||||
.get_untracked_series_information()
|
||||
.await
|
||||
},
|
||||
|res| Message::SeriesInformationReceived(res.ok()),
|
||||
|
||||
@@ -140,7 +140,7 @@ fn load_upcoming_releases() -> Command<Message> {
|
||||
Command::perform(
|
||||
async {
|
||||
caching::series_list::SeriesList::new()
|
||||
.get_upcoming_release_series_informations_and_episodes()
|
||||
.get_upcoming_release_series_information_and_episodes()
|
||||
.await
|
||||
},
|
||||
|res| Message::SeriesInformationReceived(res.ok()),
|
||||
|
||||
@@ -257,7 +257,7 @@ fn credit_widget() -> Element<'static, Message, Renderer> {
|
||||
mouse_area(go_to_site_text.clone()).on_press(Message::TvMaze)
|
||||
];
|
||||
let bootstrap_icons = row![
|
||||
text("- The Icons used have been provided by boostrap icons, you can check out the site ")
|
||||
text("- The Icons used have been provided by bootstrap icons, you can check out the site ")
|
||||
.size(11),
|
||||
mouse_area(go_to_site_text.clone()).on_press(Message::BootstrapIcons)
|
||||
];
|
||||
|
||||
@@ -5,7 +5,7 @@ use iced::widget::{
|
||||
use iced::{Alignment, Command, Element, Length, Renderer};
|
||||
use iced_aw::Spinner;
|
||||
|
||||
use crate::core::api::trakt::authenication::{self, CodeResponse, TokenResponse};
|
||||
use crate::core::api::trakt::authentication::{self, CodeResponse, TokenResponse};
|
||||
use crate::core::api::trakt::trakt_data::TraktShow;
|
||||
use crate::core::api::trakt::user_credentials::{self, Client, Credentials, CredentialsError};
|
||||
use crate::core::api::trakt::user_settings::{self, UserSettings};
|
||||
@@ -99,10 +99,10 @@ impl TraktIntegration {
|
||||
}
|
||||
}
|
||||
Message::ProgramAuthenticationPage(message) => {
|
||||
if let Some(SetupStep::ProgramAuthentication(program_authenication_page)) =
|
||||
if let Some(SetupStep::ProgramAuthentication(program_authentication_page)) =
|
||||
self.setup_page.as_mut()
|
||||
{
|
||||
program_authenication_page
|
||||
program_authentication_page
|
||||
.update(message, &mut next_page)
|
||||
.map(Message::ProgramAuthenticationPage)
|
||||
} else {
|
||||
@@ -415,13 +415,13 @@ impl ClientPage {
|
||||
return match self.client_page_mode {
|
||||
ClientPageMode::AccountConfiguration => match &self.client {
|
||||
Ok(client) => Command::perform(
|
||||
authenication::get_device_code_response(client.client_id.clone()),
|
||||
authentication::get_device_code_response(client.client_id.clone()),
|
||||
|res| {
|
||||
ClientPageMessage::CodeReceived(res.map_err(|err| err.to_string()))
|
||||
},
|
||||
),
|
||||
Err(_) => Command::perform(
|
||||
authenication::get_device_code_response(self.client_id.clone()),
|
||||
authentication::get_device_code_response(self.client_id.clone()),
|
||||
|res| {
|
||||
ClientPageMessage::CodeReceived(res.map_err(|err| err.to_string()))
|
||||
},
|
||||
@@ -896,7 +896,9 @@ impl ImportPage {
|
||||
}
|
||||
|
||||
mod code_authentication {
|
||||
use crate::core::api::trakt::authenication::{get_token_response, CodeResponse, TokenResponse};
|
||||
use crate::core::api::trakt::authentication::{
|
||||
get_token_response, CodeResponse, TokenResponse,
|
||||
};
|
||||
use crate::core::api::trakt::user_credentials::Client;
|
||||
|
||||
use iced::futures::channel::mpsc;
|
||||
|
||||
@@ -52,7 +52,7 @@ impl<'a> WatchlistTab<'a> {
|
||||
scrollable_offset: scrollable_offset.unwrap_or(RelativeOffset::START),
|
||||
},
|
||||
Command::perform(
|
||||
get_series_informations_and_watched_episodes(),
|
||||
get_series_information_and_watched_episodes(),
|
||||
Message::SeriesInformationLoaded,
|
||||
),
|
||||
)
|
||||
@@ -170,14 +170,14 @@ fn has_pending_episodes(database_series: &database::Series, episodes_list: &Epis
|
||||
episodes_list.get_total_watchable_episodes() != database_series.get_total_episodes()
|
||||
}
|
||||
|
||||
async fn get_series_informations_and_watched_episodes(
|
||||
async fn get_series_information_and_watched_episodes(
|
||||
) -> Vec<(SeriesMainInformation, EpisodeList, usize)> {
|
||||
let tracked_series_informations = series_list::SeriesList::new()
|
||||
.get_tracked_series_informations()
|
||||
let tracked_series_information = series_list::SeriesList::new()
|
||||
.get_tracked_series_information()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let episode_lists_handles: Vec<_> = tracked_series_informations
|
||||
let episode_lists_handles: Vec<_> = tracked_series_information
|
||||
.iter()
|
||||
.map(|series_info| tokio::spawn(caching::episode_list::EpisodeList::new(series_info.id)))
|
||||
.collect();
|
||||
@@ -192,7 +192,7 @@ async fn get_series_informations_and_watched_episodes(
|
||||
episodes_lists.push(episode_list);
|
||||
}
|
||||
|
||||
tracked_series_informations
|
||||
tracked_series_information
|
||||
.into_iter()
|
||||
.zip(episodes_lists.into_iter())
|
||||
.filter(|(series_info, episode_list)| {
|
||||
|
||||
Reference in New Issue
Block a user