-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.py
39 lines (33 loc) · 1.61 KB
/
service.py
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
37
38
39
import xbmc
class XBMCPlayer( xbmc.Player ):
def __init__( self, *args ):
pass
def onPlayBackStarted( self ):
# Will be called when xbmc starts playing a file
# Define services and app names, add the _S just in case you have a show/movie called 'Amazon' or something
services = {
'Amazon_S':'com.amazon.amazonvideo.livingroom',
'Netflix_S':'com.netflix.ninja',
'HBO_S':'com.hbo.hbonow',
'Discovery_S':'com.discovery.discoveryplus.androidtv'
}
xbmc.log( "Testing name for Netflix/Amazon/HBOMax dummy match: " + str(self.getPlayingFile(self)) )
# Go through our list of streaming services
for service in services:
# Check if the playing file matches a streaming service
if service in str(self.getPlayingFile(self)):
# This bit below is to ensure the show gets marked watched
xbmc.sleep(400)
while(self.isPlaying() == True):
self.seekTime(10)
xbmc.sleep(200)
# This command's argument are app, intent, dataType and dataURI, but currently
# no way to make use of the intent etc to go to a particular show. (please let me know!)
cmd = 'StartAndroidActivity("%s", "%s", "%s", "%s")' % (services[service], '', '', '')
# Run the command
xbmc.executebuiltin(cmd)
player = XBMCPlayer()
monitor = xbmc.Monitor()
# wait for 10 seconds for the Kodi splash screen to close
while not monitor.abortRequested():
xbmc.sleep(100)