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

cody-music

Package Overview
Dependencies
Maintainers
1
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.2.5 to 2.2.6

6

dist/lib/apis.d.ts

@@ -52,7 +52,7 @@ import { PlayerName, Track, PlayerDevice, SpotifyAudioFeature, PlaylistItem, CodyResponse } from "./models";

/**
* Returns the tracks that are found by the given playlist name
* @param player {spotify|spotify-web|itunes}
* Returns the tracks that are found for itunes
* @param player {itunes}
* @param playListName
*/
export declare function getTracksByPlaylistName(player: PlayerName, playListName: string): Promise<PlaylistItem[]>;
export declare function getTracksByPlaylistName(player: PlayerName, playListName: string): Promise<Track[]>;
/**

@@ -59,0 +59,0 @@ * Returns the tracks that are found by the given playlist name

@@ -154,4 +154,4 @@ "use strict";

/**
* Returns the tracks that are found by the given playlist name
* @param player {spotify|spotify-web|itunes}
* Returns the tracks that are found for itunes
* @param player {itunes}
* @param playListName

@@ -166,16 +166,22 @@ */

if (result) {
let jsonList = result.split("[TRACK_END],");
if (jsonList && jsonList.length > 0) {
for (let i = 0; i < jsonList.length; i++) {
let jsonStr = jsonList[i].trim();
if (jsonStr.toLowerCase() !== "ok") {
try {
jsonResult[i] = JSON.parse(jsonStr);
try {
let jsonList = result.split("[TRACK_END]");
// console.log("tracks by playlist json list: ", jsonList);
if (jsonList && jsonList.length > 0) {
for (let i = 0; i < jsonList.length; i++) {
let jsonStr = jsonList[i].trim();
if (jsonStr.toLowerCase() !== "ok") {
try {
jsonResult[i] = JSON.parse(jsonStr);
}
catch (err) {
// it might be the success response "ok"
}
}
catch (err) {
// it might be the success response "ok"
}
}
}
}
catch (err) {
//
}
}

@@ -187,9 +193,12 @@ if (jsonResult) {

let trackItem = jsonResult[key];
let playlistItem = new models_1.PlaylistItem();
playlistItem.name = trackItem.name;
playlistItem.type = "track";
playlistItem.public = true;
playlistItem.collaborative = false;
playlistItem.id = trackItem.id;
return playlistItem;
let track = new models_1.Track();
track.name = trackItem.name;
track.type = "track";
track.id = trackItem.id;
track.artist = trackItem.artist;
track.album = trackItem.album;
track.played_count = trackItem.played_count;
track.duration = trackItem.duration;
track.playerType = models_1.PlayerType.MacItunesDesktop;
return track;
});

@@ -212,5 +221,12 @@ }

// itunes or spotify desktop
const playlistItems = await getTracksByPlaylistName(player, playlist_id);
const tracks = await getTracksByPlaylistName(player, playlist_id);
let codyResp = new models_1.CodyResponse();
codyResp.data = playlistItems;
let pageItem = new models_1.PaginationItem();
pageItem.offset = 0;
pageItem.next = "";
pageItem.previous = "";
pageItem.limit = -1;
pageItem.total = tracks.length;
pageItem.items = tracks;
codyResp.data = pageItem;
return codyResp;

@@ -417,23 +433,29 @@ }

if (result) {
result = result.split("[TRACK_END]");
if (result && result.length > 0) {
playlists = result.map((resultItem) => {
// if (!resultItem.includes("}")) {
// resultItem = `${resultItem}}`;
// }
try {
// {name, count}
let item = JSON.parse(resultItem);
let playlistItem = new models_1.PlaylistItem();
playlistItem.public = true;
playlistItem.name = item.name;
playlistItem.id = item.name;
playlistItem.tracks.total = item.count;
return playlistItem;
}
catch (err) {
//
}
});
try {
result = result.split("[TRACK_END]");
// console.log("playlists json list: ", result);
if (result && result.length > 0) {
playlists = result.map((resultItem) => {
// if (!resultItem.includes("}")) {
// resultItem = `${resultItem}}`;
// }
try {
// {name, count}
let item = JSON.parse(resultItem);
let playlistItem = new models_1.PlaylistItem();
playlistItem.public = true;
playlistItem.name = item.name;
playlistItem.id = item.name;
playlistItem.tracks.total = item.count;
return playlistItem;
}
catch (err) {
//
}
});
}
}
catch (err) {
//
}
}

@@ -440,0 +462,0 @@ }

@@ -75,6 +75,9 @@ "use strict";

CodyMusic.getPlaylists(models_1.PlayerName.ItunesDesktop).then((result) => {
console.log("playlist 0: ", result[0]);
expect(result.length).to.not.equal(0);
const playlistItem = result[0];
CodyMusic.getPlaylistTracks(models_1.PlayerName.ItunesDesktop, playlistItem.id).then((result) => {
expect(result.data.length).to.not.equal(0);
let pageItem = result.data;
console.log("pageItem.items[0]: ", pageItem.items[0]);
expect(pageItem.items.length).to.not.equal(0);
done();

@@ -81,0 +84,0 @@ });

@@ -12,3 +12,4 @@ "use strict";

CodyResponse,
PlaylistTrackInfo
PlaylistTrackInfo,
PaginationItem
} from "./models";

@@ -170,4 +171,4 @@ import { MusicPlayerState } from "./playerstate";

/**
* Returns the tracks that are found by the given playlist name
* @param player {spotify|spotify-web|itunes}
* Returns the tracks that are found for itunes
* @param player {itunes}
* @param playListName

@@ -178,4 +179,4 @@ */

playListName: string
): Promise<PlaylistItem[]> {
let playlistItems: PlaylistItem[] = [];
): Promise<Track[]> {
let playlistItems: Track[] = [];
const params = null;

@@ -192,14 +193,18 @@ const argv = [playListName];

if (result) {
let jsonList = result.split("[TRACK_END],");
if (jsonList && jsonList.length > 0) {
for (let i = 0; i < jsonList.length; i++) {
let jsonStr = jsonList[i].trim();
if (jsonStr.toLowerCase() !== "ok") {
try {
jsonResult[i] = JSON.parse(jsonStr);
} catch (err) {
// it might be the success response "ok"
try {
let jsonList = result.split("[TRACK_END]");
if (jsonList && jsonList.length > 0) {
for (let i = 0; i < jsonList.length; i++) {
let jsonStr = jsonList[i].trim();
if (jsonStr.toLowerCase() !== "ok") {
try {
jsonResult[i] = JSON.parse(jsonStr);
} catch (err) {
// it might be the success response "ok"
}
}
}
}
} catch (err) {
//
}

@@ -212,9 +217,12 @@ }

let trackItem = jsonResult[key];
let playlistItem: PlaylistItem = new PlaylistItem();
playlistItem.name = trackItem.name;
playlistItem.type = "track";
playlistItem.public = true;
playlistItem.collaborative = false;
playlistItem.id = trackItem.id;
return playlistItem;
let track: Track = new Track();
track.name = trackItem.name;
track.type = "track";
track.id = trackItem.id;
track.artist = trackItem.artist;
track.album = trackItem.album;
track.played_count = trackItem.played_count;
track.duration = trackItem.duration;
track.playerType = PlayerType.MacItunesDesktop;
return track;
});

@@ -242,8 +250,12 @@ }

// itunes or spotify desktop
const playlistItems: PlaylistItem[] = await getTracksByPlaylistName(
player,
playlist_id
);
const tracks: Track[] = await getTracksByPlaylistName(player, playlist_id);
let codyResp: CodyResponse = new CodyResponse();
codyResp.data = playlistItems;
let pageItem: PaginationItem = new PaginationItem();
pageItem.offset = 0;
pageItem.next = "";
pageItem.previous = "";
pageItem.limit = -1;
pageItem.total = tracks.length;
pageItem.items = tracks;
codyResp.data = pageItem;
return codyResp;

@@ -447,21 +459,22 @@ }

if (result) {
result = result.split("[TRACK_END]");
if (result && result.length > 0) {
playlists = result.map((resultItem: string) => {
// if (!resultItem.includes("}")) {
// resultItem = `${resultItem}}`;
// }
try {
// {name, count}
let item = JSON.parse(resultItem);
let playlistItem: PlaylistItem = new PlaylistItem();
playlistItem.public = true;
playlistItem.name = item.name;
playlistItem.id = item.name;
playlistItem.tracks.total = item.count;
return playlistItem;
} catch (err) {
//
}
});
try {
result = result.split("[TRACK_END]");
if (result && result.length > 0) {
playlists = result.map((resultItem: string) => {
try {
// {name, count}
let item = JSON.parse(resultItem);
let playlistItem: PlaylistItem = new PlaylistItem();
playlistItem.public = true;
playlistItem.name = item.name;
playlistItem.id = item.name;
playlistItem.tracks.total = item.count;
return playlistItem;
} catch (err) {
//
}
});
}
} catch (err) {
//
}

@@ -468,0 +481,0 @@ }

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

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

@@ -8,3 +8,4 @@ import { MusicUtil } from "../../lib/util";

PlaylistItem,
CodyResponse
CodyResponse,
PaginationItem
} from "../../lib/models";

@@ -90,3 +91,4 @@ import { MusicController } from "../../lib/controller";

).then((result: CodyResponse) => {
expect(result.data.length).to.not.equal(0);
let pageItem: PaginationItem = result.data;
expect(pageItem.items.length).to.not.equal(0);
done();

@@ -93,0 +95,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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