diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de4d1f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +dist +node_modules diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a15d24f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Run Build script", + "program": "${workspaceFolder}\\build.js" + } + ] +} diff --git a/build.js b/build.js new file mode 100644 index 0000000..e973064 --- /dev/null +++ b/build.js @@ -0,0 +1,35 @@ +const ini = require('multi-ini'); +const zipdir = require('zip-dir'); +const semver = require('semver'); +const packagejson = require('./package.json'); + +let fullverstring = ''; +const version = packagejson.version; +const file = './source/Install.ini'; +const content = ini.read(file); + +if ( + content && + content.Header && + content.Header.VersionBuild +) { + const head = content.Header; + + head.VersionMajor = `${semver(version).major}`; + head.VersionMinor = `${semver(version).minor}`; + head.VersionRelease = `${semver(version).patch}`; + head.VersionBuild = `${Number(head.VersionBuild) + 1}`; + + fullverstring = [ + head.VersionMajor, + head.VersionMinor, + head.VersionRelease, + head.VersionBuild + ].join('.'); + ini.write(file, content); +} +zipdir('./source', { + saveTo: `./dist/Lyrics To Instrumental v${fullverstring}.mmip` +}, () => { + +}); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..814f612 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,66 @@ +{ + "name": "lyrics-to-instrumental", + "version": "2.3.4", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, + "clean-stacktrace": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/clean-stacktrace/-/clean-stacktrace-1.1.0.tgz", + "integrity": "sha1-i4zch/ZA2qupxZWrbtuJe2OwzjM=", + "requires": { + "stack-utils-node-internals": "^1.0.1" + } + }, + "jszip": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-2.6.1.tgz", + "integrity": "sha1-uI86ey5noqBIFSmCx6N1bZxIKPA=", + "requires": { + "pako": "~1.0.2" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "multi-ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/multi-ini/-/multi-ini-2.0.0.tgz", + "integrity": "sha512-1f8ARxyQesSeRrBNRC0lwD5nDa9cJj/TI0t7vamGrpVRKAlWhM+4gTJbreFJge+rJ27f7zMbahDoND16cYmOzg==", + "requires": { + "lodash": "^4.0.0" + } + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==" + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" + }, + "stack-utils-node-internals": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stack-utils-node-internals/-/stack-utils-node-internals-1.0.1.tgz", + "integrity": "sha1-q0qKRptsvscrC/tYnfXiix0SKB8=" + }, + "zip-dir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/zip-dir/-/zip-dir-1.0.2.tgz", + "integrity": "sha1-JT+QeurWKiGs2HIdi4gDKyQRwFE=", + "requires": { + "async": "^1.5.2", + "jszip": "^2.4.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..72f0f9e --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "lyrics-to-instrumental", + "version": "1.0.0", + "description": "Mediamonkey plugin: Toolbar button to set lyrics to instrumental for the currently selected songs", + "main": "build.js", + "scripts": { + "build": "node build.js" + }, + "author": "Tom A. Vibeto (https://onlyhuman.dk)", + "license": "ISC", + "dependencies": { + "clean-stacktrace": "^1.1.0", + "multi-ini": "^2.0.0", + "semver": "^5.5.0", + "zip-dir": "^1.0.2" + } +} diff --git a/source/App.ico b/source/App.ico new file mode 100644 index 0000000..4265c9c Binary files /dev/null and b/source/App.ico differ diff --git a/source/Install.ini b/source/Install.ini new file mode 100644 index 0000000..b566a01 --- /dev/null +++ b/source/Install.ini @@ -0,0 +1,15 @@ +[Header] +ID="LyricsToInstrumental" +Title="Lyrics To Instrumental" +Description="Toolbar button to set lyrics to instrumental for the currently selected songs" +VersionMajor="1" +VersionMinor="0" +VersionRelease="0" +VersionBuild="1" +Type="script" +[Copy] +Src="LyricsToInstrumental.vbs" +Tgt="{app}\Scripts\Auto\LyricsToInstrumental.vbs" +[Execute] +File="{app}\Scripts\Auto\LyricsToInstrumental.vbs" +Function="OnStartup()" diff --git a/source/LyricsToInstrumental.vbs b/source/LyricsToInstrumental.vbs new file mode 100644 index 0000000..1c966e6 --- /dev/null +++ b/source/LyricsToInstrumental.vbs @@ -0,0 +1,36 @@ +' A script adding a button, that sets lyrics to "Instrumental" + +Sub OnStartup + Dim btn : Set btn = SDB.Objects("LyricsInsrumentalButton") + If btn Is Nothing Then + Set btn = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard,0,0) + btn.Caption = "Lyrics to Instrumental" + btn.IconIndex = 17 + Set SDB.Objects("LyricsInsrumentalButton") = btn + End If + Call Script.UnRegisterHandler("btnClick") + Call Script.RegisterEvent(btn,"OnClick","btnClick") +End Sub + +Sub btnClick(btn) + Call LyricsToInstrumental() +End Sub + +Sub LyricsToInstrumental + ' Define variables + Dim list + Dim itm + Dim i + + ' Get list of selected tracks from MediaMonkey + Set list = SDB.SelectedSongList + If list.count>0 Then + ' Process all selected tracks + For i=0 To list.count-1 + Set itm = list.Item(i) + itm.Lyrics = "Instrumental" + ' Update the changes in DB + itm.UpdateDB + Next + End If +End Sub diff --git a/source/Uninstall.ini b/source/Uninstall.ini new file mode 100644 index 0000000..2d3c118 --- /dev/null +++ b/source/Uninstall.ini @@ -0,0 +1,6 @@ +[Delete] +File={app}\Scripts\Auto\LyricsToInstrumental.vbs + +[Execute] +File=Uninstall.vbs + diff --git a/source/Uninstall.vbs b/source/Uninstall.vbs new file mode 100644 index 0000000..6e24a11 --- /dev/null +++ b/source/Uninstall.vbs @@ -0,0 +1,5 @@ +Dim but : Set but = SDB.Objects("LyricsInsrumentalButton") +If Not (but Is Nothing) Then + but.Visible = False + Set SDB.Objects("LyricsInsrumentalButton") = Nothing +End If