mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -04:00
Add guessit
This commit is contained in:
parent
42adf023d9
commit
7427de1bb4
1
scanner/requirments.txt
Normal file
1
scanner/requirments.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
guessit
|
@ -2,8 +2,13 @@ from .scanner import scan
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
import os
|
import os
|
||||||
path = os.environ.get("LIBRARY_PATH")
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
|
path = os.environ.get("LIBRARY_ROOT")
|
||||||
if not path:
|
if not path:
|
||||||
print("Missing environment variable 'LIBRARY_PATH'.")
|
print("Missing environment variable 'LIBRARY_ROOT'.")
|
||||||
exit(2)
|
exit(2)
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] == "-v":
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
return scan(path)
|
return scan(path)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from guessit import guessit
|
||||||
|
import logging
|
||||||
|
|
||||||
def scan(path: str):
|
def scan(path: str):
|
||||||
for item in Path(path).rglob("*"):
|
for item in Path(path).rglob("*"):
|
||||||
if not item.is_file():
|
if not item.is_file():
|
||||||
continue
|
continue
|
||||||
print(item)
|
identify(item)
|
||||||
|
|
||||||
|
def identify(path: Path):
|
||||||
|
raw = guessit(path)
|
||||||
|
logging.info("Identied %s: %s", path, raw)
|
||||||
|
# print(f'type: {raw["type"]}, title: {raw["title"]}')
|
||||||
|
31
shell.nix
31
shell.nix
@ -1,13 +1,18 @@
|
|||||||
{pkgs ? import <nixpkgs> {}}:
|
{pkgs ? import <nixpkgs> {}}: let
|
||||||
pkgs.mkShell {
|
pythonPackages = p:
|
||||||
packages = with pkgs; [
|
with p; [
|
||||||
nodejs-16_x
|
guessit
|
||||||
nodePackages.yarn
|
];
|
||||||
(with dotnetCorePackages;
|
in
|
||||||
combinePackages [
|
pkgs.mkShell {
|
||||||
sdk_6_0
|
packages = with pkgs; [
|
||||||
aspnetcore_6_0
|
nodejs-16_x
|
||||||
])
|
nodePackages.yarn
|
||||||
python3
|
(with dotnetCorePackages;
|
||||||
];
|
combinePackages [
|
||||||
}
|
sdk_6_0
|
||||||
|
aspnetcore_6_0
|
||||||
|
])
|
||||||
|
(python3.withPackages pythonPackages)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user