mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-04-21 16:31:55 +00:00
Add --new to hidive
Adds --new to hidive to look at the ID's of recently added stuff
This commit is contained in:
parent
4824367f39
commit
02b4385db3
4 changed files with 113 additions and 5 deletions
73
@types/hidiveDashboard.d.ts
vendored
Normal file
73
@types/hidiveDashboard.d.ts
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
export interface HidiveDashboard {
|
||||||
|
Code: number;
|
||||||
|
Status: string;
|
||||||
|
Message: null;
|
||||||
|
Messages: Messages;
|
||||||
|
Data: Data;
|
||||||
|
Timestamp: string;
|
||||||
|
IPAddress: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Data {
|
||||||
|
TitleRows: TitleRow[];
|
||||||
|
LoadTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TitleRow {
|
||||||
|
Name: string;
|
||||||
|
Titles: Title[];
|
||||||
|
LoadTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Title {
|
||||||
|
Id: number;
|
||||||
|
Name: string;
|
||||||
|
ShortSynopsis: string;
|
||||||
|
MediumSynopsis: string;
|
||||||
|
LongSynopsis: string;
|
||||||
|
KeyArtUrl: string;
|
||||||
|
MasterArtUrl: string;
|
||||||
|
Rating: null | string;
|
||||||
|
OverallRating: number;
|
||||||
|
RatingCount: number;
|
||||||
|
MALScore: null;
|
||||||
|
UserRating: number;
|
||||||
|
RunTime: number | null;
|
||||||
|
ShowInfoTitle: string;
|
||||||
|
FirstPremiereDate: Date;
|
||||||
|
EpisodeCount: number;
|
||||||
|
SeasonName: string;
|
||||||
|
RokuHDArtUrl: string;
|
||||||
|
RokuSDArtUrl: string;
|
||||||
|
IsRateable: boolean;
|
||||||
|
InQueue: boolean;
|
||||||
|
IsFavorite: boolean;
|
||||||
|
IsContinueWatching: boolean;
|
||||||
|
ContinueWatching: ContinueWatching;
|
||||||
|
Episodes: any[];
|
||||||
|
LoadTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContinueWatching {
|
||||||
|
Id: string;
|
||||||
|
ProfileId: number;
|
||||||
|
EpisodeId: number;
|
||||||
|
Status: Status | null;
|
||||||
|
CurrentTime: number;
|
||||||
|
UserId: number;
|
||||||
|
TitleId: number;
|
||||||
|
SeasonId: number;
|
||||||
|
VideoId: number;
|
||||||
|
TotalSeconds: number;
|
||||||
|
CreatedDT: Date;
|
||||||
|
ModifiedDT: Date | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Status {
|
||||||
|
Paused = 'Paused',
|
||||||
|
Playing = 'Playing',
|
||||||
|
Watching = 'Watching',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Messages {
|
||||||
|
}
|
||||||
39
hidive.ts
39
hidive.ts
|
|
@ -33,6 +33,7 @@ import { AuthData, AuthResponse, SearchData, SearchResponse, SearchResponseItem
|
||||||
import { ServiceClass } from './@types/serviceClassInterface';
|
import { ServiceClass } from './@types/serviceClassInterface';
|
||||||
import { sxItem } from './crunchy';
|
import { sxItem } from './crunchy';
|
||||||
import { HidiveSearch } from './@types/hidiveSearch';
|
import { HidiveSearch } from './@types/hidiveSearch';
|
||||||
|
import { HidiveDashboard } from './@types/hidiveDashboard';
|
||||||
|
|
||||||
export default class Hidive implements ServiceClass {
|
export default class Hidive implements ServiceClass {
|
||||||
public cfg: yamlCfg.ConfigObject;
|
public cfg: yamlCfg.ConfigObject;
|
||||||
|
|
@ -89,9 +90,11 @@ export default class Hidive implements ServiceClass {
|
||||||
this.debug = true;
|
this.debug = true;
|
||||||
|
|
||||||
//below is for quickly testing API calls
|
//below is for quickly testing API calls
|
||||||
/*const searchItems = await this.reqData('Search', {'Query':''});
|
/*const searchItems = await this.reqData('GetTitles', {'Filter': 'recently-added', 'Pager': {'Number': 1, 'Size': 30}, 'Sort': 'Date', 'Verbose': false});
|
||||||
|
const searchItems = await this.reqData('GetTitles', {'Id': 492});
|
||||||
if(!searchItems.ok || !searchItems.res){return;}
|
if(!searchItems.ok || !searchItems.res){return;}
|
||||||
console.info(searchItems.res.body);*/
|
console.info(searchItems.res.body);
|
||||||
|
fs.writeFileSync('apitest.json', JSON.stringify(JSON.parse(searchItems.res.body), null, 2));*/
|
||||||
|
|
||||||
// load binaries
|
// load binaries
|
||||||
this.cfg.bin = await yamlCfg.loadBinCfg();
|
this.cfg.bin = await yamlCfg.loadBinCfg();
|
||||||
|
|
@ -126,6 +129,11 @@ export default class Hidive implements ServiceClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (argv.new) {
|
||||||
|
//Initilize session
|
||||||
|
await this.doInit();
|
||||||
|
//Get Newly Added
|
||||||
|
await this.getNewlyAdded(argv.page);
|
||||||
} else {
|
} else {
|
||||||
console.info('No option selected or invalid value entered. Try --help.');
|
console.info('No option selected or invalid value entered. Try --help.');
|
||||||
}
|
}
|
||||||
|
|
@ -341,6 +349,33 @@ export default class Hidive implements ServiceClass {
|
||||||
})};
|
})};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getNewlyAdded(page?: number) {
|
||||||
|
const pageNum = page ? page : 1;
|
||||||
|
const dashboardReq = await this.reqData('GetDashboard', {'Pager': {'Number': pageNum, 'Size': 30}, 'Verbose': false});
|
||||||
|
if(!dashboardReq.ok || !dashboardReq.res) {
|
||||||
|
console.error('Search for new episodes FAILED!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dashboardData = JSON.parse(dashboardReq.res.body) as HidiveDashboard;
|
||||||
|
const dashboardItems = dashboardData.Data.TitleRows;
|
||||||
|
const recentlyAddedIndex = dashboardItems.findIndex(item => item.Name == 'Recently Added');
|
||||||
|
const recentlyAdded = recentlyAddedIndex >= 0 ? dashboardItems[recentlyAddedIndex] : undefined;
|
||||||
|
if (recentlyAdded) {
|
||||||
|
const searchItems = recentlyAdded?.Titles;
|
||||||
|
if(searchItems.length>0) {
|
||||||
|
console.info('[INFO] Recently Added:');
|
||||||
|
for(let i=0;i<searchItems.length;i++){
|
||||||
|
console.info(`[#${searchItems[i].Id}] ${searchItems[i].Name} [${searchItems[i].ShowInfoTitle}]`);
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
console.warn('No new episodes found!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('New episode category not found!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async listShow(id: number) {
|
public async listShow(id: number) {
|
||||||
const getShowData = await this.reqData('GetTitle', { 'Id': id });
|
const getShowData = await this.reqData('GetTitle', { 'Id': id });
|
||||||
if (!getShowData.ok || !getShowData.res) {
|
if (!getShowData.ok || !getShowData.res) {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
|
||||||
describe: 'Set the page number for search results',
|
describe: 'Set the page number for search results',
|
||||||
docDescribe: 'The output is organized in pages. Use this command to output the items for the given page',
|
docDescribe: 'The output is organized in pages. Use this command to output the items for the given page',
|
||||||
group: 'search',
|
group: 'search',
|
||||||
service: ['crunchy'],
|
service: ['crunchy', 'hidive'],
|
||||||
type: 'number',
|
type: 'number',
|
||||||
usage: '${page}'
|
usage: '${page}'
|
||||||
},
|
},
|
||||||
|
|
@ -119,7 +119,7 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
|
||||||
name: 'new',
|
name: 'new',
|
||||||
describe: 'Get last updated series list',
|
describe: 'Get last updated series list',
|
||||||
docDescribe: true,
|
docDescribe: true,
|
||||||
service: ['crunchy'],
|
service: ['crunchy', 'hidive'],
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
usage: '',
|
usage: '',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "multi-downloader-nx",
|
"name": "multi-downloader-nx",
|
||||||
"short_name": "aniDL",
|
"short_name": "aniDL",
|
||||||
"version": "4.3.0b7",
|
"version": "4.3.0b8",
|
||||||
"description": "Downloader for Crunchyroll, Funimation, or Hidive via CLI or GUI",
|
"description": "Downloader for Crunchyroll, Funimation, or Hidive via CLI or GUI",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"download",
|
"download",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue