better handling all around for files and symlinks
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { error } from "@sveltejs/kit";
|
||||
import { getStreamInfo } from "$lib/database.js";
|
||||
import { dev } from "$app/environment";
|
||||
import { STREAM_JSON_LOCATION } from '$env/static/private';
|
||||
|
||||
let getOriginalJson, writeSideloadJson;
|
||||
export let actions;
|
||||
|
||||
// utilities for manipulating original stream JSONs
|
||||
if (dev) {
|
||||
const jsonFolder = './db/stream_json/';
|
||||
const jsonFolder = path.resolve(STREAM_JSON_LOCATION);
|
||||
|
||||
getOriginalJson = function (streamId) {
|
||||
const filePath = jsonFolder + streamId + ".sideload.json";
|
||||
const filePath = path.join(jsonFolder, streamId + ".sideload.json");
|
||||
if (fs.existsSync(filePath)) {
|
||||
const jsonString = fs.readFileSync(filePath, 'utf8');
|
||||
return jsonString;
|
||||
@@ -21,7 +23,7 @@ if (dev) {
|
||||
}
|
||||
|
||||
writeSideloadJson = function (streamId, newJson) {
|
||||
const filePath = jsonFolder + streamId + ".sideload.json";
|
||||
const filePath = path.join(jsonFolder, streamId + ".sideload.json");
|
||||
fs.writeFileSync(filePath, JSON.stringify(newJson), 'utf8');
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<StreamPage />
|
||||
</div>
|
||||
<div id="player">
|
||||
<Player display={true} src="/files/tracks/{$currentStream.filename}" />
|
||||
<Player display={true} src="/media/tracks/{$currentStream.filename}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
export let paused = true;
|
||||
export let duration = 0;
|
||||
export let muted = false;
|
||||
export let volume = 1;
|
||||
export let volume = 0.67;
|
||||
export let preload = 'metadata';
|
||||
export let iconColor = 'gray';
|
||||
export let textColor = 'gray';
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
onMount(async () => {
|
||||
const volumeData = localStorage.getItem('volume');
|
||||
volume = volumeData ? parseFloat(volumeData) : 1;
|
||||
volume = volumeData ? parseFloat(volumeData) : 0.67;
|
||||
});
|
||||
|
||||
$: updateCurrentSong(currentTime, $currentSongIndex);
|
||||
|
||||
Reference in New Issue
Block a user