Skip to content

Instantly share code, notes, and snippets.

@Benzi
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save Benzi/51debde7b996935477fa to your computer and use it in GitHub Desktop.

Select an option

Save Benzi/51debde7b996935477fa to your computer and use it in GitHub Desktop.
Automatically skip songs that are not available.
/*
Copyright (c) 2015 by Benzi (Benzi Mooneegan)
Please do not copy or modify without permission from the owner.
Description: This script is used to automatically skip songs that are not available.
*/
function naSkip() {
var format = API.getMedia().format;
var cid = API.getMedia().cid;
var apikey = 'AIzaSyDcfWu9cGaDnTjPKhg_dy9mUh6H7i4ePZ0';
if (format == 1){
$.getJSON('https://www.googleapis.com/youtube/v3/videos?id=' + cid + '&key=' + apikey + '&part=snippet&callback=?', function (track){
if (typeof(track.items[0]) === 'undefined'){
API.moderateForceSkip();
}
});
} else {
var checkSong = SC.get('/tracks/' + cid, function (track){
if (typeof track.title === 'undefined'){
API.moderateForceSkip();
}
});
}
};
API.on(API.ADVANCE, naSkip);
API.chatLog('Automatically skipping songs that are not available ..');
naSkip();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment