AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO

SVG Adapter erroneously assumes `media_reference` always has `target_url`

Open
#1,177 3 comments 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
C++
Stars
2k
Forks
351
Avg merge
1d 12h
Merged PRs (30d)
1

Description

## Bug Report

### Incorrect Functionality and General Questions

(@KarthikRIyer) The SVG Adapter erroneously assumes `media_reference` always has `target_url`. Eg. `GeneratorReference` does not have `target_url`

## To Reproduce

This can be reproduced with any otio (like [test.otio.zip](https://github.com/PixarAnimationStudios/OpenTimelineIO/files/7723737/test.otio.zip) that has a `media_reference` with `"OTIO_SCHEMA": "GeneratorReference.1"`

Run `otioconvert -i test.otio -o test.svg` and you will get the output in the **Logs** section.

OS: Linux KDE Neon (Ubunt)
Python: 3.8.10
OpenTimelineIO: 0.14.1

## Expected Behavior

`otioconvert -i test.otio -o test.svg` should create `test.svg` instead of showing the error

## Logs

```
Traceback (most recent call last):
File "/home/julius/.local/bin/otioconvert", line 8, in
sys.exit(main())
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/console/otioconvert.py", line 298, in main
otio.adapters.write_to_file(
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/__init__.py", line 194, in write_to_file
return adapter.write_to_file(
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/adapter.py", line 212, in write_to_file
result = self.write_to_string(input_otio, **adapter_argument_map)
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/adapter.py", line 303, in write_to_string
return self._execute_function(
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/plugins/python_plugin.py", line 174, in _execute_function
return (getattr(self.module(), func_name)(**kwargs))
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/svg.py", line 1137, in write_to_string
return convert_otio_to_svg(input_otio, width=width, height=height)
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/svg.py", line 1127, in convert_otio_to_svg
draw_item(timeline, svg_writer, ())
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/svg.py", line 548, in draw_item
return WRITE_TYPE_MAP[type(otio_obj)](otio_obj, svg_writer, extra_data)
File "/home/julius/.local/lib/python3.8/site-packages/opentimelineio/adapters/svg.py", line 590, in _draw_timeline
item.media_reference.target_url, clip_count - 1)
AttributeError: 'opentimelineio._otio.GeneratorReference' object has no attribute 'target_url'
```

## Additional Context

Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start in opentimelineio/adapters/svg.py at _draw_timeline around the failing target_url access, then reproduce the issue with the supplied GeneratorReference-based test.otio using otioconvert. The work is done when converting that input creates test.svg without the AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.