コード例 #1
0
def mime_type_for_path(path: str) -> str:
    return guess_type(path) or 'application/octet-stream'
コード例 #2
0
ファイル: main.py プロジェクト: phongnh/kitty
def scan(d: str) -> Generator[Tuple[str, str], None, None]:
    for dirpath, dirnames, filenames in os.walk(d):
        for f in filenames:
            mt = guess_type(f)
            if mt and mt.startswith('image/'):
                yield os.path.join(dirpath, f), mt
コード例 #3
0
ファイル: collect.py プロジェクト: dandycheung/kitty
def mime_type_for_path(path: str) -> str:
    return guess_type(
        path, allow_filesystem_access=True) or 'application/octet-stream'