(self, trunk_req=None, filetypes_req=None)
Play until a file header record is found for the given filename.
Play until a file header record is found for the given filename.
Play until a file header record is found for the given filename .
def _search(self, trunk_req=None, filetypes_req=None):
        """Play until a file header record is found for the given filename."""
        try:
            while True:
                trunk, filetype, seg, offset, length = self.tapestream.open_read()
                if (
                        (not trunk_req or trunk.rstrip() == trunk_req.rstrip()) and
                        (not filetypes_req or filetype in filetypes_req)
                    ):
                    message = b'%s.%s Found.' % (trunk, filetype)
                    if not self.is_quiet:
                        self.console.write_line(message)
                    logging.debug(timestamp(self.tapestream.counter()) + message)
                    return trunk, filetype, seg, offset, length
                else:
                    message = b'%s.%s Skipped.' % (trunk, filetype)
                    if not self.is_quiet:
                        self.console.write_line(message)
                    logging.debug(timestamp(self.tapestream.counter()) + message)
        except EndOfTape:
            # reached end-of-tape without finding appropriate file
            # we'll loop the tape for future use
            self.tapestream.wind(0)
            # timeout error to align with GW-BASIC behaviour
            raise error.BASICError(error.DEVICE_TIMEOUT)
def _search ( self , trunk_req = None , filetypes_req = None ) : try : while True : trunk , filetype , seg , offset , length = self . tapestream . open_read ( ) if ( ( not trunk_req or trunk . rstrip ( ) == trunk_req . rstrip ( ) ) and ( not filetypes_req or filetype in filetypes_req ) ) : message = b'%s.%s Found.' % ( trunk , filetype ) if not self . is_quiet : self . console . write_line ( message ) logging . debug ( timestamp ( self . tapestream . counter ( ) ) + message ) return trunk , filetype , seg , offset , length else : message = b'%s.%s Skipped.' % ( trunk , filetype ) if not self . is_quiet : self . console . write_line ( message ) logging . debug ( timestamp ( self . tapestream . counter ( ) ) + message ) except EndOfTape : # reached end-of-tape without finding appropriate file # we'll loop the tape for future use self . tapestream . wind ( 0 ) # timeout error to align with GW-BASIC behaviour raise error . BASICError ( error . DEVICE_TIMEOUT )