forked from beardedspice/BS-Strategies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TuneIn.bsstrategy
36 lines (36 loc) · 1.06 KB
/
TuneIn.bsstrategy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// TuneIn.plist
// BeardedSpice
//
// Created by Michael Alden on 6/16/15.
// Copyright (c) 2015 Tyler Rhodes / Jose Falcon. All rights reserved.
//
BSStrategy = {
version:1,
displayName:"TuneIn",
accepts: {
method: "predicateOnTab",
format:"%K LIKE[c] '*tunein.com*'",
args: ["URL"]
},
isPlaying: function () { return $('#tuner').attr('class') === 'playing' },
toggle: function() { document.querySelector('.playbutton-cont').click(); },
next: function () {},
favorite: function () { $('.icon.follow').click() },
previous: function () {},
pause: function () {
if($('#tuner').attr('class') == 'playing'){
document.querySelector('.playbutton-cont').click();
}
},
trackInfo: function () {
var ret = TuneIn.app.nowPlaying.broadcast;
return {
'track': ret.DisplaySubtitle,
'album': ret.EchoData.title,
'artist': ret.Location,
'favorited': $('#tuner div.icon.follow').hasClass('in'),
'image': $('.artwork.col._navigateNowPlaying').children('.image').children('.logo.loaded').attr('src'),
}
}
}