moved getFilename function to services/folder.ts

This commit is contained in:
stratuma 2024-06-28 02:31:31 +02:00
parent 87a8f0f88b
commit 3f10dcb8a9
2 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
import { Account, Playlist } from '../../db/database'
import { downloadMPDAudio } from '../../services/audio'
import { concatenateTSFiles } from '../../services/concatenate'
import { checkFileExistence, createFolder, createFolderName, deleteFolder, deleteTemporaryFolders } from '../../services/folder'
import { checkFileExistence, createFolder, createFolderName, deleteFolder, deleteTemporaryFolders, getFilename } from '../../services/folder'
import { downloadADNSub, downloadCRSub } from '../../services/subs'
import { CrunchyEpisode } from '../../types/crunchyroll'
import { checkAccountMaxStreams, crunchyGetMetadata, crunchyGetPlaylist, crunchyGetPlaylistMPD } from '../crunchyroll/crunchyroll.service'
@ -1397,16 +1397,6 @@ async function mergeVideoFile(
if (format === 'mp4') {
options.push('-c:s mov_text')
}
const getFilename = function(path: string, ext: string, delimiter: string): string {
const segments = path.split(delimiter)
if (segments.length == 0) {
return "unkown"
}
return segments[segments.length - 1].split(ext)[0]
}
for (const [index, a] of audios.entries()) {
output.addInput(a)

View File

@ -100,3 +100,13 @@ export async function deleteTemporaryFolders() {
throw error
}
}
export function getFilename(path: string, ext: string, delimiter: string) {
const segments = path.split(delimiter)
if (segments.length == 0) {
return "unkown"
}
return segments[segments.length - 1].split(ext)[0]
}