-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(overseerr): integrate request list and request tiles
- Loading branch information
1 parent
a4fbe5e
commit b7fc3c0
Showing
20 changed files
with
329 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
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) { | ||
static const String _IMAGE_BACKDROP_SIZE = 'w300'; | ||
static const String _IMAGE_POSTER_SIZE = 'w185'; | ||
|
||
static String? getPosterURL(String? id) { | ||
if (id != null) return '$_IMAGE_ENDPOINT_URL$_IMAGE_POSTER_SIZE$id'; | ||
return null; | ||
} | ||
|
||
static String? getBackdropURL(String? id) { | ||
if (id != null) return '$_IMAGE_ENDPOINT_URL$_IMAGE_BACKDROP_SIZE$id'; | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export 'extensions/overseerr_movie.dart'; | ||
export 'extensions/overseerr_request_status.dart'; | ||
export 'extensions/overseerr_request.dart'; | ||
export 'extensions/overseerr_series.dart'; | ||
export 'extensions/overseerr_user.dart'; |
14 changes: 14 additions & 0 deletions
14
lib/modules/overseerr/core/extensions/overseerr_movie.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:lunasea/core.dart'; | ||
import 'package:lunasea/modules/overseerr.dart'; | ||
|
||
extension LunaOverseerrMovieExtension on OverseerrMovie? { | ||
String lunaTitle() { | ||
if (this?.title == null) return LunaUI.TEXT_EMDASH; | ||
return this!.title!; | ||
} | ||
|
||
String lunaYear() { | ||
if (this?.releaseDate?.isEmpty ?? true) return LunaUI.TEXT_EMDASH; | ||
return this!.releaseDate!.split('-')[0]; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
lib/modules/overseerr/core/extensions/overseerr_request.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:lunasea/core.dart'; | ||
import 'package:lunasea/modules/overseerr.dart'; | ||
|
||
extension LunaOverseerrRequestExtension on OverseerrRequest? { | ||
String lunaRequestStatus() { | ||
if (this?.status == null) return LunaUI.TEXT_EMDASH; | ||
return this!.status.lunaName(this?.media?.status); | ||
} | ||
|
||
String lunaRequestedBy() { | ||
return 'overseerr.RequestedBy'.tr(args: [ | ||
this?.requestedBy.lunaDisplayName() ?? 'overseerr.UnknownUser'.tr(), | ||
]); | ||
} | ||
|
||
bool lunaIs4K() { | ||
if (this?.is4k ?? false) return true; | ||
return false; | ||
} | ||
|
||
OverseerrMediaStatus? lunaMediaStatus() { | ||
if (lunaIs4K()) return this?.media?.status4k; | ||
return this?.media?.status; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
lib/modules/overseerr/core/extensions/overseerr_request_status.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:lunasea/core.dart'; | ||
import 'package:lunasea/modules/overseerr.dart'; | ||
|
||
extension LunaOverseerrRequestStatusExtension on OverseerrRequestStatus? { | ||
String lunaName(OverseerrMediaStatus? mediaStatus) { | ||
if (mediaStatus != null) { | ||
switch (mediaStatus) { | ||
case OverseerrMediaStatus.PENDING: | ||
return 'overseerr.Pending'.tr(); | ||
case OverseerrMediaStatus.PROCESSING: | ||
return 'overseerr.Requested'.tr(); | ||
case OverseerrMediaStatus.PARTIALLY_AVAILABLE: | ||
return 'overseerr.PartiallyAvailable'.tr(); | ||
case OverseerrMediaStatus.AVAILABLE: | ||
return 'overseerr.Available'.tr(); | ||
case OverseerrMediaStatus.UNKNOWN: | ||
break; | ||
} | ||
} | ||
switch (this) { | ||
case OverseerrRequestStatus.PENDING: | ||
return 'overseerr.Pending'.tr(); | ||
case OverseerrRequestStatus.APPROVED: | ||
return 'overseerr.Approved'.tr(); | ||
case OverseerrRequestStatus.DECLINED: | ||
return 'overseerr.Declined'.tr(); | ||
default: | ||
return LunaUI.TEXT_EMDASH; | ||
} | ||
} | ||
|
||
Color lunaColour(OverseerrMediaStatus? mediaStatus) { | ||
if (mediaStatus != null) { | ||
switch (mediaStatus) { | ||
case OverseerrMediaStatus.PARTIALLY_AVAILABLE: | ||
case OverseerrMediaStatus.AVAILABLE: | ||
return LunaColours.accent; | ||
case OverseerrMediaStatus.PENDING: | ||
return LunaColours.orange; | ||
case OverseerrMediaStatus.PROCESSING: | ||
return LunaColours.purple; | ||
case OverseerrMediaStatus.UNKNOWN: | ||
default: | ||
} | ||
} | ||
switch (this) { | ||
case OverseerrRequestStatus.PENDING: | ||
return LunaColours.orange; | ||
case OverseerrRequestStatus.APPROVED: | ||
return LunaColours.purple; | ||
case OverseerrRequestStatus.DECLINED: | ||
return LunaColours.red; | ||
default: | ||
return LunaColours.blueGrey; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/modules/overseerr/core/extensions/overseerr_series.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:lunasea/core.dart'; | ||
import 'package:lunasea/modules/overseerr.dart'; | ||
|
||
extension LunaOverseerrSeriesExtension on OverseerrSeries? { | ||
String lunaTitle() { | ||
if (this?.name != null) return this!.name!; | ||
return LunaUI.TEXT_EMDASH; | ||
} | ||
|
||
String lunaYear() { | ||
if (this?.firstAirDate?.isEmpty ?? true) return LunaUI.TEXT_EMDASH; | ||
return this!.firstAirDate!.split('-')[0]; | ||
} | ||
} |
20 changes: 10 additions & 10 deletions
20
lib/modules/overseerr/core/extensions/overseerr_user.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import 'package:lunasea/core.dart'; | ||
import 'package:lunasea/modules/overseerr.dart'; | ||
|
||
extension OverseerrUserExtension on OverseerrUser { | ||
String? lunaDisplayName() { | ||
if (this.displayName != null) return this.displayName; | ||
return 'overseerr.UnknownUser'.tr(); | ||
extension LunaOverseerrUserExtension on OverseerrUser? { | ||
String lunaDisplayName() { | ||
if (this?.displayName?.isEmpty ?? true) return 'overseerr.UnknownUser'.tr(); | ||
return this!.displayName!; | ||
} | ||
|
||
String? lunaEmail() { | ||
if (this.email != null) return this.email; | ||
return LunaUI.TEXT_EMDASH; | ||
String lunaEmail() { | ||
if (this?.email?.isEmpty ?? true) return LunaUI.TEXT_EMDASH; | ||
return this!.email!; | ||
} | ||
|
||
String lunaAmountOfRequests() { | ||
if (this.requestCount == 0) return 'overseerr.NoRequests'.tr(); | ||
if (this.requestCount == 1) return 'overseerr.OneRequest'.tr(); | ||
return 'overseerr.SomeRequests'.tr(args: [this.requestCount.toString()]); | ||
if ((this?.requestCount ?? 0) == 0) return 'overseerr.NoRequests'.tr(); | ||
if (this!.requestCount == 1) return 'overseerr.OneRequest'.tr(); | ||
return 'overseerr.SomeRequests'.tr(args: [this!.requestCount.toString()]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.