Skip to content

Commit

Permalink
feat(overseerr): serialized movie & tv objects
Browse files Browse the repository at this point in the history
  • Loading branch information
JagandeepBrar committed Feb 11, 2022
1 parent 3f603d4 commit 2b778dc
Show file tree
Hide file tree
Showing 33 changed files with 1,223 additions and 48 deletions.
2 changes: 1 addition & 1 deletion assets/localization/en.json
Expand Up @@ -204,7 +204,7 @@
"settings.SystemStatus": "System Status",
"settings.SystemStatusDescription": "Status Page for Hosted Services",
"settings.TestBuilds": "Test Builds",
"settings.TestBuildsDescription": "Install Pre-Release Builds of LunaSea",
"settings.TestBuildsDescription": "Install Prerelease Builds of LunaSea",
"settings.TestConnection": "Test Connection",
"settings.TLSCertificateValidation": "TLS Certificate Validation",
"settings.TLSCertificateValidationDescription": "Validate Certificates in TLS Connections",
Expand Down
1 change: 1 addition & 0 deletions lib/core.dart
Expand Up @@ -30,6 +30,7 @@ export 'core/models.dart';
export 'core/modules.dart';
export 'core/pages.dart';
export 'core/router.dart';
export 'core/services.dart';
export 'core/state.dart';
export 'core/system.dart';
export 'core/ui.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/core/services.dart
@@ -0,0 +1 @@
export 'services/the_movie_db.dart';
1 change: 1 addition & 0 deletions lib/core/services/the_movie_db.dart
@@ -0,0 +1 @@
export 'the_movie_db/api.dart';
9 changes: 9 additions & 0 deletions lib/core/services/the_movie_db/api.dart
@@ -0,0 +1,9 @@
class TheMovieDB {
static const String _IMAGE_ENDPOINT_URL = 'https://image.tmdb.org/t/p/';
static const String _IMAGE_POSTER_SIZE = 'w154';

static String? getImageURL(String? id) {
if (id != null) return '$_IMAGE_ENDPOINT_URL$_IMAGE_POSTER_SIZE$id';
return null;
}
}
Empty file.
4 changes: 4 additions & 0 deletions lib/core/ui/block/block.dart
Expand Up @@ -94,6 +94,10 @@ class LunaBlock extends StatelessWidget {

@override
Widget build(BuildContext context) {
return _buildBlock(context);
}

Widget _buildBlock(BuildContext context) {
double _height = _calculateHeight();
return LunaCard(
context: context,
Expand Down
18 changes: 18 additions & 0 deletions lib/modules/overseerr/api/models.dart
@@ -1,3 +1,21 @@
export 'models/content/collection.dart';
export 'models/content/content_ratings.dart';
export 'models/content/created_by.dart';
export 'models/content/credits.dart';
export 'models/content/episode.dart';
export 'models/content/external_ids.dart';
export 'models/content/genre.dart';
export 'models/content/keyword.dart';
export 'models/content/movie.dart';
export 'models/content/movie_releases.dart';
export 'models/content/network.dart';
export 'models/content/production_company.dart';
export 'models/content/production_country.dart';
export 'models/content/related_video.dart';
export 'models/content/season.dart';
export 'models/content/series.dart';
export 'models/content/spoken_language.dart';
export 'models/content/watch_provider.dart';
export 'models/media/media.dart';
export 'models/media/season.dart';
export 'models/requests/request_count.dart';
Expand Down
33 changes: 33 additions & 0 deletions lib/modules/overseerr/api/models/content/collection.dart
@@ -0,0 +1,33 @@
import 'package:lunasea/core.dart';

part 'collection.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrCollection {
@JsonKey()
int? id;

@JsonKey()
String? name;

@JsonKey()
String? posterPath;

@JsonKey()
String? backdropPath;

OverseerrCollection({
this.id,
this.name,
this.posterPath,
this.backdropPath,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrCollection.fromJson(Map<String, dynamic> json) =>
_$OverseerrCollectionFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrCollectionToJson(this);
}
43 changes: 43 additions & 0 deletions lib/modules/overseerr/api/models/content/content_ratings.dart
@@ -0,0 +1,43 @@
import 'package:lunasea/core.dart';

part 'content_ratings.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrContentRatings {
@JsonKey()
List<OverseerrContentRating>? results;

OverseerrContentRatings({
this.results,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrContentRatings.fromJson(Map<String, dynamic> json) =>
_$OverseerrContentRatingsFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrContentRatingsToJson(this);
}

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrContentRating {
@JsonKey(name: 'iso_3166_1')
String? iso31661;

@JsonKey()
String? rating;

OverseerrContentRating({
this.iso31661,
this.rating,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrContentRating.fromJson(Map<String, dynamic> json) =>
_$OverseerrContentRatingFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrContentRatingToJson(this);
}
37 changes: 37 additions & 0 deletions lib/modules/overseerr/api/models/content/created_by.dart
@@ -0,0 +1,37 @@
import 'package:lunasea/core.dart';

part 'created_by.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrCreatedBy {
@JsonKey()
int? id;

@JsonKey(name: 'credit_id')
String? creditId;

@JsonKey()
String? name;

@JsonKey()
int? gender;

@JsonKey(name: 'profile_path')
String? profilePath;

OverseerrCreatedBy({
this.id,
this.creditId,
this.name,
this.gender,
this.profilePath,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrCreatedBy.fromJson(Map<String, dynamic> json) =>
_$OverseerrCreatedByFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrCreatedByToJson(this);
}
113 changes: 113 additions & 0 deletions lib/modules/overseerr/api/models/content/credits.dart
@@ -0,0 +1,113 @@
import 'package:lunasea/core.dart';

part 'credits.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrCredits {
@JsonKey()
List<OverseerrCast>? cast;

@JsonKey()
List<OverseerrCrew>? crew;

OverseerrCredits({
this.cast,
this.crew,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrCredits.fromJson(Map<String, dynamic> json) =>
_$OverseerrCreditsFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrCreditsToJson(this);
}

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrCast {
@JsonKey()
int? id;

@JsonKey()
int? castId;

@JsonKey()
String? character;

@JsonKey()
String? creditId;

@JsonKey()
int? gender;

@JsonKey()
String? name;

@JsonKey()
int? order;

@JsonKey()
String? profilePath;

OverseerrCast({
this.id,
this.castId,
this.character,
this.creditId,
this.gender,
this.name,
this.order,
this.profilePath,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrCast.fromJson(Map<String, dynamic> json) =>
_$OverseerrCastFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrCastToJson(this);
}

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrCrew {
@JsonKey()
int? id;

@JsonKey()
String? creditId;

@JsonKey()
String? department;

@JsonKey()
int? gender;

@JsonKey()
String? job;

@JsonKey()
String? name;

@JsonKey()
String? profilePath;

OverseerrCrew({
this.id,
this.creditId,
this.department,
this.gender,
this.job,
this.name,
this.profilePath,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrCrew.fromJson(Map<String, dynamic> json) =>
_$OverseerrCrewFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrCrewToJson(this);
}
53 changes: 53 additions & 0 deletions lib/modules/overseerr/api/models/content/episode.dart
@@ -0,0 +1,53 @@
import 'package:lunasea/core.dart';

part 'episode.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrEpisode {
@JsonKey()
int? id;

@JsonKey()
String? airDate;

@JsonKey()
int? episodeNumber;

@JsonKey()
String? name;

@JsonKey()
String? overview;

@JsonKey()
String? productionCode;

@JsonKey()
int? seasonNumber;

@JsonKey()
double? voteAverage;

@JsonKey()
String? stillPath;

OverseerrEpisode({
this.id,
this.airDate,
this.episodeNumber,
this.name,
this.overview,
this.productionCode,
this.seasonNumber,
this.voteAverage,
this.stillPath,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrEpisode.fromJson(Map<String, dynamic> json) =>
_$OverseerrEpisodeFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrEpisodeToJson(this);
}
49 changes: 49 additions & 0 deletions lib/modules/overseerr/api/models/content/external_ids.dart
@@ -0,0 +1,49 @@
import 'package:lunasea/core.dart';

part 'external_ids.g.dart';

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class OverseerrExternalIds {
@JsonKey()
String? imdbId;

@JsonKey()
String? freebaseMid;

@JsonKey()
String? freebaseId;

@JsonKey()
int? tvdbId;

@JsonKey()
int? tvrageId;

@JsonKey()
String? facebookId;

@JsonKey()
String? instagramId;

@JsonKey()
String? twitterId;

OverseerrExternalIds({
this.imdbId,
this.freebaseMid,
this.freebaseId,
this.tvdbId,
this.tvrageId,
this.facebookId,
this.instagramId,
this.twitterId,
});

@override
String toString() => json.encode(this.toJson());

factory OverseerrExternalIds.fromJson(Map<String, dynamic> json) =>
_$OverseerrExternalIdsFromJson(json);

Map<String, dynamic> toJson() => _$OverseerrExternalIdsToJson(this);
}

0 comments on commit 2b778dc

Please sign in to comment.