Return if the stream is a recording.
964917
def recorded(self):
        """"""
        if self.tune and self.tune.get('@src'):
            return True if self.tune.get('@src').startswith('mbr') else False
        else:
            raise PyMediaroomError("No information in <node> about @src")
1032588
def emit(self, record):
        """"""
        try:
            msg = self.format(record)
            if isinstance(msg,unicode):
                if hasattr(self.stream, "encoding") and self.stream.encoding:
                    # Stream should take care of encoding, but do it explicitly to
                    # prevent bug in Python 2.6 - see
                    # https://stackoverflow.com/questions/8016236/python-unicode-handling-differences-between-print-and-sys-stdout-write
                    self.stream.write(msg.encode(self.stream.encoding))
                else:
                    self.stream.write(msg.encode(encoding))
            else:
                self.stream.write(msg)
            terminator = getattr(record, 'terminator', '\n')
            if terminator is not None:
                self.stream.write(terminator)
            self.flush()
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)
8391
def _audio_item(self, stream_url=None, offset=0, push_buffer=True, opaque_token=None):
        """"""
        audio_item = {'stream': {}}
        stream = audio_item['stream']

        # existing stream
        if not stream_url:
            # stream.update(current_stream.__dict__)
            stream['url'] = current_stream.url
            stream['token'] = current_stream.token
            stream['offsetInMilliseconds'] = current_stream.offsetInMilliseconds

        # new stream
        else:
            stream['url'] = stream_url
            stream['token'] = opaque_token or str(uuid.uuid4())
            stream['offsetInMilliseconds'] = offset

        if push_buffer:  # prevents enqueued streams from becoming current_stream
            push_stream(stream_cache, context['System']['user']['userId'], stream)
        return audio_item
623044
def has_end(self, stream):
        
        for token in self.end_tokens:
            if not self.has_next(token, stream):
                continue

            offset = len(token)

            if self.has_eof(stream, offset):
                return True

            if self.has_whitespace(stream, offset):
                return True

            if self.has_comment(stream, offset):
                return True

            if self.has_next(self.statement_delimiter, stream, offset):
                return True

        return self.has_eof(stream)
900941
def is_eof(self):
        
        pos = self._stream.tell()
        byte = self._stream.read(1)
        self._stream.seek(pos, 0)

        return utils.binary(byte) == utils.binary("")
1135360
def set_recording(is_recording): #pylint: disable=redefined-outer-name
    
    prev = ctypes.c_int()
    check_call(_LIB.MXAutogradSetIsRecording(
        ctypes.c_int(is_recording), ctypes.byref(prev)))
    return bool(prev.value)
1253148
protected File getRecordFile(IScope scope, String name) {
        return RecordingListener.getRecordFile(scope, name);
    }
656519
def recordings(self):
        
        if self._recordings is None:
            self._recordings = RecordingList(self)
        return self._recordings
1160593
def monitor(self, listener):
        
        for line in self._stream():
            self._record.append(line)
            if self.verbose:
                self.out.blather(line)
            if listener(line) is self.MONITOR_STOP:
                return
670046
def stream_data(self, ostream):
        """"""
        istream = self.repo.odb.stream(self.binsha)
        stream_copy(istream, ostream)
        return self
848603
def _get_recording(self, index):
        """"""
        assert index >= 0
        recs = np.nonzero((index - self.offsets[:-1]) >= 0)[0]
        if len(recs) == 0:  # pragma: no cover
            # If the index is greater than the total size,
            # return the last recording.
            return len(self.arrs) - 1
        # Return the last recording such that the index is greater than
        # its offset.
        return recs[-1]
340976
def _has_streamhandler(logger, level=None, fmt=LOG_FORMAT,
                       stream=DEFAULT_STREAM):
    
    # Ensure we are talking the same type of logging levels
    # if they passed in a string we need to convert it to a number
    if isinstance(level, basestring):
        level = logging.getLevelName(level)

    for handler in logger.handlers:
        if not isinstance(handler, logging.StreamHandler):
            continue
        if handler.stream is not stream:
            continue
        if handler.level != level:
            continue
        if not handler.formatter or handler.formatter._fmt != fmt:
            continue
        return True
    return False
149040
def stillRecording(self, deviceId, dataCount):
        
        status = self.recordingDevices[deviceId]
        if status is not None:
            if status['state'] == MeasurementStatus.RECORDING.name:
                status['last'] = datetime.datetime.utcnow().strftime(DATETIME_FORMAT)
                status['count'] = status['count'] + dataCount
166406
def maybe_start_recording(tokens, index):
        """"""
        if tokens[index].type == TokenType.BeginInlineRST:
            return _InlineRSTRecorder(index)
1002747
function hasPipeDataListeners (stream) {
  var listeners = stream.listeners('data')

  for (var i = 0; i < listeners.length; i++) {
    if (listeners[i].name === 'ondata') {
      return true
    }
  }

  return false
}
424981
public function isStreaming(): bool
    {
        $prefixes = [
            # Standard streams
            "x-sonosapi-stream:",

            # Other streams (eg Amazon)
            "x-sonosapi-radio:",

            # Line in
            "x-rincon-stream:",

            # Line in (playbar)
            "x-sonos-htastream:",
        ];

        $media = $this->getMediaInfo();

        foreach ($prefixes as $prefix) {
            if (strpos($media["CurrentURI"], $prefix) === 0) {
                return true;
            }
        }

        return false;
    }
1010898
def _find_recorder(recorder, tokens, index):
    """"""
    if recorder is None:
        # See if we can start recording something
        for recorder_factory in _RECORDERS:
            recorder = recorder_factory.maybe_start_recording(tokens,
                                                              index)
            if recorder is not None:
                return recorder

    return recorder