Skip to content

Commit 14dd13b

Browse files
authored
General enhancements (#669)
* feat(database): add column to associate measurement with workout * feat(backend): generate new entities * feat(frontend): allow associating measurement with workout * Revert "feat(frontend): allow associating measurement with workout" This reverts commit b305c07. * Revert "feat(backend): generate new entities" This reverts commit e531ffb. * Revert "feat(database): add column to associate measurement with workout" This reverts commit 95165a8. * fix(frontend): close adjust workout time * feat(frontend): display episode name * fix(frontend): space b/w episode name and completed date * refactor(database): change order of enum declarations * feat(database): add migration for new notifications array * feat(backend): adjust to new database schema * fix(databse): build correct json object * chore(graphql): adjust to new schema * feat: add new notification type * feat(frontend): adapt to new gql schema * feat: do not allow updating default collections * fix(backend): allow not changing only default collection's names * fix(backend): use correct filter for sending review notifications * feat(frontend): debounce search query * fix(backend): better error handling for shows/podcasts * perf(backend): create partial metadata instead of full ones * fix(backend): handle cases when no images * feat(backend): commit title to db media import * fix(backend): get correct title for trakt items * fix(backend): incorrect clone of title * feat(frontend): change title for mal importer * fix(backend): change wording * feat(frontend): common component to add search input * refactor(frontend): use new component for searching * chore(frontend): change wording for imports * feat(database): change migration to set new key * feat(backend): add new field to notifications * feat(frontend): allow changing new notifications enabled * fix(frontend): styles for switches * feat(frontend): change hierarchy of components * feat(backend): respect new config parameter * chore(backend): add logging when sending notifications * fix(frontend): use more specific wording for notif label * refactor(backend): change name of func * ci(backend): bump version * fix(frontend): allow deleting reviews * feat(backend): send notifications for reviews of only monitored media
1 parent 56209d8 commit 14dd13b

35 files changed

+660
-634
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ryot"
3-
version = "4.2.11"
3+
version = "4.2.12"
44
edition = "2021"
55
repository = "https://github.com/IgnisDa/ryot"
66
license = "GPL-3.0"

apps/backend/src/importer/audiobookshelf.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ pub async fn import(input: DeployAudiobookshelfImportInput) -> Result<ImportResu
8383
let lot = MetadataLot::AudioBook;
8484
if let Some(asin) = metadata.asin {
8585
media.push(ImportOrExportMediaItem {
86-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(
87-
asin,
88-
)),
86+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
87+
identifier: asin,
88+
title: metadata.title.clone().unwrap_or_default(),
89+
}),
8990
lot,
9091
source: MetadataSource::Audible,
9192
source_id: metadata.title.unwrap_or_default(),

apps/backend/src/importer/generic_json.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ pub async fn import(input: DeployGenericJsonImportInput) -> Result<ImportResult>
1414
.media
1515
.unwrap();
1616
media.iter_mut().for_each(|m| {
17-
m.internal_identifier = Some(ImportOrExportItemIdentifier::NeedsDetails(
18-
m.identifier.clone(),
19-
))
17+
m.internal_identifier = Some(ImportOrExportItemIdentifier::NeedsDetails {
18+
identifier: m.identifier.clone(),
19+
title: m.source_id.clone(),
20+
})
2021
});
2122
Ok(ImportResult {
2223
collections: vec![],

apps/backend/src/importer/goodreads.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,14 @@ pub async fn import(
131131
});
132132
}
133133
media.push(ImportOrExportMediaItem {
134-
source_id: record.title,
134+
source_id: record.title.clone(),
135135
lot,
136136
source,
137137
identifier: record.id,
138-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(identifier)),
138+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
139+
identifier,
140+
title: record.title,
141+
}),
139142
seen_history,
140143
reviews,
141144
collections,

apps/backend/src/importer/mal.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ fn convert_to_format(item: Item, lot: MetadataLot) -> ImportOrExportMediaItem {
6262
..Default::default()
6363
};
6464
ImportOrExportMediaItem {
65-
source_id: item.title,
65+
source_id: item.title.clone(),
6666
lot,
6767
source: MetadataSource::Mal,
68-
identifier: "".to_string(),
69-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(
70-
item.identifier.to_string(),
71-
)),
68+
identifier: item.title.clone(),
69+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
70+
identifier: item.identifier.to_string(),
71+
title: item.title,
72+
}),
7273
seen_history: vec![seen_item],
7374
reviews: vec![review_item],
7475
collections: vec![],

