Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar model #697

Open
wants to merge 23 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e11d987
feat(calendar): constants - Add calendar storage key, max calendar it…
elpiel Jun 11, 2024
a3b0a0b
feat(calendar): action - PullCalendar
elpiel Jun 11, 2024
025e254
feat(calendar): CalendarBucket & CalendarItem
elpiel Jun 11, 2024
c1836ed
feat(calendar): Push Calendar Event & Internal PullCalendar & Calenda…
elpiel Jun 11, 2024
f948ff8
feat(calendar): Ctx - update_calendar
elpiel Jun 11, 2024
61b8a1a
docs(notifs): NotificationsBucket - Add docs
elpiel Jun 11, 2024
cc6ca85
fix: tests
elpiel Jun 11, 2024
2e623f0
chore: Fix docs and extract constants
elpiel Jun 12, 2024
63df83d
feat: Calendar model
elpiel Jun 13, 2024
067d07e
chore: Update docs
elpiel Jun 13, 2024
caf8677
chore: Calendar model - flatten CalendarBucket
elpiel Jun 13, 2024
17bfad5
feat: impl calendar model
tymmesyde Jun 17, 2024
b2742bd
test(calendar): add load action unit test for calendar
tymmesyde Jun 17, 2024
5a2cf79
fix(calendar): return only items added to library
tymmesyde Jun 17, 2024
5db1bc3
test(calendar): fmt
tymmesyde Jun 18, 2024
00d0a6a
refactor(deep_links): simplify CalendarDeepLinks From impl
tymmesyde Jun 18, 2024
6159ef2
feat(calendar): return today in month_info
tymmesyde Jun 18, 2024
a82e55d
refactor(calendar): remove selectable effects in resource request result
tymmesyde Jun 18, 2024
5c91660
fix(calendar): fmt
tymmesyde Jun 18, 2024
fcb0b66
refactor(runtime): remove unused messages
tymmesyde Jun 18, 2024
84abd39
Merge branch 'development' of https://github.com/Stremio/stremio-core…
tymmesyde Jun 24, 2024
f2940f6
Merge branch 'development' of https://github.com/Stremio/stremio-core…
tymmesyde Jul 24, 2024
cb67d0f
feat(stremio-core-web): serialize calendar
tymmesyde Jul 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub const LIBRARY_RECENT_STORAGE_KEY: &str = "library_recent";
pub const STREAMS_STORAGE_KEY: &str = "streams";
pub const SEARCH_HISTORY_STORAGE_KEY: &str = "search_history";
pub const NOTIFICATIONS_STORAGE_KEY: &str = "notifications";
pub const CALENDAR_STORAGE_KEY: &str = "calendar";
pub const DISMISSED_EVENTS_STORAGE_KEY: &str = "dismissed_events";
pub const LIBRARY_COLLECTION_NAME: &str = "libraryItem";
pub const SEARCH_EXTRA_NAME: &str = "search";
Expand All @@ -26,6 +27,8 @@ pub const CATALOG_PAGE_SIZE: usize = 100;
pub const CATALOG_PREVIEW_SIZE: usize = 100;
pub const LIBRARY_RECENT_COUNT: usize = 200;
pub const NOTIFICATION_ITEMS_COUNT: usize = 100;
/// Maximum calendar items to fetch from `calendarIds` resource
pub const CALENDAR_ITEMS_COUNT: usize = 100;

/// A `LibraryItem` is considered watched once we've watched more than the `duration * threshold`:
///
Expand Down Expand Up @@ -104,6 +107,12 @@ lazy_static! {
options: vec![],
options_limit: OptionsLimit(1),
};
pub static ref CALENDAR_IDS_EXTRA_PROP: ExtraProp = ExtraProp {
name: "calendarVideosIds".to_owned(),
is_required: false,
options: vec![],
options_limit: OptionsLimit(1),
};
pub static ref TYPE_PRIORITIES: HashMap<&'static str, i32> = vec![
("all", 5),
("movie", 4),
Expand Down
36 changes: 35 additions & 1 deletion src/deep_links/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use url::Url;
use crate::{
constants::URI_COMPONENT_ENCODE_SET,
models::{
installed_addons_with_filters::InstalledAddonsRequest, library_with_filters::LibraryRequest,
calendar::Date, installed_addons_with_filters::InstalledAddonsRequest,
library_with_filters::LibraryRequest,
},
types::{
addon::{ExtraValue, ResourcePath, ResourceRequest},
Expand Down Expand Up @@ -610,6 +611,39 @@ impl From<(&String, &LibraryRequest)> for LibraryDeepLinks {
}
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CalendarDeepLinks {
pub calendar: String,
}

impl From<&Date> for CalendarDeepLinks {
fn from(date: &Date) -> Self {
Self {
calendar: format!("stremio:///calendar/{}/{}", date.year, date.month),
}
}
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CalendarItemDeepLinks {
pub meta_details_streams: String,
}

impl From<(&MetaItem, &Video)> for CalendarItemDeepLinks {
fn from((meta_item, video): (&MetaItem, &Video)) -> Self {
CalendarItemDeepLinks {
meta_details_streams: format!(
"stremio:///detail/{}/{}/{}",
utf8_percent_encode(&meta_item.preview.r#type, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&meta_item.preview.id, URI_COMPONENT_ENCODE_SET),
utf8_percent_encode(&video.id, URI_COMPONENT_ENCODE_SET)
),
}
}
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SearchHistoryItemDeepLinks {
Expand Down
Loading
Loading