mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-25 07:23:20 +03:00
fixed bug where custom paths failed to stream
This commit is contained in:
@@ -697,7 +697,7 @@ app.post('/api/tomp4', function(req, res) {
|
|||||||
|
|
||||||
// gets the status of the mp3 file that's being downloaded
|
// gets the status of the mp3 file that's being downloaded
|
||||||
app.post('/api/fileStatusMp3', function(req, res) {
|
app.post('/api/fileStatusMp3', function(req, res) {
|
||||||
var name = decodeURI(req.body.name + "");
|
var name = decodeURIComponent(req.body.name + "");
|
||||||
var exists = "";
|
var exists = "";
|
||||||
var fullpath = audioFolderPath + name + ".mp3";
|
var fullpath = audioFolderPath + name + ".mp3";
|
||||||
if (fs.existsSync(fullpath)) {
|
if (fs.existsSync(fullpath)) {
|
||||||
@@ -719,7 +719,7 @@ app.post('/api/fileStatusMp3', function(req, res) {
|
|||||||
|
|
||||||
// gets the status of the mp4 file that's being downloaded
|
// gets the status of the mp4 file that's being downloaded
|
||||||
app.post('/api/fileStatusMp4', function(req, res) {
|
app.post('/api/fileStatusMp4', function(req, res) {
|
||||||
var name = decodeURI(req.body.name);
|
var name = decodeURIComponent(req.body.name);
|
||||||
var exists = "";
|
var exists = "";
|
||||||
var fullpath = videoFolderPath + name + ".mp4";
|
var fullpath = videoFolderPath + name + ".mp4";
|
||||||
if (fs.existsSync(fullpath)) {
|
if (fs.existsSync(fullpath)) {
|
||||||
@@ -919,7 +919,7 @@ app.post('/api/downloadFile', async (req, res) => {
|
|||||||
let outputName = req.body.outputName;
|
let outputName = req.body.outputName;
|
||||||
let file = null;
|
let file = null;
|
||||||
if (!is_playlist) {
|
if (!is_playlist) {
|
||||||
fileNames = decodeURI(fileNames);
|
fileNames = decodeURIComponent(fileNames);
|
||||||
if (type === 'audio') {
|
if (type === 'audio') {
|
||||||
file = __dirname + '/' + audioFolderPath + fileNames + '.mp3';
|
file = __dirname + '/' + audioFolderPath + fileNames + '.mp3';
|
||||||
} else if (type === 'video') {
|
} else if (type === 'video') {
|
||||||
@@ -927,7 +927,7 @@ app.post('/api/downloadFile', async (req, res) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < fileNames.length; i++) {
|
for (let i = 0; i < fileNames.length; i++) {
|
||||||
fileNames[i] = decodeURI(fileNames[i]);
|
fileNames[i] = decodeURIComponent(fileNames[i]);
|
||||||
}
|
}
|
||||||
file = await createPlaylistZipFile(fileNames, type, outputName);
|
file = await createPlaylistZipFile(fileNames, type, outputName);
|
||||||
}
|
}
|
||||||
@@ -948,7 +948,7 @@ app.post('/api/deleteFile', async (req, res) => {
|
|||||||
|
|
||||||
app.get('/api/video/:id', function(req , res){
|
app.get('/api/video/:id', function(req , res){
|
||||||
var head;
|
var head;
|
||||||
let id = decodeURI(req.params.id);
|
let id = decodeURIComponent(req.params.id);
|
||||||
const path = "video/" + id + '.mp4';
|
const path = "video/" + id + '.mp4';
|
||||||
const stat = fs.statSync(path)
|
const stat = fs.statSync(path)
|
||||||
const fileSize = stat.size
|
const fileSize = stat.size
|
||||||
@@ -988,7 +988,7 @@ app.get('/api/video/:id', function(req , res){
|
|||||||
|
|
||||||
app.get('/api/audio/:id', function(req , res){
|
app.get('/api/audio/:id', function(req , res){
|
||||||
var head;
|
var head;
|
||||||
let id = decodeURI(req.params.id);
|
let id = decodeURIComponent(req.params.id);
|
||||||
let path = "audio/" + id + '.mp3';
|
let path = "audio/" + id + '.mp3';
|
||||||
path = path.replace(/\"/g, '\'');
|
path = path.replace(/\"/g, '\'');
|
||||||
const stat = fs.statSync(path)
|
const stat = fs.statSync(path)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export class PlayerComponent implements OnInit {
|
|||||||
for (let i = 0; i < this.fileNames.length; i++) {
|
for (let i = 0; i < this.fileNames.length; i++) {
|
||||||
const fileName = this.fileNames[i];
|
const fileName = this.fileNames[i];
|
||||||
const baseLocation = (this.type === 'audio') ? this.audioFolderPath : this.videoFolderPath;
|
const baseLocation = (this.type === 'audio') ? this.audioFolderPath : this.videoFolderPath;
|
||||||
const fullLocation = this.baseStreamPath + baseLocation + encodeURI(fileName); // + (this.type === 'audio' ? '.mp3' : '.mp4');
|
const fullLocation = this.baseStreamPath + baseLocation + encodeURIComponent(fileName);
|
||||||
// if it has a slash (meaning it's in a directory), only get the file name for the label
|
// if it has a slash (meaning it's in a directory), only get the file name for the label
|
||||||
let label = null;
|
let label = null;
|
||||||
const decodedName = decodeURIComponent(fileName);
|
const decodedName = decodeURIComponent(fileName);
|
||||||
|
|||||||
Reference in New Issue
Block a user