def get_session(self, session_key, state, view_offset):
        session = WatchSession.load(session_key)

        if session:
            if session.last_view_offset and session.last_view_offset > view_offset:
                Log.Debug(
                    "View offset has gone backwards (last: %s, cur: %s)" % (session.last_view_offset, view_offset)
                )

                # First try update the session if the media hasn't changed
                # otherwise delete the session
                if not self.update_session(session, view_offset):
                    Log.Debug("Media changed, deleting the session")
                    session.delete()
                    return None

            if session.skip:
                return None

            if state == "playing" and session.update_required:
                Log.Debug("Session update required, updating the session...")

                if not self.update_session(session, view_offset):
                    Log.Debug("Media changed, deleting the session")
                    session.delete()
                    return None
        else:
            session = self.create_session(session_key, state)

        return session
    def get_session(self, session_key, state, view_offset):
        session = WatchSession.load(session_key)

        if session:
            if session.last_view_offset and session.last_view_offset > view_offset:
                Log.Debug('View offset has gone backwards (last: %s, cur: %s)' % (
                    session.last_view_offset, view_offset
                ))

                # First try update the session if the media hasn't changed
                # otherwise delete the session
                if self.update_session(session, view_offset):
                    Log.Debug('Updated the current session')
                else:
                    Log.Debug('Deleted the current session')
                    session.delete()
                    session = None

            if not session or session.skip:
                return None

            if state == 'playing' and session.update_required:
                self.update_session(session, view_offset)
        else:
            session = self.create_session(session_key, state)

        return session
    def get_session(self, session_key, state, view_offset):
        session = WatchSession.load(session_key)

        if session:
            if session.last_view_offset and session.last_view_offset > view_offset:
                Log.Debug(
                    'View offset has gone backwards (last: %s, cur: %s)' %
                    (session.last_view_offset, view_offset))

                # First try update the session if the media hasn't changed
                # otherwise delete the session
                if self.update_session(session, view_offset):
                    Log.Debug('Updated the current session')
                else:
                    Log.Debug('Deleted the current session')
                    session.delete()
                    session = None

            if not session or session.skip:
                return None

            if state == 'playing' and session.update_required:
                self.update_session(session, view_offset)
        else:
            session = self.create_session(session_key, state)

        return session
    def get_session(self, info):
        session = WatchSession.load('logging-%s' % info.get('client_id'))

        if session:
            if not self.session_valid(session, info):
                session.delete()
                session = None
                Log.Info('Session deleted')

            if not session or session.skip:
                return None

        else:
            session = self.create_session(info)

        return session
Example #5
0
    def get_session(self, info):
        session = WatchSession.load('logging-%s' % info.get('client_id'))

        if session:
            if not self.session_valid(session, info):
                session.delete()
                session = None
                Log.Info('Session deleted')

            if not session or session.skip:
                return None

        else:
            session = self.create_session(info)

        return session
    def get_session(self, session_key, state, view_offset):
        session = WatchSession.load(session_key)

        if not session:
            session = self.create_session(session_key, state)

            if not session:
                return None

        update_session = False

        # Update session when view offset goes backwards
        if session.last_view_offset and session.last_view_offset > view_offset:
            log.debug('View offset has gone backwards (last: %s, cur: %s)' % (
                session.last_view_offset, view_offset
            ))

            update_session = True

        # Update session on missing metadata + session skip
        if not session.metadata and session.skip:
            update_session = True

        # First try update the session if the media hasn't changed
        # otherwise delete the session
        if update_session and not self.update_session(session, view_offset):
            log.debug('Media changed, deleting the session')
            session.delete_instance()
            return None

        # Delete session if invalid
        if not self.session_valid(session):
            session.delete_instance()
            return None

        if session.skip:
            return None

        if state == 'playing' and session.update_required:
            log.debug('Session update required, updating the session...')

            if not self.update_session(session, view_offset):
                log.debug('Media changed, deleting the session')
                session.delete_instance()
                return None

        return session
Example #7
0
    def get_session(self, session_key, state, view_offset):
        session = WatchSession.load(session_key)

        if not session:
            session = self.create_session(session_key, state)

            if not session:
                return None

        update_session = False

        # Update session when view offset goes backwards
        if session.last_view_offset and session.last_view_offset > view_offset:
            log.debug('View offset has gone backwards (last: %s, cur: %s)' %
                      (session.last_view_offset, view_offset))

            update_session = True

        # Update session on missing metadata + session skip
        if not session.metadata and session.skip:
            update_session = True

        # First try update the session if the media hasn't changed
        # otherwise delete the session
        if update_session and not self.update_session(session, view_offset):
            log.debug('Media changed, deleting the session')
            session.delete()
            return None

        # Delete session if invalid
        if not self.session_valid(session):
            session.delete()
            return None

        if session.skip:
            return None

        if state == 'playing' and session.update_required:
            log.debug('Session update required, updating the session...')

            if not self.update_session(session, view_offset):
                log.debug('Media changed, deleting the session')
                session.delete()
                return None

        return session
    def get_session(self, info):
        session = WatchSession.load('logging-%s' % info.get('machineIdentifier'))

        if session and not self.session_valid(session, info):
            session.delete_instance()
            session = None
            log.debug('Session deleted')

        if not session:
            session = self.create_session(info)

            if not session:
                return None

        if not session or session.skip:
            return None

        return session
    def get_session(self, info):
        session = WatchSession.load('logging-%s' %
                                    info.get('machineIdentifier'))

        if not session:
            session = self.create_session(info)

            if not session:
                return None

        if not self.session_valid(session, info):
            session.delete()
            session = None
            log.debug('Session deleted')

        if not session or session.skip:
            return None

        return session