Exemple #1
0
def playCount():
    title = sys.argv[2]  # Extract passed variables
    vurl = sys.argv[3]
    vseason = sys.argv[4]
    vepisode = sys.argv[5]
    mplaycount = sys.argv[6]
    series = sys.argv[7]
    dbfile = sys.argv[8]
    contenturl = sys.argv[9]

    title = title.decode('utf-8', 'ignore')  #  Handle commas
    series = series.decode('utf-8', 'ignore')  #  Handle commas

    if dbfile != 'audiom':  #  Don't update Kodi for music
        playcount.updateKodiPlaycount(int(mplaycount), title, vurl, int(vseason),     \
        int(vepisode), series, dbfile)                            #  Update Kodi DB playcount

    rtrimpos = vurl.rfind('/')
    mobjectID = vurl[rtrimpos + 1:]  #  Get Mezzmo objectID

    if int(mplaycount) == 0:  #  Calcule new play count
        newcount = '1'
    elif int(mplaycount) > 0:
        newcount = '0'

    if mobjectID != None:  #  Update Mezzmo playcount if objectID exists
        playcount.setPlaycount(contenturl, mobjectID, newcount, title)
        bookmark.SetBookmark(contenturl, mobjectID, '0')  #  Clear bookmark
        xbmc.executebuiltin('Container.Refresh()')
Exemple #2
0
 def onPlayBackStopped(self):
     contenturl = settings('contenturl')
     xbmc.log("contenturl " + contenturl)
     end = file.rfind('/') + 1
     objectID = file[end:]
     xbmc.log("Playback stopped at " + str(pos) + " in " + objectID)
     bookmark.SetBookmark(contenturl, objectID, str(pos))
 def onPlayBackEnded(self):
     xbmc.log("Mezzmo Playback ended - LED OFF", xbmc.LOGDEBUG)
     contenturl = media.settings('contenturl')
     manufacturer = getContentURL(contenturl)
     objectID = getObjectID(file)
     pos = 0
     self.paflag = 0
     if len(
             contenturl
     ) > 5 and 'Conceiva' in manufacturer:  # Ensure Mezzmo server has been selected
         bookmark.SetBookmark(contenturl, objectID, str(pos))
 def onPlayBackStopped(self):
     contenturl = media.settings('contenturl')
     manufacturer = getContentURL(contenturl)
     objectID = getObjectID(file)
     bmdelay = 15 - int(media.settings('bmdelay'))
     xbmc.log(
         "Mezzmo Playback stopped at " + str(pos + bmdelay) + " in " +
         objectID, xbmc.LOGDEBUG)
     self.paflag = 0
     if len(
             contenturl
     ) > 5 and 'Conceiva' in manufacturer:  # Ensure Mezzmo server has been selected
         bookmark.SetBookmark(contenturl, objectID, str(pos + bmdelay))
 def onPlayBackPaused(self):
     xbmc.log("Playback paused - LED OFF")
     contenturl = media.settings('contenturl')
     manufacturer = getContentURL(contenturl)
     objectID = getObjectID(file)
     bmdelay = 15 - int(media.settings('bmdelay'))
     if len(
             contenturl
     ) > 5 and 'Conceiva' in manufacturer:  # Ensure Mezzmo server has been selected
         bookmark.SetBookmark(contenturl, objectID, str(pos + bmdelay))
         if media.getMServer(
                 contenturl) in file:  #  Check for paused Mezzmo files
             self.paflag = 1
Exemple #6
0
title = sys.argv[1]                                               # Extract passed variables
vurl = sys.argv[2]
vseason = sys.argv[3]
vepisode = sys.argv[4]
playcount = sys.argv[5]
series = sys.argv[6]
dbfile = sys.argv[7]
contenturl = sys.argv[8]

title = title.decode('utf-8', 'ignore')   			  #  Handle commas
series = series.decode('utf-8', 'ignore')    			  #  Handle commas

updateKodiPlaycount(int(playcount), title, vurl,     \
int(vseason), int(vepisode), series, dbfile)                      #  Update Kodi DB playcount

rtrimpos = vurl.rfind('/')
mobjectID = vurl[rtrimpos+1:]                                     #  Get Mezzmo objectID

if int(playcount) == 0:                                           #  Calcule new play count
    newcount = '1'
elif int(playcount) > 0:
    newcount = '0'

if mobjectID != None:                                             #  Update Mezzmo playcount if objectID exists
    SetPlaycount(contenturl, mobjectID, newcount, title)
    bookmark.SetBookmark(contenturl, mobjectID, '0')              #  Clear bookmark
    xbmc.executebuiltin('Container.Refresh()')


monitor = xbmc.Monitor()

media.checkNosyncDB()  # Check nosync database

while True:
    if xbmc.Player().isPlaying():
        file = xbmc.Player().getPlayingFile()
        pos = long(xbmc.Player().getTime())
        if count % 30 == 0:  # Update bookmark once every 30 seconds during playback
            contenturl = media.settings('contenturl')
            manufacturer = getContentURL(contenturl)
            objectID = getObjectID(file)
            bmdelay = 15 - int(media.settings('bmdelay'))
            if contenturl != 'none' and 'Conceiva' in manufacturer:  # Ensure Mezzmo server has been selected
                bookmark.SetBookmark(contenturl, objectID, str(pos + bmdelay))

    count += 1
    if count == 2:  # Check for autostarting the Mezzmo GUI
        media.autostart()

    pacount += 1
    if pacount % 30 == 0:  # Check for paused video every 30 seconds
        pastoptime = int(media.settings('pastop'))
        xbmc.log('Mezzmo count and stop time ' + str(pacount) + ' ' + str(pastoptime) +        \
        ' ' + str(player.paflag), xbmc.LOGDEBUG)
        try:
            if pastoptime > 0 and pacount >= pastoptime * 60 and player.paflag == 1:
                ptag = xbmc.Player().getVideoInfoTag()
                ptitle = media.displayTitles(ptag.getTitle().decode(
                    'utf-8', 'ignore'))