New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cody-music

Package Overview
Dependencies
Maintainers
5
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cody-music - npm Package Compare versions

Comparing version 2.10.2 to 2.10.3

4

dist/lib/apis.js

@@ -300,3 +300,3 @@ "use strict";

async function getSpotifyPlayerContext() {
return musicPlayerCtr.getSpotifyPlayerContext(true);
return musicPlayerCtr.getSpotifyPlayerContext();
}

@@ -975,3 +975,3 @@ exports.getSpotifyPlayerContext = getSpotifyPlayerContext;

function getSpotifyDevices() {
return musicPlayerCtr.getSpotifyDevices(true);
return musicPlayerCtr.getSpotifyDevices();
}

@@ -978,0 +978,0 @@ exports.getSpotifyDevices = getSpotifyDevices;

@@ -23,3 +23,3 @@ import { PlayerDevice, Track, PlayerContext, Artist, PlayerName, CodyResponse } from "./models";

*/
getSpotifyDevices(clearCache?: boolean): Promise<PlayerDevice[]>;
getSpotifyDevices(): Promise<PlayerDevice[]>;
/**

@@ -67,3 +67,3 @@ * returns i.e.

setRepeat(state: string, device_id?: string): Promise<CodyResponse>;
getSpotifyPlayerContext(clearCache: boolean): Promise<PlayerContext>;
getSpotifyPlayerContext(): Promise<PlayerContext>;
launchAndPlaySpotifyTrack(trackId?: string, playlistId?: string, playerName?: PlayerName): Promise<void>;

@@ -70,0 +70,0 @@ playSpotifyTrackFromPlaylist(trackId: string, spotifyUserId: string, playlistId?: string): Promise<void>;

@@ -9,3 +9,2 @@ "use strict";

const models_1 = require("./models");
const cache_1 = require("./cache");
const audiostat_1 = require("./audiostat");

@@ -18,3 +17,2 @@ const moment = require("moment-timezone");

const musicUtil = new util_1.MusicUtil();
const cacheMgr = cache_1.CacheManager.getInstance();
exports.SPOTIFY_LIKED_SONGS_PLAYLIST_NAME = "Liked Songs";

@@ -74,6 +72,4 @@ class MusicPlayerState {

*/
async getSpotifyDevices(clearCache = false) {
if (clearCache) {
cacheMgr.set("spotify-devices", null);
}
async getSpotifyDevices() {
let devices = [];
const accessToken = musicStore.spotifyAccessToken;

@@ -83,6 +79,2 @@ if (!accessToken) {

}
let devices = cacheMgr.get("spotify-devices");
if (devices && devices.length) {
return devices;
}
const api = "/v1/me/player/devices";

@@ -97,9 +89,5 @@ let response = await musicClient.spotifyApiGet(api);

}
devices = [];
if (response.data && response.data.devices) {
devices = response.data.devices;
}
if (devices && devices.length) {
cacheMgr.set("spotify-devices", devices);
}
return devices || [];

@@ -354,3 +342,2 @@ }

ids = musicUtil.createSpotifyIdsFromUris(ids);
// check the cache first
let api = `/v1/artists`;

@@ -378,3 +365,2 @@ // const qParam = { ids };

id = musicUtil.createSpotifyIdFromUri(id);
// check the cache first
let api = `/v1/artists/${id}`;

@@ -640,3 +626,3 @@ let response = await musicClient.spotifyApiGet(api);

