Skip to content

Commit

Permalink
New GUI - BETA
Browse files Browse the repository at this point in the history
  • Loading branch information
izu-co authored Feb 15, 2022
2 parents e8eeee5 + 7423fac commit b24a55c
Show file tree
Hide file tree
Showing 67 changed files with 55,757 additions and 9,401 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lib
/videos/*.ts
crunchy
crunchy
build
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
Expand All @@ -21,6 +27,10 @@
"error",
2
],
"linebreak-style": [
"error",
"windows"
],
"quotes": [
"error",
"single"
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/release-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@ on:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [ linux64, macos64, win64 ]
build_type: [ ubuntu, macos, windows ]
gui: [ gui, cli ]
runs-on: ${{ matrix.build_type }}-latest
steps:
- name: Set build type
run: |
echo BUILD_TYPE=${{ matrix.build_type }} >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
check-latest: true

- name: Install Node modules
run: npm install
run: |
npm install
- name: Get name and version from package.json
run: |
Expand All @@ -33,14 +32,14 @@ jobs:
echo PACKAGE_NAME=$(node -p -e "require('./package.json').name") >> $GITHUB_ENV &&
echo PACKAGE_VERSION=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV || exit 1
- name: Make build
run: npm run build-${{ env.BUILD_TYPE }}
run: npm run build-${{ matrix.build_type }}-${{ matrix.gui }}

- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-${{ env.BUILD_TYPE }}.7z
asset_path: ./lib/_builds/${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-${{ env.BUILD_TYPE }}.7z
asset_name: multi-downloader-nx-${{ matrix.build_type }}-${{ matrix.gui }}.7z
asset_path: ./lib/_builds/multi-downloader-nx-${{ matrix.build_type }}64-${{ matrix.gui }}.7z
asset_content_type: application/x-7z-compressed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/bin/ff*
/bin/mkv*
/_builds/*
/node_modules/
**/node_modules/
/videos/*.json
/videos/*.ts
.DS_Store
Expand All @@ -22,4 +22,8 @@ updates.json
funi_token.yml
cr_token.yml
archive.json
fonts
fonts
.webpack/
out/
dist/
build/
40 changes: 39 additions & 1 deletion @types/crunchyTypes.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
import { HLSCallback } from 'hls-download';
import { sxItem } from '../crunchy';
import { LanguageItem } from '../modules/module.langsData';
import { DownloadInfo } from './messageHandler';

export type CrunchyDownloadOptions = {
hslang: string,
kstream: number,
novids?: boolean,
x: number,
q: number,
fileName: string,
numbers: number,
partsize: number,
callbackMaker?: (data: DownloadInfo) => HLSCallback,
timeout: number,
fsRetryTime: number,
dlsubs: string[],
skipsubs: boolean,
mp4: boolean
}

export type CurnchyMultiDownload = {
dubLang: string[],
all?: boolean,
but?: boolean,
e?: string
}

export type CrunchyMuxOptions = {
output: string,
skipSubMux?: boolean
novids?: boolean,
mp4: boolean,
forceMuxer?: 'ffmpeg'|'mkvmerge',
nocleanup?: boolean
}

export type CrunchyEpMeta = {
data: {
Expand All @@ -11,7 +46,10 @@ export type CrunchyEpMeta = {
episodeNumber: string,
episodeTitle: string,
seasonID: string,
season: number
season: number,
showID: string,
e: string,
image: string
}

export type DownloadedMedia = {
Expand Down
34 changes: 34 additions & 0 deletions @types/funiSearch.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Generated by https://quicktype.io

export interface FunimationSearch {
count: number;
items: Items;
limit: string;
offset: string;
}

export interface Items {
hits: Hit[];
}

export interface Hit {
ratings: string;
description: string;
title: string;
image: {
showThumbnail: string,
[key: string]: string
};
starRating: number;
slug: string;
languages: string[];
synopsis: string;
quality: Quality;
id: string;
txDate: number;
}

export interface Quality {
quality: string;
height: number;
}
3 changes: 2 additions & 1 deletion @types/funiTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { LanguageItem } from '../modules/module.langsData';
export type FunimationMediaDownload = {
id: string,
title: string,
showTitle: string
showTitle: string,
image: string
}

export type Subtitle = {
Expand Down
5 changes: 4 additions & 1 deletion @types/hls-download.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
declare module 'hls-download' {
import type { ProgressData } from './messageHandler';
export type HLSCallback = (data: ProgressData) => unknown;
export default class hlsDownload {
constructor(options: {
m3u8json: {
Expand All @@ -13,7 +15,8 @@ declare module 'hls-download' {
proxy?: string,
skipInit?: boolean,
timeout?: number,
fsRetryTime?: number
fsRetryTime?: number,
callback?: HLSCallback
})
async download() : Promise<{
ok: boolean,
Expand Down
2 changes: 1 addition & 1 deletion @types/items.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface Item {
mostRecentSvodUs: MostRecent;
item: Item;
mostRecentSvodEngAllTerrStartTimestamp: number;
audio: Audio[];
audio: string[];
mostRecentAvod: MostRecent;
}

Expand Down
122 changes: 122 additions & 0 deletions @types/messageHandler.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import { HLSCallback } from 'hls-download';
import type { FunimationSearch } from './funiSearch';
import type { AvailableMuxer } from '../modules/module.args';

export interface MessageHandler {
auth: (data: AuthData) => Promise<AuthResponse>;
checkToken: () => Promise<CheckTokenResponse>;
search: (data: SearchData) => Promise<SearchResponse>,
availableDubCodes: () => Promise<string[]>,
handleDefault: (name: string) => Promise<any>,
resolveItems: (data: ResolveItemsData) => Promise<ResponseBase<QueueItem[]>>,
listEpisodes: (id: string) => Promise<EpisodeListResponse>,
downloadItem: (data) => void,
isDownloading: () => boolean,
writeToClipboard: (text: string) => void,
openFolder: (path: string[]) => void
}

export type QueueItem = {
title: string,
episode: string,
ids: string[],
fileName: string,
parent: {
title: string,
season: string
},
q: number,
dubLang: string[],
}

export type ResolveItemsData = {
id: string,
dubLang: string[],
all: boolean,
but: boolean,
e: string,
fileName: string,
q: number
}

export type SearchResponseItem = {
image: string,
name: string,
desc?: string,
id: string,
lang?: string[],
rating: number
};

export type Episode = {
e: string,
lang: string[],
name: string,
season: string,
seasonTitle: string,
episode: string,
id: string,
img: string,
description: string,
time: string
}

export type SearchResponse = ResponseBase<SearchResponseItem[]>
export type EpisodeListResponse = ResponseBase<Episode[]>

export type FuniEpisodeData = {
title: string,
episode: string,
episodeID: string,
seasonTitle: string,
seasonNumber: string,
};

export type AuthData = { username: string, password: string };
export type SearchData = { search: string, page?: number, 'search-type'?: string, 'search-locale'?: string };
export type FuniGetShowData = { id: number, e?: string, but: boolean, all: boolean };
export type FuniGetEpisodeData = { subs: FuniSubsData, fnSlug: FuniEpisodeData, simul?: boolean; dubLang: string[], s: string }
export type FuniStreamData = { callbackMaker?: (data: DownloadInfo) => HLSCallback, q: number, x: number, fileName: string, numbers: number, novids?: boolean,
timeout: number, partsize: number, fsRetryTime: number, noaudio?: boolean, mp4: boolean, ass: boolean, fontSize: number, fontName?: string, skipmux?: boolean,
forceMuxer: AvailableMuxer | undefined, simul: boolean, skipSubMux: boolean, nocleanup: boolean }
export type FuniSubsData = { nosubs?: boolean, sub: boolean, dlsubs: string[] }
export type DownloadData = { id: string, e: string, dubLang: string[], fileName: string, q: number }

export type AuthResponse = ResponseBase<undefined>;
export type FuniSearchReponse = ResponseBase<FunimationSearch>;
export type FuniShowResponse = ResponseBase<FuniEpisodeData[]>;
export type FuniGetEpisodeResponse = ResponseBase<undefined>;
export type CheckTokenResponse = ResponseBase<undefined>;


export type ResponseBase<T> = ({
isOk: true,
value: T
} | {
isOk: false,
reason: Error
});

export type ProgressData = {
total: number,
cur: number,
percent: number|string,
time: number,
downloadSpeed: number
};

export type PossibleMessanges = keyof ServiceHandler;

export type DownloadInfo = {
image: string,
parent: {
title: string
},
title: string,
fileName: string
}

export type ExtendedProgress = {
progress: ProgressData,
downloadInfo: DownloadInfo
}
13 changes: 13 additions & 0 deletions @types/randomEvents.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ExtendedProgress } from "./messageHandler";

export type RandomEvents = {
progress: ExtendedProgress,
finish: undefined
}

export interface RandomEvent<T extends keyof RandomEvents> {
name: T,
data: RandomEvents[T]
}

export type Handler<T extends keyof RandomEvents> = (data: RandomEvent<T>) => unknown;
3 changes: 3 additions & 0 deletions @types/serviceClassInterface.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ServiceClass {
cli: () => Promise<boolean|undefined|void>
}
13 changes: 13 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- [ ] Hls-Download force yes or no on rewrite promt as well as for mkvmerge/ffmpeg
- [x] Pick up if a download is currently in progress
- [x] Send more information with the progress event like the title and image to display more information
- [x] Use Click away listener for the search popup
- [x] Quality select button is uncrontrolled/controlled
- [ ] Set Options font in divider
- [x] Window title
- [x] Only open dev tools in test version
- [ ] Add help information (version, contributor, documentation...)
- [ ] App Icon with electron-forge make
- [x] ContextMenu
- [x] Better episode listing with selectio via left mouse button
- [x] Use Child for Context Menu
Loading

0 comments on commit b24a55c

Please sign in to comment.