Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
cody-music
Advanced tools
Control Spotify and iTunes, currently only on Mac OSX with NodeJS.
$ npm install cody-music
$ npm test
Load the module
import * as music from 'cody-music';
OR
const music = require('cody-music');
Play a track with Music URI uri
.
Specify either "Spotify" or "iTunes" (case-insensitive).
// get the track info using get state
await music.getState('iTunes').then(state => {
// - "genre" will be empty from Spotify
// - duration is in milliseconds
// {artist, album, genre, disc_number, duration, played_count, track_number, id, name, state}
console.log(state);
});
// play a specific spotify track
await music
.playTrack('Spotify', 'spotify:track:2YarjDYjBJuH63dUIh9OWv')
.then(result => {
// track is playing
});
// play an iTunes track number
await music.playTrack('iTunes', 1).then(result => {
// track is playing
});
// handling errors
await music.playTrack('iTunes', 1000000000).then(result => {
// result will contain the "error" attribute with the error message
if (result.error) {
console.log(`Unable to play track, error: ${result.error}`);
}
});
Resume playing current track.
Pause playing track.
Toggle play.
Play next track.
Play previous track.
Turn volume up.
Turn volume down.
Sets the volume.
music.setVolume('Spotify', 42).then(() => {
music.getState(state => {
console.log(state.volume);
});
});
Reduces audio to 0, saving the previous volume.
Returns audio to original volume.
Check if the music player is running.
music.isRunning('Spotify').then(isRunning => {
console.log(isRunning); // true || false
});
Is repeating on or off?
music.isRepeating('Spotify').then(isRepeating => {
console.log(isRepeating); // true || false
});
Is shuffling on or off?
music.isShuffling('Spotify').then(isShuffling => {
console.log(isShuffling); // true || false
});
FAQs
mac osx spotify and itunes music player controller, spotify audio features, itunes and spotify genre, and playlist control
The npm package cody-music receives a total of 36 weekly downloads. As such, cody-music popularity was classified as not popular.
We found that cody-music demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.