Last active
August 29, 2015 14:23
-
-
Save Benzi/51debde7b996935477fa to your computer and use it in GitHub Desktop.
Automatically skip songs that are not available.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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