Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions server/src/db/programQueryHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ export const AllProgramFields = [
'program.plexFilePath',
'program.plexRatingKey',
'program.rating',
'program.audienceRating',
'program.criticRating',
'program.seasonIcon',
'program.seasonNumber',
'program.seasonUuid',
Expand Down
3 changes: 3 additions & 0 deletions server/src/db/schema/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
check,
index,
integer,
real,
sqliteTable,
text,
uniqueIndex,
Expand Down Expand Up @@ -79,6 +80,8 @@ export const Program = sqliteTable(
plexFilePath: text(),
plexRatingKey: text(),
rating: text(),
audienceRating: real(),
criticRating: real(),
seasonIcon: text(),
seasonNumber: integer(),
seasonUuid: text().references(() => ProgramGrouping.uuid),
Expand Down
12 changes: 12 additions & 0 deletions server/src/external/jellyfin/JellyfinApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ const RequiredLibraryFields = [
'OfficialRating',
'MediaStreams',
'MediaSources',
'ProductionLocations',
'CommunityRating',
'CriticRating',
];

function getJellyfinAuthorization(
Expand Down Expand Up @@ -1026,6 +1029,10 @@ export class JellyfinApiClient extends MediaSourceApiClient<JellyfinItemTypes> {
}),
plot: movie.Overview ?? null,
rating: movie.OfficialRating ?? null,
countries: movie.ProductionLocations?.map((loc) => ({ name: loc })) ?? [],
collections: [],
audienceRating: movie.CommunityRating ?? null,
criticRating: movie.CriticRating ?? null,
sourceType: 'jellyfin',
tagline: find(movie.Taglines, isNonEmptyString) ?? null,
tags: movie.Tags?.filter(isNonEmptyString) ?? [],
Expand Down Expand Up @@ -1242,6 +1249,11 @@ export class JellyfinApiClient extends MediaSourceApiClient<JellyfinItemTypes> {
}),
plot: series.Overview ?? null,
rating: series.OfficialRating ?? null,
countries:
series.ProductionLocations?.map((loc) => ({ name: loc })) ?? [],
collections: [],
audienceRating: series.CommunityRating ?? null,
criticRating: series.CriticRating ?? null,
sourceType: 'jellyfin',
tagline: find(series.Taglines, isNonEmptyString) ?? null,
tags: series.Tags?.filter(isNonEmptyString) ?? [],
Expand Down
8 changes: 8 additions & 0 deletions server/src/external/plex/PlexApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1186,11 +1186,15 @@ export class PlexApiClient extends MediaSourceApiClient<PlexTypes> {
releaseDateString: releaseDate?.format() ?? null,
actors: plexActorInject(plexShow.Role),
genres: plexJoinItemInject(plexShow.Genre),
countries: plexJoinItemInject(plexShow.Country),
collections: plexJoinItemInject(plexShow.Collection),
plot: plexShow.summary ?? null,
studios: isNonEmptyString(plexShow.studio)
? [{ name: plexShow.studio }]
: [],
rating: plexShow.contentRating ?? null,
audienceRating: plexShow.audienceRating ?? null,
criticRating: null,
summary: null,
tagline: plexShow.tagline ?? null,
identifiers: [
Expand Down Expand Up @@ -1538,10 +1542,14 @@ export class PlexApiClient extends MediaSourceApiClient<PlexTypes> {
writers: plexWriterInject(plexMovie.Writer),
studios,
genres: plexMovie.Genre?.map(({ tag }) => ({ name: tag })) ?? [],
countries: plexJoinItemInject(plexMovie.Country),
collections: plexJoinItemInject(plexMovie.Collection),
summary: plexMovie.summary ?? null,
plot: null,
tagline: plexMovie.tagline ?? null,
rating: plexMovie.contentRating ?? null,
audienceRating: plexMovie.audienceRating ?? null,
criticRating: plexMovie.rating ?? null,
tags: plexMovie.Label?.map((label) => label.tag) ?? [],
externalId: plexMovie.ratingKey,
identifiers: [
Expand Down
3 changes: 3 additions & 0 deletions server/src/migration/DirectMigrationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ export class DirectMigrationProvider implements MigrationProvider {
migration1775060606: makeKyselyMigrationFromSqlFile(
'./sql/0043_common_zzzax.sql',
),
migration1776016472: makeKyselyMigrationFromSqlFile(
'./sql/0044_add_audience_critic_rating.sql',
),
},
wrapWithTransaction,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `program` ADD `audience_rating` real;--> statement-breakpoint
ALTER TABLE `program` ADD `critic_rating` real;
16 changes: 13 additions & 3 deletions server/src/migration/db/sql/meta/0043_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "6",
"dialect": "sqlite",
"id": "11c0c7ae-4449-4d42-8243-1d68565688fc",
"prevId": "1231ad02-0d3a-4c84-be1e-64b9067f084b",
"prevId": "63234c90-1be6-4af9-985c-db1eb9bb694c",
"tables": {
"artwork": {
"name": "artwork",
Expand Down Expand Up @@ -3707,6 +3707,14 @@
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'media'"
}
},
"indexes": {
Expand All @@ -3728,15 +3736,17 @@
"name": "tag_program_id_unique_idx",
"columns": [
"tag_id",
"program_id"
"program_id",
"source"
],
"isUnique": true
},
"tag_grouping_id_unique_idx": {
"name": "tag_grouping_id_unique_idx",
"columns": [
"tag_id",
"grouping_id"
"grouping_id",
"source"
],
"isUnique": true
}
Expand Down
Loading
Loading