Skip to content

Commit

Permalink
Merge pull request #124 from caorushizi/feat/player
Browse files Browse the repository at this point in the history
refactor: 📦️  remove video player
  • Loading branch information
caorushizi authored Mar 20, 2024
2 parents e16009b + 86e25b8 commit a884f69
Show file tree
Hide file tree
Showing 38 changed files with 22 additions and 1,517 deletions.
1 change: 0 additions & 1 deletion internal
Submodule internal deleted from c37d4e
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
"scripts": {
"dev": "tsno run scripts/dev.ts && pnpm --parallel -F \"./packages/*\" run dev",
"build": "tsno run scripts/build.ts",
"build:player": "pnpm -F player run build",
"build:plugin": "pnpm -F plugin run build",
"build:main": "pnpm -F main run build",
"build:renderer": "pnpm -F renderer run build",
"build:server": "tsno run scripts/build-server.ts",
"pack": "pnpm -F media-downloader run pack",
"release": "pnpm run build && pnpm -F main run release",
"docs:dev": "vitepress dev docs",
Expand Down
4 changes: 0 additions & 4 deletions packages/main/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import path from "path";
import MainWindow from "./windows/MainWindow";
import WebviewService from "./services/WebviewService";
import VideoRepository from "./repository/VideoRepository";
import VideoService from "./services/VideoService";
import ElectronDevtools from "./vendor/ElectronDevtools";
import ElectronStore from "./vendor/ElectronStore";
import ElectronUpdater from "./vendor/ElectronUpdater";
Expand Down Expand Up @@ -36,14 +35,11 @@ export default class ElectronApp {
private readonly devTools: ElectronDevtools,
@inject(TYPES.ElectronStore)
private readonly store: ElectronStore,
@inject(TYPES.VideoService)
private readonly videoService: VideoService,
) {}

private async seriveInit(): Promise<void> {
this.mainWindow.init();
this.webview.init();
this.videoService.init();
}

private async vendorInit() {
Expand Down
17 changes: 1 addition & 16 deletions packages/main/src/controller/DownloadController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import MainWindow from "../windows/MainWindow";
import ElectronStore from "../vendor/ElectronStore";
import DownloadService from "../services/DownloadService";
import VideoRepository from "../repository/VideoRepository";
import { existsSync } from "fs-extra";

@injectable()
export default class DownloadController implements Controller {
Expand Down Expand Up @@ -66,22 +65,8 @@ export default class DownloadController implements Controller {

@handle("get-download-items")
async getDownloadItems(e: IpcMainEvent, pagination: DownloadItemPagination) {
const localDir = this.store.get("local");
const videos = await this.videoRepository.findVideos(pagination);
const newVideos = videos.list.map((video) => {
if (video.status === DownloadStatus.Success) {
return {
...video,
exist: existsSync(`${localDir}/${video.name}.mp4`),
};
}
return video;
});

return {
total: videos.total,
list: newVideos,
};
return videos;
}

@handle("start-download")
Expand Down
2 changes: 0 additions & 2 deletions packages/main/src/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Controller } from "./interfaces";
import { TYPES } from "./types";
import MainWindow from "./windows/MainWindow";
import BrowserWindow from "./windows/BrowserWindow";
import VideoService from "./services/VideoService";
import { SniffingHelper } from "./services/SniffingHelperService";
import DownloadService from "./services/DownloadService";
import ElectronLogger from "./vendor/ElectronLogger";
Expand All @@ -32,7 +31,6 @@ container.bind<ElectronApp>(TYPES.ElectronApp).to(ElectronApp);
// services
container.bind<WebviewService>(TYPES.WebviewService).to(WebviewService);
container.bind<DownloadService>(TYPES.DownloadService).to(DownloadService);
container.bind<VideoService>(TYPES.VideoService).to(VideoService);
container.bind<SniffingHelper>(TYPES.SniffingHelper).to(SniffingHelper);

// windows
Expand Down
36 changes: 0 additions & 36 deletions packages/main/src/services/VideoService.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/main/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ export const TYPES = {
FavoriteRepository: Symbol.for("FavoriteRepository"),
// windows
BrowserWindow: Symbol.for("BrowserWindow"),
PlayerWindow: Symbol.for("PlayerWindow"),
MainWindow: Symbol.for("MainWindow"),
// services
WebviewService: Symbol.for("WebviewService"),
DownloadService: Symbol.for("DownloadService"),
VideoService: Symbol.for("VideoService"),
SessionService: Symbol.for("SessionService"),
ProtocolService: Symbol.for("ProtocolService"),
SniffingHelper: Symbol.for("SniffingHelper"),
Expand Down
18 changes: 0 additions & 18 deletions packages/player/.eslintrc.cjs

This file was deleted.

30 changes: 0 additions & 30 deletions packages/player/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions packages/player/.prettierrc.json

This file was deleted.

46 changes: 0 additions & 46 deletions packages/player/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/player/auto-imports.d.ts

This file was deleted.

21 changes: 0 additions & 21 deletions packages/player/components.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/player/env.d.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/player/index.html

This file was deleted.

43 changes: 0 additions & 43 deletions packages/player/package.json

This file was deleted.

Binary file removed packages/player/public/favicon.ico
Binary file not shown.
9 changes: 0 additions & 9 deletions packages/player/src/App.vue

This file was deleted.

1 change: 0 additions & 1 deletion packages/player/src/hooks/index.ts

This file was deleted.

Loading

0 comments on commit a884f69

Please sign in to comment.