Skip to content

Commit

Permalink
Merge pull request #5 from RvNovae/develop
Browse files Browse the repository at this point in the history
1.6.2 Update
  • Loading branch information
RvNovae authored Jan 18, 2020
2 parents e9d2a0f + 54bce05 commit 64cea3d
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 55 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function createWindow () {
mainWindow.loadFile('src/index.html')

// Open the DevTools.
//mainWindow.webContents.openDevTools()
mainWindow.webContents.openDevTools()

mainWindow.removeMenu();

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tracklister",
"version": "1.6.1",
"version": "1.6.2",
"description": "Generating tracklists from .m3u8 and .nml files.",
"main": "main.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.11.2",
"array-move": "^2.2.0",
"bulma": "^0.7.5",
"bulma": "^0.8.0",
"electron-json-storage": "^4.1.8",
"firstline": "^2.0.2",
"music-metadata": "^4.8.2",
Expand Down
48 changes: 42 additions & 6 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@
<button class="button is-white is-small" onclick="DOM.Modal.Open('about_modal')" id="about_btn">About</button>
<center>
<p class="title is-3">Tracklister</p>
<p class="subtitle is-5 is-underlined">For Rekordbox, Traktor, Serato and Virtual DJ!</p>
Drag and drop your .m3u8, .nml, .csv or .m3u file!
<!-- <p class="subtitle is-5 is-underlined">For Rekordbox, Traktor, Serato and Virtual DJ!</p>
Drag and drop your .m3u8, .nml, .csv or .m3u file! -->
</center>
</div>
<hr>
<div id="tracklist"></div>
<div id="pure_text"></div>
<!-- <footer class="footer">
<footer class="footer" id="bpl_footer">
<div class="buttons"></div>
<button class="button is-white is-small" id="add_bl_btn">
<span class="icon is-small">
<i class="fas fa-plus"></i>
</span>
</button>
<span id="bl_current"></span>
</footer> -->
</footer>
<div class="modal" id="drop_modal">
<div class="modal-background"></div>
<center>
Expand Down Expand Up @@ -91,13 +92,26 @@
<span class="tag is-info">.m3u</span>
</div>
</div>
<div class="control">
<div class="tags has-addons">
<span class="tag is-dark">Single audio files</span>
<span class="tag is-info">.wav</span>
<span class="tag is-info">.mp3</span>
<span class="tag is-info">.flac</span>
<span class="tag is-info">.aiff</span>
<span class="tag is-info">.aif</span>
<span class="tag is-info">.aac</span>
<span class="tag is-info">.ogg</span>
<span class="tag is-info">.wma</span>
</div>
</div>
</div>
<hr>
<p class="title">Settings Guide</p>
<p class="title is-5">Promo Syntax</p>
<p>
This is what the entry will be changed to when pressing the "Set To Promo" button. <br>
Usually people use Unknown Artist - Unknown Title or ID - ID
Usually people use <b>Unknown Artist - Unknown Title</b> or <b>ID - ID</b>
</p><br>
<p class="title is-5">Ignore List</p>
<p>
Expand Down Expand Up @@ -130,15 +144,21 @@
Especially if your - seperator is not spaced or does not exist. <br>
Tag your tracks, folks!
</p>
<p class="title is-5">Beatport-Link Integration</p>
<p>
Since creating tracklists with Beatport-Link tracks is an absolute pain, <br/>
Tracklister will, when enabled, attempt to somewhat automate that process
</p>
<hr>
<p>
Please be adviced that when disabling options that remove content,
Please be adviced that when disabling options that alter content,
you will have to reload your source file, in order to restore that content.
</p> <br>
<button class="button is-link is-fullwidth" onclick="DOM.Modal.Close('help_modal')">Got it!</button>
</div>
</div>
</div>

<div class="modal" id="edit_modal">
<div class="modal-background"></div>
<div class="modal-card">
Expand All @@ -149,6 +169,22 @@
</div>
</div>
</div>

<div class="modal" id="yesno_modal">
<div class="modal-background"></div>
<div class="modal-card">
<div class="modal-card-body">
<center><p class="title is-4">Start fresh?</p></center>
<hr>
<div class="buttons is-centered">
<button class="button is-danger submit yesno_button" data-value="yes" onclick="DOM.Modal.Close('yesno_modal')">Yes</button>
<button class="button is-primary yesno_button" data-value="no" onclick="DOM.Modal.Close('yesno_modal')">No</button>
<button class="button yesno_button" data-value="cancel" onclick="DOM.Modal.Close('yesno_modal')">Cancel</button>
</div>
</div>
</div>
</div>

<div class="modal" id="settings_modal">
<div class="modal-background"></div>
<div class="modal-card">
Expand Down
89 changes: 72 additions & 17 deletions src/modules/DOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Converter = require('./converter');
const Filter = require('./filter');

window.scrollPos = 0;
document.getElementById('bpl_footer').style.visibility = "hidden";

Modal = {
Close: function(id){
Expand Down Expand Up @@ -88,19 +89,42 @@ Write = {
<i class="fas fa-eraser"></i> Delete
</a>
<hr class="dropdown-divider">
<a href="#" onclick="Editor.Edit.Promo(this, `+counter+`)" class="dropdown-item has-text-warning">
<a href="#" style="color:#0277BD" onclick="Editor.Edit.Promo(this, `+counter+`)" class="dropdown-item">
<i class="fas fa-asterisk"></i> Set to Promo
</a>
<a href="#" onclick="Editor.Edit.Start(this, `+counter+`)" class="dropdown-item">
<i class="fas fa-edit"></i> Edit
</a>
<hr class="dropdown-divider">
<a href="#" onclick="Editor.Move.Up(this, `+counter+`)" class="dropdown-item">
<i class="fas fa-angle-up"></i> Move Up
</a>
<a href="#" onclick="Editor.Move.Down(this, `+counter+`)" class="dropdown-item">
<i class="fas fa-angle-down"></i> Move Down
</a>
<div class="field has-addons">
<p class="control">
<a class="button" onclick="Editor.Move.Down('move-`+ counter +`')">
<span class="icon is-small">
<i class="fas fa-angle-up"></i>
</span>
</a>
</p>
<p class="control">
<a class="button" onclick="Editor.Move.Up('move-`+ counter +`')">
<span class="icon is-small">
<i class="fas fa-angle-down"></i>
</span>
</a>
</p>
<p class="control">
<input class="input" oninput="Editor.Move.Check(this)" data-pos="` + counter + `" id="move-`+ counter +`" value=`+counter+` placeholder="Pos">
</p>
<p class="control">
<a class="button submit" onclick="Editor.Move.To('move-`+ counter +`')">
<span class="icon is-small">
<i class="fas fa-check"></i>
</span>
</a>
</p>
</div>
<hr class="dropdown-divider">
<a href="#" onclick="Editor.Add.Above(` + (counter) + `)" class="dropdown-item">
<i class="fas fa-angle-double-up"></i> Insert 1 above
Expand Down Expand Up @@ -152,20 +176,44 @@ Array.from(document.getElementsByClassName('modal-background')).forEach(function
});
});

function YesNo() {
return new Promise((resolve, reject) => {
Modal.Open('yesno_modal');
Array.from(document.getElementsByClassName('yesno_button')).forEach( (element) => {
element.addEventListener('click', (e) => {
resolve(e.srcElement.dataset.value);
});
});
});
}

// listen for file drop
document.addEventListener('drop', (e) => {
files = e.dataTransfer.files;
e.preventDefault();
e.stopPropagation();
// clear / prepare the UI if playlist file
if (RegExp('.m3u8|.csv|.m3u|.nml').test(Helper.RegExp.Escape(e.dataTransfer.files[0].path))) {
DOM.UI.Set();
}

// get file object from drop
for (const f of e.dataTransfer.files) {
// start the conversion process
// convertFile(f.path);
Converter.Start(f.path);
if (Data.Tracks.length < 1) {
for (const f of e.dataTransfer.files) {
// start the conversion process
Converter.Start(f.path);
}
return;
}

YesNo().then( (val) => {
if (val == 'yes')
DOM.UI.Set();
if (val == 'cancel')
return;

for (const f of files) {
Converter.Start(f.path);
}
});

return;
}
});

Expand All @@ -177,10 +225,17 @@ document.getElementById('copy_btn').addEventListener('click', function() {
this.innerHTML = '<i class="fas fa-copy"></i>';
});
document.getElementById('erase_btn').addEventListener('click', function() {
Data.Tracks.length = 0;
DOM.UI.Reset();
if (Data.Tracks.length < 1) {return;}
YesNo().then((val) => {
if (val == 'yes') {
Data.Tracks.length = 0;
DOM.UI.Reset();
}
});

});


// NOT IMPLEMENTED YET

// dragover function (no implementation yet)
Expand Down
1 change: 1 addition & 0 deletions src/modules/beatport-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function monitor(path) {

console.log(artist + " - " + title);
document.getElementById('bl_current').innerHTML = artist + " - " + title;
document.getElementById('bpl_footer').style.visibility = "visible";
}

},
Expand Down
11 changes: 5 additions & 6 deletions src/modules/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ module.exports = {
audio(inputFile);
break;
default:
alert('Unsupported file type! .m3u8, .nml, .csv and .m3u are supported.');
DOM.UI.Reset();
alert('Unsupported file type! .m3u8, .nml, .csv, .m3u and audio files are supported.');
break;
}
}
Expand All @@ -47,7 +46,7 @@ module.exports = {
// interpretations differ from program to program
function m3u8(inputFile) {
// declare counter and track
var counter = 0;
var counter = Data.Tracks.length;
var track;
// create a readline filestream, in order to read the file line by line
const rl = READLINE.createInterface({
Expand Down Expand Up @@ -91,7 +90,7 @@ function m3u8(inputFile) {
// interpretations differ from program to program
function csv(inputFile) {
// declare counter, line_counter and track
var counter = 0;
var counter = Data.Tracks.length;
var line_counter = 0;
var track;
// create filestream in order to read the file line by line
Expand Down Expand Up @@ -135,7 +134,7 @@ function csv(inputFile) {
// interpretations differ from program to program
function nml(input_file) {
// declare some variables
var counter = 0;
var counter = Data.Tracks.length;
var track;
var json;
var content;
Expand Down Expand Up @@ -172,7 +171,7 @@ function nml(input_file) {
// interpretations differ from program to program
function m3u(input_file) {
// declare variables
var counter = 0;
var counter = Data.Tracks.length;
var track;
// create filestream to read the file line by line
const rl = READLINE.createInterface({
Expand Down
Loading

0 comments on commit 64cea3d

Please sign in to comment.