apps/backend/src/importer/media_tracker.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ pub async fn import(input: DeployMediaTrackerImportInput) -> Result<ImportResult
316316
book_specifics: Some(BookSpecifics { pages: num_pages }),
317317
..Default::default()
318318
})),
319-
true => ImportOrExportItemIdentifier::NeedsDetails(identifier),
319+
true => ImportOrExportItemIdentifier::NeedsDetails {
320+
identifier,
321+
title: details.title,
322+
},
320323
}),
321324
reviews: Vec::from_iter(details.user_rating.map(|r| {
322325
let review = if let Some(_s) = r.clone().review {

apps/backend/src/importer/mod.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ use crate::{
2323
fitness::UserWorkoutInput,
2424
media::{
2525
CreateOrUpdateCollectionInput, ImportOrExportItemIdentifier, ImportOrExportMediaItem,
26-
PostReviewInput, ProgressUpdateInput,
26+
PartialMetadataWithoutId, PostReviewInput, ProgressUpdateInput,
2727
},
28-
BackgroundJob, ChangeCollectionToEntityInput,
28+
BackgroundJob, ChangeCollectionToEntityInput, IdObject,
2929
},
3030
traits::AuthProvider,
3131
users::UserReviewScale,
@@ -358,14 +358,22 @@ impl ImporterService {
358358
for (idx, item) in import.media.iter().enumerate() {
359359
tracing::debug!(
360360
"Importing media with identifier = {iden}",
361-
iden = item.source_id
361+
iden = &item.source_id
362362
);
363363
let identifier = item.internal_identifier.clone().unwrap();
364364
let data = match identifier {
365-
ImportOrExportItemIdentifier::NeedsDetails(i) => {
366-
self.media_service
367-
.commit_media(item.lot, item.source, &i)
368-
.await
365+
ImportOrExportItemIdentifier::NeedsDetails { identifier, title } => {
366+
let resp = self
367+
.media_service
368+
.create_partial_metadata(PartialMetadataWithoutId {
369+
identifier,
370+
title,
371+
image: None,
372+
lot: item.lot,
373+
source: item.source,
374+
})
375+
.await;
376+
resp.map(|r| IdObject { id: r.id })
369377
}
370378
ImportOrExportItemIdentifier::AlreadyFilled(a) => {
371379
self.media_service

apps/backend/src/importer/movary.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ pub async fn import(input: DeployMovaryImportInput) -> Result<ImportResult> {
6767
}
6868
};
6969
media.push(ImportOrExportMediaItem {
70-
source_id: record.common.title,
70+
source_id: record.common.title.clone(),
7171
lot,
7272
source,
73-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(
74-
record.common.tmdb_id.to_string(),
75-
)),
73+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
74+
identifier: record.common.tmdb_id.to_string(),
75+
title: record.common.title,
76+
}),
7677
identifier: "".to_string(),
7778
seen_history: vec![],
7879
reviews: vec![ImportOrExportItemRating {
@@ -98,12 +99,13 @@ pub async fn import(input: DeployMovaryImportInput) -> Result<ImportResult> {
9899
}
99100
};
100101
media.push(ImportOrExportMediaItem {
101-
source_id: record.title,
102+
source_id: record.title.clone(),
102103
lot,
103104
source,
104-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(
105-
record.tmdb_id.to_string(),
106-
)),
105+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
106+
identifier: record.tmdb_id.to_string(),
107+
title: record.title,
108+
}),
107109
identifier: "".to_string(),
108110
seen_history: vec![],
109111
reviews: vec![],
@@ -160,13 +162,14 @@ pub async fn import(input: DeployMovaryImportInput) -> Result<ImportResult> {
160162
})
161163
}
162164
media.push(ImportOrExportMediaItem {
163-
source_id: record.common.title,
165+
source_id: record.common.title.clone(),
164166
lot,
165167
source,
166168
identifier: "".to_string(),
167-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(
168-
record.common.tmdb_id.to_string(),
169-
)),
169+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
170+
identifier: record.common.tmdb_id.to_string(),
171+
title: record.common.title,
172+
}),
170173
seen_history: vec![seen_item],
171174
reviews,
172175
collections: vec![],

apps/backend/src/importer/story_graph.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ pub async fn import(
109109
collections.extend(t.split(", ").map(|d| d.to_case(Case::Title)))
110110
}
111111
media.push(ImportOrExportMediaItem {
112-
source_id: record.title,
112+
source_id: record.title.clone(),
113113
lot,
114114
source,
115115
identifier: "".to_string(),
116-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(
116+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
117117
identifier,
118-
)),
118+
title: record.title,
119+
}),
119120
seen_history,
120121
reviews: vec![ImportOrExportItemRating {
121122
rating: record

apps/backend/src/importer/trakt.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ pub async fn import(input: DeployTraktImportInput) -> Result<ImportResult> {
227227
fn process_item(
228228
i: &ListItemResponse,
229229
) -> std::result::Result<ImportOrExportMediaItem, ImportFailedItem> {
230-
let (source_id, identifier, lot) = if let Some(d) = i.movie.as_ref() {
231-
(d.ids.trakt, d.ids.tmdb, MetadataLot::Movie)
230+
let (source_id, identifier, lot, title) = if let Some(d) = i.movie.as_ref() {
231+
(d.ids.trakt, d.ids.tmdb, MetadataLot::Movie, d.title.clone())
232232
} else if let Some(d) = i.show.as_ref() {
233-
(d.ids.trakt, d.ids.tmdb, MetadataLot::Show)
233+
(d.ids.trakt, d.ids.tmdb, MetadataLot::Show, d.title.clone())
234234
} else {
235235
return Err(ImportFailedItem {
236236
lot: None,
@@ -239,12 +239,16 @@ fn process_item(
239239
error: Some("Item is neither a movie or a show".to_owned()),
240240
});
241241
};
242+
let title = title.unwrap_or_default();
242243
match identifier {
243244
Some(i) => Ok(ImportOrExportMediaItem {
244245
source_id: source_id.to_string(),
245246
lot,
246-
identifier: "".to_string(),
247-
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails(i.to_string())),
247+
identifier: title.clone(),
248+
internal_identifier: Some(ImportOrExportItemIdentifier::NeedsDetails {
249+
identifier: i.to_string(),
250+
title,
251+
}),
248252
source: MetadataSource::Tmdb,
249253
seen_history: vec![],
250254
reviews: vec![],

0 commit comments

Comments
 (0)