Skip to content

Commit a2fd994

Browse files
committed
chore: formatting
1 parent 18f2153 commit a2fd994

6 files changed

Lines changed: 60 additions & 54 deletions

File tree

src/controllers/stremio.controller.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,23 @@ export class StremioController {
140140
omssResponse = await this.sourceService.getMovieSources(tmdbId)
141141
} else if (type === 'series' || type === 'tv') {
142142
if (season === undefined || episode === undefined || !Number.isFinite(season) || !Number.isFinite(episode)) {
143-
return reply.code(400).send({
144-
error: {
145-
code: 'INVALID_PARAMETER',
146-
message: 'An error occurred while processing the request',
147-
},
148-
traceId: request.id,
149-
})
143+
return reply.code(400).send({
144+
error: {
145+
code: 'INVALID_PARAMETER',
146+
message: 'An error occurred while processing the request',
147+
},
148+
traceId: request.id,
149+
})
150150
}
151151
omssResponse = await this.sourceService.getTVSources(tmdbId, season, episode)
152152
} else {
153-
return reply.code(400).send({
154-
error: {
155-
code: 'INVALID_PARAMETER',
156-
message: 'An error occurred while processing the request',
157-
},
158-
traceId: request.id,
159-
})
153+
return reply.code(400).send({
154+
error: {
155+
code: 'INVALID_PARAMETER',
156+
message: 'An error occurred while processing the request',
157+
},
158+
traceId: request.id,
159+
})
160160
}
161161

