Commit cc3e18b9 authored by Andreas Heimann's avatar Andreas Heimann

fixed identing, added user settings

parent a4b3d7cb
const DOMLibrarySongsList = document.querySelector(".song-row-library .song-list"); const DOMLibrarySongsList = document.querySelector(".song-row-library .song-list");
//The Extraction Process function ExtractionProcess(filePath) {
function ExtractionProcess(filePath){
//Basic .zip detection so the console doesnt throw a flurry of errors complaining it can't unzip.
if (filePath.endsWith('.zip')){ if (filePath.endsWith('.zip')){
let fileName = path.basename(filePath) let fileName = path.basename(filePath);
srxdControl.extractBackup(filePath, fileName).then(function(extractResults) { srxdControl.extractBackup(filePath, fileName).then(function(extractResults) {
if(extractResults) { if(extractResults) {
installBackup(extractResults); installBackup(extractResults);
setTimeout(function() { setTimeout(function() {
RefreshLibrary(); RefreshLibrary();
}, 200); }, 200);
} } else {
else { console.error("Backup could not be loaded!");
console.error("Backup could not be loaded!"); }
}
}); });
} }
else {console.error('Not a zip!');} else {console.error('Not a zip!');}
...@@ -30,18 +27,20 @@ function InstallBackupManually() { ...@@ -30,18 +27,20 @@ function InstallBackupManually() {
}); });
} }
//Drag and Drop // Drag and Drop
document.ondragover = document.ondrop = (dragndrop) => { document.ondragover = document.ondrop = function(dragndrop) {
dragndrop.preventDefault(); dragndrop.preventDefault();
} }
document.body.ondrop = (ev) => { document.body.ondrop = function(ev) {
let filePath = (ev.dataTransfer.files[0].path) let filePath = (ev.dataTransfer.files[0].path);
ev.preventDefault() ev.preventDefault();
ExtractionProcess(filePath); ExtractionProcess(filePath);
} }
function RefreshLibrary() { function RefreshLibrary() {
console.log("Refreshing Library");
// Clear current songs // Clear current songs
let installElement = DOMLibrarySongsList.firstElementChild; let installElement = DOMLibrarySongsList.firstElementChild;
...@@ -49,15 +48,15 @@ function RefreshLibrary() { ...@@ -49,15 +48,15 @@ function RefreshLibrary() {
DOMLibrarySongsList.appendChild(installElement); DOMLibrarySongsList.appendChild(installElement);
// Load all custom songs // Load all custom songs
let customSongs = srxdControl.getLocalSongs(userGameDirectory); let customSongs = srxdControl.getLocalSongs(userSettings.get('gameDirectory'));
// remove current songs // remove current songs
customSongs.forEach(function(customSong) { customSongs.forEach(function(customSong) {
let songDetail = srxdControl.getSongDetail(path.join(userGameDirectory, customSong)); let songDetail = srxdControl.getSongDetail(path.join(userSettings.get('gameDirectory'), customSong));
let spinShareReference = false; let spinShareReference = false;
if(customSong.includes("spinshare_")) { if(customSong.includes("spinshare_")) {
spinShareReference = customSong.replace("spinshare_", "").replace(".srtb", ""); spinShareReference = customSong.replace(".srtb", "");
} }
DOMLibrarySongsList.appendChild(BuildLibrarySongDOM(songDetail, spinShareReference)); DOMLibrarySongsList.appendChild(BuildLibrarySongDOM(songDetail, spinShareReference));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment