Created
October 18, 2018 12:13
-
-
Save mauscoelho/f87430c9fd3dd7c7d8436b7211de16d3 to your computer and use it in GitHub Desktop.
Listen Notes integration for BeardedSpice
This file contains 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
// | |
// ListenNotes.plist | |
// BeardedSpice | |
// | |
// Created by Mauricio Coelho on 10/18/18 | |
// Copyright (c) 2013 Tyler Rhodes / Jose Falcon. All rights reserved. | |
// | |
BSStrategy = { | |
version: 1, | |
displayName: "Listen Notes", | |
accepts: { | |
method: "predicateOnTab", | |
format: "%K LIKE[c] '*listennotes.com/*'", | |
args: ["URL"], | |
}, | |
isPlaying: function() { return !document.querySelector('.media-player audio').paused; }, | |
toggle: function() { document.querySelector('.ln-audioplayer-controls-container a:nth-child(2)').click(); }, | |
previous: function() { document.querySelector('.ln-audioplayer-controls-container a:nth-child(1)').click(); }, | |
next: function() { document.querySelector('.ln-audioplayer-controls-container a:nth-child(3)').click(); }, | |
pause: function() { | |
if(!document.querySelector('.media-player audio').paused) { | |
document.querySelector('.ln-audioplayer-controls-container a:nth-child(2)').click() | |
} | |
}, | |
trackInfo: function() { | |
timeInfo = document.querySelector('.ln-audioplayer-time-text-left').innerText; | |
thumb = document.querySelector('.ln-audioplayer-desktop-image'); | |
title = document.querySelector('.ln-audioplayer-desktop-left-episode-title').innerText; | |
artist = document.querySelector('.ln-audioplayer-desktop-left-channel-title').innerText; | |
return { | |
'image': thumb.src, | |
'track': title, | |
'artist': artist, | |
'progress': `${timeInfo}`, | |
}; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment