1
1
import 'package:lunasea/core.dart' ;
2
2
import 'package:lunasea/extensions/string/links.dart' ;
3
+ import 'package:lunasea/system/platform.dart' ;
3
4
4
5
enum LinkedContentType {
5
6
MOVIE ,
@@ -28,29 +29,55 @@ enum LunaLinkedContent {
28
29
29
30
static String ? imdb (String ? id) {
30
31
if (id == null ) return null ;
31
- String base = 'https://www.imdb.com' ;
32
+ const base = 'https://www.imdb.com' ;
32
33
33
34
return '$base /title/$id ' ;
34
35
}
35
36
36
37
static String ? letterboxd (int ? id) {
37
38
if (id == null ) return null ;
38
- String base = 'https://letterboxd.com' ;
39
+ const base = 'https://letterboxd.com' ;
39
40
40
41
return '$base /tmdb/$id ' ;
41
42
}
42
43
43
44
static String ? musicBrainz (String ? id) {
44
45
if (id == null ) return null ;
45
- String base = 'https://musicbrainz.org/artist' ;
46
+ const base = 'https://musicbrainz.org/artist' ;
46
47
47
48
return '$base /$id ' ;
48
49
}
49
50
51
+ static String plexMobile (
52
+ String plexIdentifier,
53
+ int ratingKey,
54
+ ) {
55
+ if (LunaPlatform .isAndroid) {
56
+ const base = 'plex://server://' ;
57
+ const path = '/com.plexapp.plugins.library/library/metadata/' ;
58
+ return '$base $plexIdentifier $path $ratingKey ' ;
59
+ } else {
60
+ const base = 'plex://preplay/?server=' ;
61
+ const path = '&metadataKey=/library/metadata/' ;
62
+ return '$base $plexIdentifier $path $ratingKey ' ;
63
+ }
64
+ }
65
+
66
+ static String plexWeb (
67
+ String plexIdentifier,
68
+ int ratingKey, [
69
+ bool useLegacy = false ,
70
+ ]) {
71
+ const base = 'https://app.plex.tv/desktop#!/server/' ;
72
+ const path = '/details?key=%2Flibrary%2Fmetadata%2F' ;
73
+ final legacy = useLegacy ? '&legacy=1' : '' ;
74
+ return '$base $plexIdentifier $path $ratingKey $legacy ' ;
75
+ }
76
+
50
77
static String ? theMovieDB (dynamic id, LinkedContentType type) {
51
78
if (id == null ) return null ;
52
- String base = 'https://www.themoviedb.org' ;
53
- String baseImage = 'https://image.tmdb.org/t/p' ;
79
+ const base = 'https://www.themoviedb.org' ;
80
+ const baseImage = 'https://image.tmdb.org/t/p' ;
54
81
55
82
switch (type) {
56
83
case LinkedContentType .MOVIE :
@@ -70,7 +97,7 @@ enum LunaLinkedContent {
70
97
71
98
static String ? trakt (int ? id, LinkedContentType type) {
72
99
if (id == null ) return null ;
73
- String base = 'https://trakt.tv' ;
100
+ const base = 'https://trakt.tv' ;
74
101
75
102
switch (type) {
76
103
case LinkedContentType .MOVIE :
@@ -84,14 +111,14 @@ enum LunaLinkedContent {
84
111
85
112
static String ? tvMaze (int ? id) {
86
113
if (id == null ) return null ;
87
- String base = 'https://www.tvmaze.com' ;
114
+ const base = 'https://www.tvmaze.com' ;
88
115
89
116
return '$base /shows/$id ' ;
90
117
}
91
118
92
119
static String ? theTVDB (int ? id, LinkedContentType type) {
93
120
if (id == null ) return null ;
94
- String base = 'https://thetvdb.com' ;
121
+ const base = 'https://thetvdb.com' ;
95
122
96
123
switch (type) {
97
124
case LinkedContentType .MOVIE :
@@ -107,7 +134,7 @@ enum LunaLinkedContent {
107
134
108
135
static String ? youtube (String ? id) {
109
136
if (id == null ) return null ;
110
- String base = 'https://www.youtube.com' ;
137
+ const base = 'https://www.youtube.com' ;
111
138
112
139
return '$base /watch?v=$id ' ;
113
140
}
0 commit comments