Get info about a soundfile

    path (str): the path to a soundfile

    RETURNS --> an instance of SndInfo: samplerate, nframes, channels, encoding, fileformat
421843
def sndinfo(path:str) -> SndInfo:
    
    backend = _getBackend(path)
    logger.debug(f"sndinfo: using backend {backend.name}")
    return backend.getinfo(path)
542877
def filepaths(self):
        
        return nativestring(self._filepathEdit.text()).split(os.path.pathsep)
1288952
private static int[] readInfoFile(File tmpFile) {
        int[] info = new int[8];
        try (RandomAccessFile infoFile = new RandomAccessFile(tmpFile, "r")) {
            // audio codec id
            info[0] = infoFile.readInt();
            // video codec id
            info[1] = infoFile.readInt();
            // duration
            info[2] = infoFile.readInt();
            // audio data size
            info[3] = infoFile.readInt();
            // audio sound rate
            info[4] = infoFile.readInt();
            // audio sound size
            info[5] = infoFile.readInt();
            // audio type
            info[6] = infoFile.readInt();
            // video data size
            info[7] = infoFile.readInt();
        } catch (Exception e) {
            log.warn("Exception reading flv file information data", e);
        }
        return info;
    }
413352
def ReadPathInfo(self, client_id, path_type, components, timestamp=None):
    """"""
    try:
      path_record = self.path_records[(client_id, path_type, components)]
      return path_record.GetPathInfo(timestamp=timestamp)
    except KeyError:
      raise db.UnknownPathError(
          client_id=client_id, path_type=path_type, components=components)
1026796
def fetch_path(self, name):
        

        with codecs.open(self.lookup_path(name), encoding='utf-8') as fd:
            return fd.read()
163131
public FileInfo getFileInfo(URI path) throws IOException {
    logger.atFine().log("getFileInfo(%s)", path);
    checkArgument(path != null, "path must not be null");
    // Validate the given path. true == allow empty object name.
    // One should be able to get info about top level directory (== bucket),
    // therefore we allow object name to be empty.
    StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
    FileInfo fileInfo =
        FileInfo.fromItemInfo(
            pathCodec,
            getFileInfoInternal(resourceId, gcs.getOptions().isInferImplicitDirectoriesEnabled()));
    logger.atFine().log("getFileInfo: %s", fileInfo);
    return fileInfo;
  }
235363
def GetFileEntryByPathSpec(self, path_spec):
    
    # Opening a file by identifier is faster than opening a file by location.
    fsapfs_file_entry = None
    location = getattr(path_spec, 'location', None)
    identifier = getattr(path_spec, 'identifier', None)

    if (location == self.LOCATION_ROOT or
        identifier == self.ROOT_DIRECTORY_IDENTIFIER):
      fsapfs_file_entry = self._fsapfs_volume.get_root_directory()
      return apfs_file_entry.APFSFileEntry(
          self._resolver_context, self, path_spec,
          fsapfs_file_entry=fsapfs_file_entry, is_root=True)

    try:
      if identifier is not None:
        fsapfs_file_entry = self._fsapfs_volume.get_file_entry_by_identifier(
            identifier)
      elif location is not None:
        fsapfs_file_entry = self._fsapfs_volume.get_file_entry_by_path(location)

    except IOError as exception:
      raise errors.BackEndError(exception)

    if fsapfs_file_entry is None:
      return None

    return apfs_file_entry.APFSFileEntry(
        self._resolver_context, self, path_spec,
        fsapfs_file_entry=fsapfs_file_entry)
271551
def capture_file_path(self):
        

        if self._capture_file_name:
            return os.path.join(self._project.captures_directory, self._capture_file_name)
        else:
            return None
431588
def get_audio_duration(self):
        
        decoder = timeside.core.get_processor('file_decoder')(
            uri=self.get_uri())
        return decoder.uri_total_duration
57447
def get_file_path(self, path):
        
        feature_filename = self._get_filename_path(path)

        feature_filename += self.file_format.extension()
        if self.compress_level:
            feature_filename += FileFormat.GZIP.extension()

        return feature_filename
