Skip to content

Commit

Permalink
adding more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cdgriffith committed Aug 12, 2024
1 parent 11b27bd commit 148eafd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions fastflix/flix.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def clean_file_string(source):
b = str(source).strip()
if "\\ " in b and "\\ " not in a:
logger.error(f"clean_file_string caused bad space in file path: {b} - source: {source}")
return b


def guess_bit_depth(pix_fmt: str, color_primaries: str = None) -> int:
Expand Down
20 changes: 20 additions & 0 deletions fastflix/models/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import uuid
from pathlib import Path
from typing import List, Optional, Union, Tuple
import logging

from box import Box
from pydantic import BaseModel, Field, field_validator
Expand Down Expand Up @@ -41,6 +42,8 @@

__all__ = ["VideoSettings", "Status", "Video", "Crop", "Status"]

logger = logging.getLogger("fastflix")


def determine_rotation(streams, track: int = 0) -> Tuple[int, int]:
for stream in streams.video:
Expand Down Expand Up @@ -211,6 +214,23 @@ class Video(BaseModel):
status: Status = Field(default_factory=Status)
uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))

@field_validator("source", mode="before")
@classmethod
def source_to_path(cls, value):

if "\\ " in str(value):
logger.error(f"Invalid source path: {value}")
import inspect

for i, stack in enumerate(inspect.stack()):
if i == 0 or i > 6:
continue
logger.debug(stack)

if not isinstance(value, Path):
return Path(value)
return value

@property
def width(self):
track = 0
Expand Down

0 comments on commit 148eafd

Please sign in to comment.