mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
add LRT main menu
This commit is contained in:
@@ -7,6 +7,7 @@ export default class ApiResponse {
|
|||||||
category: string;
|
category: string;
|
||||||
play: string;
|
play: string;
|
||||||
msgBoxOK: string;
|
msgBoxOK: string;
|
||||||
|
nosort: boolean;
|
||||||
|
|
||||||
setTitle(title) {
|
setTitle(title) {
|
||||||
this.category = title;
|
this.category = title;
|
||||||
@@ -30,5 +31,13 @@ export default class ApiResponse {
|
|||||||
|
|
||||||
addMessage(message) {
|
addMessage(message) {
|
||||||
this.msgBoxOK = message;
|
this.msgBoxOK = message;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setNoSort(value = true) {
|
||||||
|
this.nosort = value;
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export default class ResponseItem {
|
|||||||
setActionSearch() {
|
setActionSearch() {
|
||||||
this.action = 'search';
|
this.action = 'search';
|
||||||
delete this.isPlayable;
|
delete this.isPlayable;
|
||||||
|
delete this.mediatype;
|
||||||
this.isFolder = false;
|
this.isFolder = false;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -20,6 +20,15 @@ export class LrtController {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('recent')
|
||||||
|
getRecent(@Req() request: Request) {
|
||||||
|
return {
|
||||||
|
mod: 'lrt',
|
||||||
|
path: request.url,
|
||||||
|
recent: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Get('cat/:id')
|
@Get('cat/:id')
|
||||||
getCategory(@Req() request: Request, @Param('id') id: number) {
|
getCategory(@Req() request: Request, @Param('id') id: number) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -8,6 +8,31 @@ export class LrtService {
|
|||||||
private readonly kodiApiResponseFactory: KodiApiResponseFactory,
|
private readonly kodiApiResponseFactory: KodiApiResponseFactory,
|
||||||
) {}
|
) {}
|
||||||
getMainMenu(): ApiResponse {
|
getMainMenu(): ApiResponse {
|
||||||
return this.kodiApiResponseFactory.createApiResponse();
|
const apiResponse = this.kodiApiResponseFactory.createApiResponse();
|
||||||
|
apiResponse.setNoSort().setTitle('LRT.lt');
|
||||||
|
this.createMainMenu(apiResponse);
|
||||||
|
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
private createMainMenu(apiResponse: ApiResponse): void {
|
||||||
|
const items = {
|
||||||
|
'lrt/recent': 'neseniai ieškoti',
|
||||||
|
'lrt/tema/vaikams': 'vaikams',
|
||||||
|
'lrt/tema/sportas': 'sportas',
|
||||||
|
'lrt/tema/kultura': 'kultura',
|
||||||
|
'lrt/tema/muzika': 'muzika',
|
||||||
|
'lrt/tema/viskas': 'viskas',
|
||||||
|
'lrt/tema/tv-laidos': 'tv-laidos',
|
||||||
|
};
|
||||||
|
apiResponse
|
||||||
|
.createItem()
|
||||||
|
.setPath('lrt/search')
|
||||||
|
.setActionSearch()
|
||||||
|
.setLabel('paieška');
|
||||||
|
|
||||||
|
for (const [path, label] of Object.entries(items)) {
|
||||||
|
apiResponse.createItem().setLabel(label).setToFolder().setPath(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user