162162
const streams: StremioStream[] = (omssResponse.sources || []).map((source: Source, index: number): StremioStream => {
@@ -167,10 +167,7 @@ export class StremioController {
167167
const audioSummary = source.audioTracks.length > 0 ? source.audioTracks.map((t) => t.label || t.language.toUpperCase()).join(', ') : null
168168

169169
// Multi-line description rendered by Stremio below the name
170-
const descLines: string[] = [
171-
`📡 Provider: ${source.provider.name}`,
172-
173-
]
170+
const descLines: string[] = [`📡 Provider: ${source.provider.name}`]
174171

175172
if (audioSummary) {
176173
descLines.push(`🔊 ${audioSummary}`)

src/core/types.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ export interface CacheConfig {
3535
}
3636
}
3737

38-
3938
export interface StremioConfig {
4039
enableNativeAddon: boolean
4140
stremioAddons: StremioAddonConfig[]
4241
}
4342

4443
export interface StremioAddonConfig {
45-
id: string;
46-
url: string;
47-
enabled?: boolean;
48-
timeoutMs?: number;
44+
id: string
45+
url: string
46+
enabled?: boolean
47+
timeoutMs?: number
4948
}
5049

5150
// OMSS Response Types

src/services/proxy.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class ProxyService {
104104
validateStatus: (status) => status < 500,
105105
})
106106

107-
const contentType = response.headers['content-type'] as string || this.getMimeType(proxyData.url)
107+
const contentType = (response.headers['content-type'] as string) || this.getMimeType(proxyData.url)
108108

109109
// Build headers object
110110
const headers: Record<string, string> = {
@@ -158,7 +158,7 @@ export class ProxyService {
158158
})
159159

160160
// Check if we need to rewrite manifest files
161-
const contentType = response.headers['content-type'] as string || ''
161+
const contentType = (response.headers['content-type'] as string) || ''
162162
let responseData = response.data
163163

164164
if (this.isManifestFile(contentType, proxyData.url)) {

src/services/source.service.ts

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,26 @@ export class SourceService {
4343
const media = await this.tmdbService.getMediaObject('movie', tmdbId)
4444

4545
// Try to get IMDB ID
46-
media.imdbId = await this.tmdbService.getImdbId(tmdbId, 'movie') ?? ''
46+
media.imdbId = (await this.tmdbService.getImdbId(tmdbId, 'movie')) ?? ''
4747

4848
// Fetch from providers and Stremio addons concurrently
4949
const [providerResults, stremioResult] = await Promise.all([
5050
this.fetchFromProviders('movie', media),
5151
this.stremioService?.hasEnabledAddons()
52-
? this.stremioService.getMovieSources(media).catch((err): ProviderResult => ({
53-
sources: [],
54-
subtitles: [],
55-
diagnostics: [{
56-
code: 'PROVIDER_ERROR',
57-
message: `Stremio integration failed: ${err instanceof Error ? err.message : 'Unknown error'}`,
58-
field: '',
59-
severity: 'error',
60-
}],
61-
}))
52+
? this.stremioService.getMovieSources(media).catch(
53+
(err): ProviderResult => ({
54+
sources: [],
55+
subtitles: [],
56+
diagnostics: [
57+
{
58+
code: 'PROVIDER_ERROR',
59+
message: `Stremio integration failed: ${err instanceof Error ? err.message : 'Unknown error'}`,
60+
field: '',
61+
severity: 'error',
62+
},
63+
],
64+
})
65+
)
6266
: Promise.resolve(null),
6367
])
6468

@@ -107,22 +111,26 @@ export class SourceService {
107111
const media = await this.tmdbService.getMediaObject('tv', tmdbId, season, episode)
108112

109113
// Try to get IMDB ID
110-
media.imdbId = await this.tmdbService.getImdbId(tmdbId, 'tv') ?? ''
114+
media.imdbId = (await this.tmdbService.getImdbId(tmdbId, 'tv')) ?? ''
111115

112116
// Fetch from providers and Stremio addons concurrently
113117
const [providerResults, stremioResult] = await Promise.all([
114118
this.fetchFromProviders('tv', media),
115119
this.stremioService?.hasEnabledAddons()
116-
? this.stremioService.getTVSources(media).catch((err): ProviderResult => ({
117-
sources: [],
118-
subtitles: [],
119-
diagnostics: [{
120-
code: 'PROVIDER_ERROR',
121-
message: `Stremio integration failed: ${err instanceof Error ? err.message : 'Unknown error'}`,
122-
field: '',
123-
severity: 'error',
124-
}],
125-
}))
120+
? this.stremioService.getTVSources(media).catch(
121+
(err): ProviderResult => ({
122+
sources: [],
123+
subtitles: [],
124+
diagnostics: [
125+
{
126+
code: 'PROVIDER_ERROR',
127+
message: `Stremio integration failed: ${err instanceof Error ? err.message : 'Unknown error'}`,
128+
field: '',
129+
severity: 'error',
130+
},
131+
],
132+
})
133+
)
126134
: Promise.resolve(null),
127135
])
128136

src/services/stremio.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ export class StremioService {
135135
url,
136136
type: this.inferSourceType(stream),
137137
quality: this.inferQuality(stream),
138-
audioTracks: [{
139-
label: "Unknown (fallback: Stremio Addons do not have a standard way to specify audio track info)",
140-
language: "und",
141-
}],
138+
audioTracks: [
139+
{
140+
label: 'Unknown (fallback: Stremio Addons do not have a standard way to specify audio track info)',
141+
language: 'und',
142+
},
143+
],
142144
provider: {
143145
id: `stremio:${r.addonId}`,
144146
name: `Stremio ${r.addonId}`,

src/services/tmdb.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ export class TMDBService {
256256
async getMediaObject(type: 'movie' | 'tv', tmdbId: string, season?: number, episode?: number): Promise<ProviderMediaObject> {
257257
if (type === 'movie') {
258258
const validation = await this.validateMovie(tmdbId)
259-
259+
260260
return {
261261
type: 'movie',
262262
tmdbId,
263-
imdbId: await this.getImdbId(tmdbId, 'movie') || '',
263+
imdbId: (await this.getImdbId(tmdbId, 'movie')) || '',
264264
title: validation.title ?? '',
265265
releaseYear: validation.releaseDate ? new Date(validation.releaseDate).getFullYear().toString() : '',
266266
}
@@ -270,7 +270,7 @@ export class TMDBService {
270270
return {
271271
type: 'tv',
272272
tmdbId,
273-
imdbId: await this.getImdbId(tmdbId, 'tv') || '',
273+
imdbId: (await this.getImdbId(tmdbId, 'tv')) || '',
274274
s: season,
275275
e: episode,
276276
releaseYear: validation.releaseDate ? new Date(validation.releaseDate).getFullYear().toString() : '',

0 commit comments

Comments
 (0)