Skip to content

Commit

Permalink
Replace Logger with self.log
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeantonopoulos-bcnvisuals committed Jan 9, 2025
1 parent 1fece5f commit 82125d4
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions client/ayon_openrv/plugins/load/openrv/load_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ayon_core.pipeline import load
from ayon_core.pipeline.load import get_representation_path_from_context
from ayon_core.lib.transcoding import IMAGE_EXTENSIONS
from ayon_core.lib import Logger

from ayon_openrv.api.pipeline import imprint_container
from ayon_openrv.api.ocio import (
Expand All @@ -16,9 +15,6 @@
import rv


log = Logger.get_logger(__name__)


class FramesLoader(load.LoaderPlugin):
"""Load frames into OpenRV"""

Expand All @@ -40,7 +36,7 @@ def load(self, context, name=None, namespace=None, data=None):
namespace = namespace if namespace else context["folder"]["name"]

loaded_node = rv.commands.addSourceVerbose([filepath])
log.debug(f"Loaded node: {loaded_node}")
self.log.debug(f"Loaded node: {loaded_node}")

# update colorspace
self.set_representation_colorspace(loaded_node,
Expand Down Expand Up @@ -106,7 +102,7 @@ def _get_sequence_range(self, context):
# Only images may be sequences, not videos
ext = repre_entity["context"].get("ext") or repre_entity["name"]
if f".{ext}" not in IMAGE_EXTENSIONS:
log.debug(f"Extension {ext} not in IMAGE_EXTENSIONS")
self.log.debug(f"Extension {ext} not in IMAGE_EXTENSIONS")
return

# Check version attributes first as they should have the correct frame range
Expand All @@ -123,7 +119,7 @@ def _get_sequence_range(self, context):

if frame_start is not None and frame_end is not None:
if frame_start != frame_end:
log.debug(f"Using frame range: {frame_start}-{frame_end}")
self.log.debug(f"Using frame range: {frame_start}-{frame_end}")
return frame_start, frame_end
return

Expand Down Expand Up @@ -157,7 +153,7 @@ def _format_path(self, context):
representation = context["representation"]
if not representation["attrib"].get("template"):
# No template to find token locations for
log.debug(f"No template found, using direct path")
self.log.debug(f"No template found, using direct path")
return get_representation_path_from_context(context)

def _placeholder(key):
Expand All @@ -173,7 +169,7 @@ def _placeholder(key):
tokens = {
"frame": f"{start}-{end}#",
}
log.debug(f"Using tokens: {tokens}")
self.log.debug(f"Using tokens: {tokens}")
has_tokens = False
repre_context = representation["context"]
for key, _token in tokens.items():
Expand All @@ -183,14 +179,14 @@ def _placeholder(key):

# Replace with our custom template that has the tokens set
path = get_representation_path_from_context(context)
log.debug(f"Initial path with placeholders: {path}")
self.log.debug(f"Initial path with placeholders: {path}")

if has_tokens:
for key, token in tokens.items():
if key in repre_context:
path = path.replace(_placeholder(key), token)

log.debug(f"Final formatted path: {path}")
self.log.debug(f"Final formatted path: {path}")
return path

def set_representation_colorspace(self, node, representation):
Expand Down

0 comments on commit 82125d4

Please sign in to comment.