Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

itunes-bridge

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itunes-bridge - npm Package Compare versions

Comparing version 0.1.0 to 0.1.5

.idea/iTunes-bridge.iml

24

itunes-bridge.js

@@ -11,13 +11,29 @@ // iTunes Bridge 0.1-alpha by AngryKiller.

exports.getCurrentTrackName = function() {
return applescript.sync('tell application "iTunes" to set track_name to the name of the current track');
return applescript.sync('tell application "iTunes" to get the name of the current track');
};
exports.getCurrentTrackArtist = function() {
return applescript.sync('tell application "iTunes" to set track_artist to the artist of the current track');
return applescript.sync('tell application "iTunes" to get the artist of the current track');
}
exports.getCurrentTrackAlbum = function() {
return applescript.sync('tell application "iTunes" to set track_album to the album of the current track');
return applescript.sync('tell application "iTunes" to get the album of the current track');
}
exports.getCurrentTrackDuration = function() {
var durationInSeconds = applescript.sync('tell application "iTunes" to set track_album to the duration of the current track');
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
return secToMin(durationInSeconds);
}
exports.getCurrentTrackReleaseYear = function() {
return applescript.sync('tell application "iTunes" to get the year of the current track');
}
exports.getCurrentTrackGenre = function() {
return applescript.sync('tell application "iTunes" to get the genre of the current track');
}
exports.getPlayerState = function() {
// TODO: Check if iTunes is launched as another check before the AppleScript one
return applescript.sync('tell application "iTunes" to get the player state');
}
exports.getPlaylistCount = function() {
return applescript.sync('tell application "iTunes" to get the count of playlists');
}
exports.getTrackCount = function() {
return applescript.sync('tell application "iTunes" to get the count of tracks');
}

2

package.json
{
"name": "itunes-bridge",
"version": "0.1.0",
"version": "0.1.5",
"description": "A NodeJS package to control and get informations from iTunes through AppleScript",

@@ -5,0 +5,0 @@ "main": "itunes-bridge.js",

# iTunes-bridge
A NodeJS package to control and get informations from iTunes through AppleScript
A macOS only NodeJS package to control and get informations from iTunes through AppleScript
### This package is a WIP, a lot of functions will be added in the future and some that are already existing could change
#Documentation
No documentation yet, but you can look at the code of [iTunes-Discord integration](https://github.com/AngryKiller/iTunes-Discord-integration/tree/dev) that is a great example of the usages possible with iTunes-bridge.
# Documentation
No documentation yet, but you can look at the code of [iTunes-Discord integration](https://github.com/AngryKiller/iTunes-Discord-integration/tree/dev) that is a great example of the usages possible with iTunes-bridge.
There is also an example.js that you can run.
const iTunes = require('./itunes-bridge');
var currentPlayerState = iTunes.getPlayerState();
if(currentPlayerState == 'playing') {
var exampleMsg = "iTunes is currently playing " + iTunes.getCurrentTrackName() + " by " + iTunes.getCurrentTrackArtist() + ' from the album "' + iTunes.getCurrentTrackAlbum() + '". This song is ' + iTunes.getCurrentTrackDuration() + ' long';
var exampleMsg2 = "You have " + iTunes.getPlaylistCount() + " playlists in your library and " + iTunes.getTrackCount() + " tracks!";
console.log(exampleMsg);
console.log(exampleMsg2);
}else if(currentPlayerState == 'paused'){
var exampleMsg = 'iTunes is currently paused';
console.log(exampleMsg)
}else{ // If iTunes is not playing or paused, we assume that he is stopped
var exampleMsg = "iTunes is not playing at the moment.";
console.log(exampleMsg);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc