mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Create a scanner python module
This commit is contained in:
parent
02214a127c
commit
42adf023d9
1
scanner/.gitignore
vendored
Normal file
1
scanner/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__
|
9
scanner/scanner/__init__.py
Normal file
9
scanner/scanner/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
from .scanner import scan
|
||||
|
||||
def main():
|
||||
import os
|
||||
path = os.environ.get("LIBRARY_PATH")
|
||||
if not path:
|
||||
print("Missing environment variable 'LIBRARY_PATH'.")
|
||||
exit(2)
|
||||
return scan(path)
|
5
scanner/scanner/__main__.py
Normal file
5
scanner/scanner/__main__.py
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import scanner
|
||||
|
||||
exit(scanner.main())
|
7
scanner/scanner/scanner.py
Normal file
7
scanner/scanner/scanner.py
Normal file
@ -0,0 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
def scan(path: str):
|
||||
for item in Path(path).rglob("*"):
|
||||
if not item.is_file():
|
||||
continue
|
||||
print(item)
|
Loading…
x
Reference in New Issue
Block a user