1277772
def GetPathInfo(self, timestamp=None):
    
    path_info_timestamp = self._LastEntryTimestamp(self._path_infos, timestamp)
    try:
      result = self._path_infos[path_info_timestamp].Copy()
    except KeyError:
      result = rdf_objects.PathInfo(
          path_type=self._path_type, components=self._components)

    stat_entry_timestamp = self._LastEntryTimestamp(self._stat_entries,
                                                    timestamp)
    result.last_stat_entry_timestamp = stat_entry_timestamp
    result.stat_entry = self._stat_entries.get(stat_entry_timestamp)

    hash_entry_timestamp = self._LastEntryTimestamp(self._hash_entries,
                                                    timestamp)
    result.last_hash_entry_timestamp = hash_entry_timestamp
    result.hash_entry = self._hash_entries.get(hash_entry_timestamp)

    return result
1207326
def GetZipInfo(self):
    
    if not self._zip_info:
      location = getattr(self.path_spec, 'location', None)
      if location is None:
        raise errors.PathSpecError('Path specification missing location.')

      if not location.startswith(self._file_system.LOCATION_ROOT):
        raise errors.PathSpecError('Invalid location in path specification.')

      if len(location) == 1:
        return None

      zip_file = self._file_system.GetZipFile()
      try:
        self._zip_info = zip_file.getinfo(location[1:])
      except KeyError:
        pass

    return self._zip_info
577912
def _get_datapath(self):
        
        if self._datapath is None:
            raise OSError(errno.ENOENT, "You didn't provide any datapath for %r" % self.filename)

        return self._datapath
1332359
def wave_infochunk(path):
    
    with open(path,'rb') as file:
        if file.read(4) != b"RIFF":
            return None
        data_size = file.read(4) # container size
        if file.read(4) != b"WAVE":
            return None
        while True:
            chunkid = file.read(4)
            sizebuf = file.read(4)
            if len(sizebuf) < 4 or len(chunkid) < 4:
                return None
            size    = struct.unpack(b'<L', sizebuf )[0]
            if chunkid[0:3] != b"fmt":
                if size % 2 == 1:
                    seek = size + 1
                else:
                    seek = size
                file.seek(size,1)
            else:
                return bytearray(b"RIFF" + data_size + b"WAVE" + chunkid + sizebuf + file.read(size))
1296111
def _get_path(fname: str) -> str:
    
    path = get_corpus_path(fname)
    if not path:
        download(fname)
        path = get_corpus_path(fname)
    return path
854211
def get_csv_import_info(self, path):
        

        csvfilename = os.path.split(path)[1]

        try:
            filterdlg = CsvImportDialog(self.main_window, csvfilepath=path)

        except csv.Error, err:
            # Display modal warning dialog

            msg = _("'{filepath}' does not seem to be a valid CSV file.\n \n"
                    "Opening it yielded the error:\n{error}")
            msg = msg.format(filepath=csvfilename, error=err)
            short_msg = _('Error reading CSV file')

            self.display_warning(msg, short_msg)

            return

        if filterdlg.ShowModal() == wx.ID_OK:
            dialect, has_header = filterdlg.csvwidgets.get_dialect()
            digest_types = filterdlg.grid.dtypes
            encoding = filterdlg.csvwidgets.encoding

        else:
            filterdlg.Destroy()

            return

        filterdlg.Destroy()

        return dialect, has_header, digest_types, encoding
1211150
def get_real_layer_path(self, path):
        
        filename = path.split('/')[-1]
        local_path = path
        filetype = os.path.splitext(filename)[1]

        # Url
        if re.match(r'^[a-zA-Z]+://', path):
            local_path = os.path.join(DATA_DIRECTORY, filename)

            if not os.path.exists(local_path):
                sys.stdout.write('* Downloading %s...\n' % filename)
                self.download_file(path, local_path)
            elif self.args.redownload:
                os.remove(local_path)

                sys.stdout.write('* Redownloading %s...\n' % filename)
                self.download_file(path, local_path)
        # Non-existant file
        elif not os.path.exists(local_path):
            raise Exception('%s does not exist' % local_path)

        real_path = path

        # Zip files
        if filetype == '.zip':
            slug = os.path.splitext(filename)[0]
            real_path = os.path.join(DATA_DIRECTORY, slug)

            if not os.path.exists(real_path):
                sys.stdout.write('* Unzipping...\n')
                self.unzip_file(local_path, real_path)

        return real_path