some changes and removed taskbar progessbar

This commit is contained in:
stratuma 2024-05-06 23:50:25 +02:00
parent e877c5696a
commit 7d85f06fc8
14 changed files with 41 additions and 44 deletions

5
.env.default Normal file
View File

@ -0,0 +1,5 @@
FFMPEG_PATH=
FFPROBE_PATH=
MP4DECRYPT_PATH=
KEY_KEY=
KEY_CLIENT=

11
.gitignore vendored
View File

@ -18,11 +18,14 @@ debug.json
errors.json
build/
crunchyroll-downloader-output-*/
updater/
# FFMPEG
ffmpeg/
ffmpeg/ffmpeg.exe
ffmpeg/ffprobe.exe
# MP4DECRYPT
mp4decrypt/
src/api/services/widevine.ts
mp4decrypt/mp4decrypt.exe
# Keys
keys/client
keys/key

View File

@ -14,8 +14,7 @@ const options = {
nodeGypRebuild: true,
buildDependenciesFromSource: true,
// test 2
publish: {
provider: 'github',
releaseType: 'release'

0
ffmpeg/.gitkeep Normal file
View File

0
keys/.gitkeep Normal file
View File

0
mp4decrypt/.gitkeep Normal file
View File

View File

@ -8,7 +8,7 @@ export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss', 'nuxt-icon', '@nuxtjs/google-fonts'],
googleFonts: {
families: {
'DM+Sans': [600, '1000'],
'DM+Sans': ['600', '1000'],
'Protest+Riot': true
}
},

View File

@ -66,7 +66,7 @@
"extraResources": [
"./ffmpeg/**",
"./mp4decrypt/**",
"./updater/**"
"./keys/**"
]
}
}

View File

@ -1,8 +1,5 @@
import type { FastifyReply, FastifyRequest } from 'fastify'
import { crunchyLogin } from './crunchyroll.service'
import { dialog } from 'electron'
import { messageBox } from '../../../electron/background'
import { CrunchyEpisodes, CrunchySeason } from '../../types/crunchyroll'
import { loggedInCheck } from '../service/service.service'
export async function loginController(request: FastifyRequest, reply: FastifyReply) {

View File

@ -4,10 +4,9 @@ import { VideoPlaylist } from '../../types/crunchyroll'
import { useFetch } from '../useFetch'
import { parse as mpdParse } from 'mpd-parser'
import { loggedInCheck } from '../service/service.service'
import { app } from 'electron'
// Disable when Crunchyroll turns off switch endpoint
const enableDRMBypass = false
const enableDRMBypass = true
const crErrors = [
{

View File

@ -12,7 +12,7 @@ import { finished } from 'stream/promises'
import Ffmpeg from 'fluent-ffmpeg'
import { adnGetM3U8Playlist, adnGetPlaylist } from '../adn/adn.service'
import { ADNEpisode } from '../../types/adn'
import { messageBox, setProgressBar } from '../../../electron/background'
import { messageBox } from '../../../electron/background'
import { getFFMPEGPath } from '../../services/ffmpeg'
import { getDRMKeys, Uint8ArrayToBase64 } from '../../services/decryption'
import { getMP4DecryptPath } from '../../services/mp4decrypt'
@ -108,31 +108,6 @@ export async function getDownloading(id: number) {
return null
}
// Download Progress Bar Updater
function updateProgress() {
const totalParts = downloading.reduce((total, item) => total + item.partsToDownload, 0)
let downloadedParts = 0
downloading.forEach((item) => {
downloadedParts += item.downloadedParts
})
const progress = totalParts > 0 ? downloadedParts / totalParts : 0
setProgressBar(progress)
const allDownloaded = downloading.every((item) => item.downloadedParts === item.partsToDownload)
if (allDownloaded) {
setProgressBar(0)
return
}
}
cron.schedule('*/2 * * * * *', () => {
updateProgress()
})
// Define IsDownloading Count
var isDownloading: number = 0

View File

@ -10,7 +10,7 @@ if (isDev) {
export function getMP4DecryptPath() {
if (isDev) {
const mp4Decrypt = process.env.MP4DECRYPT
const mp4Decrypt = process.env.MP4DECRYPT_PATH
return mp4Decrypt
} else {

View File

@ -0,0 +1,23 @@
import { app } from 'electron'
import path from 'path'
const isDev = process.env.NODE_ENV === 'development'
const appPath = app.getAppPath()
const resourcesPath = path.dirname(appPath)
const keyPath = path.join(resourcesPath, 'keys')
if (isDev) {
require('dotenv').config()
}
export function getWVKPath() {
if (isDev) {
const key = process.env.KEY_KEY
const client = process.env.KEY_CLIENT
return { key: key, client: client }
} else {
const key = path.join(keyPath, 'key')
const client = path.join(keyPath, 'client')
return { key: key, client: client }
}
}

View File

@ -116,10 +116,6 @@ export async function messageBox(
console.log(response)
}
export async function setProgressBar(c: number) {
mainWindow.setProgressBar(c)
}
ipcMain.handle('dialog:openDirectory', async () => {
const window = BrowserWindow.getFocusedWindow()