const devices = await this.getSpotifyDevices();
const playerContext = await this.getSpotifyPlayerContext(false);
const playerContext = await this.getSpotifyPlayerContext();
if (playerContext && playerContext.device) {

@@ -715,11 +701,4 @@ musicStore.prevVolumePercent =

}
async getSpotifyPlayerContext(clearCache) {
if (clearCache) {
cacheMgr.set("player-context", null);
}
let playerContext = cacheMgr.get("player-context");
if (playerContext) {
return playerContext;
}
playerContext = new models_1.PlayerContext();
async getSpotifyPlayerContext() {
let playerContext = new models_1.PlayerContext();
let api = "/v1/me/player";

@@ -743,6 +722,2 @@ let response = await musicClient.spotifyApiGet(api);

playerContext = response.data;
if (playerContext && playerContext.device) {
// 15 second cache
cacheMgr.set("player-context", playerContext, 15);
}
}

@@ -749,0 +724,0 @@ return playerContext;

@@ -9,3 +9,2 @@ "use strict";

const util_1 = require("./util");
const cache_1 = require("./cache");
const musicClient = client_1.MusicClient.getInstance();

@@ -15,3 +14,2 @@ const musicStore = store_1.MusicStore.getInstance();

const musicUtil = new util_1.MusicUtil();
const cacheMgr = cache_1.CacheManager.getInstance();
class PlaylistService {

@@ -283,7 +281,3 @@ constructor() {

const spotifyUserId = musicStore.spotifyUserId;
let playlists = cacheMgr.get("playlists");
if (!playlists) {
// fetch the playlists again
playlists = await this.getPlaylists();
}
let playlists = await this.getPlaylists();
// check if it's already in the playlist

@@ -290,0 +284,0 @@ const existingPlaylist = playlists.length

@@ -369,3 +369,3 @@ "use strict";

export async function getSpotifyPlayerContext(): Promise<PlayerContext> {
return musicPlayerCtr.getSpotifyPlayerContext(true);
return musicPlayerCtr.getSpotifyPlayerContext();
}

@@ -1109,3 +1109,3 @@

export function getSpotifyDevices(): Promise<PlayerDevice[]> {
return musicPlayerCtr.getSpotifyDevices(true);
return musicPlayerCtr.getSpotifyDevices();
}

@@ -1112,0 +1112,0 @@

@@ -15,3 +15,2 @@ import { MusicUtil } from "./util";

} from "./models";
import { CacheManager } from "./cache";
import { AudioStat } from "./audiostat";

@@ -25,3 +24,2 @@

const musicUtil = new MusicUtil();
const cacheMgr = CacheManager.getInstance();

@@ -87,8 +85,4 @@ export const SPOTIFY_LIKED_SONGS_PLAYLIST_NAME = "Liked Songs";

*/
async getSpotifyDevices(
clearCache: boolean = false
): Promise<PlayerDevice[]> {
if (clearCache) {
cacheMgr.set("spotify-devices", null);
}
async getSpotifyDevices(): Promise<PlayerDevice[]> {
let devices = [];
const accessToken = musicStore.spotifyAccessToken;

@@ -98,6 +92,3 @@ if (!accessToken) {

}
let devices = cacheMgr.get("spotify-devices");
if (devices && devices.length) {
return devices;
}
const api = "/v1/me/player/devices";

@@ -113,3 +104,3 @@ let response = await musicClient.spotifyApiGet(api);

}
devices = [];
if (response.data && response.data.devices) {

@@ -119,6 +110,2 @@ devices = response.data.devices;

if (devices && devices.length) {
cacheMgr.set("spotify-devices", devices);
}
return devices || [];

@@ -436,4 +423,2 @@ }

// check the cache first
let api = `/v1/artists`;

@@ -468,4 +453,2 @@ // const qParam = { ids };

// check the cache first
let api = `/v1/artists/${id}`;

@@ -806,5 +789,3 @@

const playerContext: PlayerContext = await this.getSpotifyPlayerContext(
false
);
const playerContext: PlayerContext = await this.getSpotifyPlayerContext();

@@ -905,12 +886,5 @@ if (playerContext && playerContext.device) {

async getSpotifyPlayerContext(clearCache: boolean): Promise<PlayerContext> {
if (clearCache) {
cacheMgr.set("player-context", null);
}
let playerContext: PlayerContext = cacheMgr.get("player-context");
if (playerContext) {
return playerContext;
}
async getSpotifyPlayerContext(): Promise<PlayerContext> {
playerContext = new PlayerContext();
let playerContext: PlayerContext = new PlayerContext();
let api = "/v1/me/player";

@@ -938,6 +912,2 @@ let response = await musicClient.spotifyApiGet(api);

playerContext = response.data;
if (playerContext && playerContext.device) {
// 15 second cache
cacheMgr.set("player-context", playerContext, 15);
}
}

@@ -944,0 +914,0 @@ return playerContext;

@@ -13,3 +13,2 @@ import { MusicClient, SPOTIFY_ROOT_API } from "./client";

import { MusicUtil } from "./util";
import { CacheManager } from "./cache";

@@ -21,4 +20,2 @@ const musicClient = MusicClient.getInstance();

const cacheMgr: CacheManager = CacheManager.getInstance();
export class PlaylistService {

@@ -375,7 +372,3 @@ private static instance: PlaylistService;

let playlists: PlaylistItem[] = cacheMgr.get("playlists");
if (!playlists) {
// fetch the playlists again
playlists = await this.getPlaylists();
}
let playlists: PlaylistItem[] = await this.getPlaylists();

@@ -382,0 +375,0 @@ // check if it's already in the playlist

{
"name": "cody-music",
"version": "2.10.2",
"version": "2.10.3",
"description": "mac osx spotify and itunes music player controller, spotify audio features, itunes and spotify genre, and playlist control",

@@ -52,5 +52,4 @@ "main": "dist/index.js",

"moment-timezone": "^0.5.33",
"node-cache": "^5.1.2",
"open": "^8.0.2"
}
}
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