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.7 to 0.1.8

96

itunes-bridge.js

@@ -1,2 +0,2 @@

// iTunes Bridge 0.1-alpha by AngryKiller.
// iTunes Bridge 0.1.8-alpha by AngryKiller.
// GPL-3.0

@@ -11,49 +11,101 @@

exports.getCurrentTrackName = function() {
return applescript.sync('tell application "iTunes" to get the name of the current track');
try {
return applescript.sync('tell application "iTunes" to get the name of the current track');
}catch(err){
return null;
}
};
exports.getCurrentTrackArtist = function() {
return applescript.sync('tell application "iTunes" to get the artist of the current track');
try {
return applescript.sync('tell application "iTunes" to get the artist of the current track');
}catch(err){
return null;
}
};
exports.getCurrentTrackAlbum = function() {
return applescript.sync('tell application "iTunes" to get the album of the current track');
try {
return applescript.sync('tell application "iTunes" to get the album of the current track');
}catch(err){
return null;
}
};
exports.getCurrentTrackDuration = function() {
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
return secToMin(durationInSeconds);
try {
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
return secToMin(durationInSeconds);
}catch(err){
return null;
}
};
exports.getCurrentTrackElapsedTime = function() {
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
return secToMin(elapsedTimeInSeconds);
try {
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
return secToMin(elapsedTimeInSeconds);
}catch(err){
return null;
}
};
exports.getCurrentTrackRemainingTime = function() {
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
var remainingTime = durationInSeconds - elapsedTimeInSeconds;
return secToMin(remainingTime);
try {
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
var remainingTime = durationInSeconds - elapsedTimeInSeconds;
return secToMin(remainingTime);
}catch(err){
return null;
}
};
exports.getCurrentTrackElapsedSeconds = function() {
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
return elapsedTimeInSeconds;
try {
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
return elapsedTimeInSeconds;
}catch(err){
return null;
}
};
exports.getCurrentTrackRemainingSeconds = function() {
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
return durationInSeconds - elapsedTimeInSeconds;
try {
var durationInSeconds = applescript.sync('tell application "iTunes" to get the duration of the current track');
var elapsedTimeInSeconds = applescript.sync('tell application "iTunes" to get the player position');
return durationInSeconds - elapsedTimeInSeconds;
}catch(err){
return null;
}
};
exports.getCurrentTrackReleaseYear = function() {
return applescript.sync('tell application "iTunes" to get the year of the current track');
try {
return applescript.sync('tell application "iTunes" to get the year of the current track');
}catch(err){
return null;
}
};
exports.getCurrentTrackGenre = function() {
return applescript.sync('tell application "iTunes" to get the genre of the current track');
try {
return applescript.sync('tell application "iTunes" to get the genre of the current track');
}catch(err){
return null;
}
};
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');
try {
return applescript.sync('tell application "iTunes" to get the player state');
}catch(err){
return null;
}
};
exports.getPlaylistCount = function() {
return applescript.sync('tell application "iTunes" to get the count of playlists');
try {
return applescript.sync('tell application "iTunes" to get the count of playlists');
}catch(err){
return null;
}
};
// TODO: Supports for arguments in the track count (album, artist, playlist...)
exports.getTrackCount = function() {
return applescript.sync('tell application "iTunes" to get the count of tracks');
try {
return applescript.sync('tell application "iTunes" to get the count of tracks');
}catch(err){
return null;
}
};
{
"name": "itunes-bridge",
"version": "0.1.7",
"version": "0.1.8",
"description": "A NodeJS package to control and get informations from iTunes through AppleScript",

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

Sorry, the diff of this file is not supported yet

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