mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -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():
|
||||
import os
|
||||
path = os.environ.get("LIBRARY_PATH")
|
||||
import logging
|
||||
import sys
|
||||
|
||||
path = os.environ.get("LIBRARY_ROOT")
|
||||
if not path:
|
||||
print("Missing environment variable 'LIBRARY_PATH'.")
|
||||
print("Missing environment variable 'LIBRARY_ROOT'.")
|
||||
exit(2)
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "-v":
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
return scan(path)
|
||||
|
@ -1,7 +1,14 @@
|
||||
from pathlib import Path
|
||||
from guessit import guessit
|
||||
import logging
|
||||
|
||||
def scan(path: str):
|
||||
for item in Path(path).rglob("*"):
|
||||
if not item.is_file():
|
||||
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.mkShell {
|
||||
packages = with pkgs; [
|
||||
nodejs-16_x
|
||||
nodePackages.yarn
|
||||
(with dotnetCorePackages;
|
||||
combinePackages [
|
||||
sdk_6_0
|
||||
aspnetcore_6_0
|
||||
])
|
||||
python3
|
||||
];
|
||||
}
|
||||
{pkgs ? import <nixpkgs> {}}: let
|
||||
pythonPackages = p:
|
||||
with p; [
|
||||
guessit
|
||||
];
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
nodejs-16_x
|
||||
nodePackages.yarn
|
||||
(with dotnetCorePackages;
|
||||
combinePackages [
|
||||
sdk_6_0
|
||||
aspnetcore_6_0
|
||||
])
|
||||
(python3.withPackages pythonPackages)
|
||||
];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user