Skip to content

Commit 7c4c9fe

Browse files
committed
fix attribute error
1 parent 08daed3 commit 7c4c9fe

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

media_converter/bulk_convert/convert_task.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ def __init__(
4646
self, browser: Browser, note_ids: Sequence[NoteId], selected_fields: list[str], config: MediaConverterConfig
4747
) -> None:
4848
self._browser = browser
49+
self._config = config
4950
self._selected_fields = selected_fields
5051
self._result = ConvertResult()
51-
self._to_convert = self._find_files_to_convert_and_notes(note_ids)
52-
self._canceled = False
53-
self._config = config
5452
self._finder = FindMedia(config)
53+
self._canceled = False
54+
self._to_convert = self._find_files_to_convert_and_notes(note_ids)
5555

5656
@property
5757
def size(self) -> int:
@@ -123,6 +123,7 @@ def _find_files_to_convert_and_notes(self, note_ids: Sequence[NoteId]) -> dict[L
123123
Maps each filename to a set of note ids that reference the filename.
124124
"""
125125
assert mw
126+
assert self._config, "config should be set"
126127
to_convert: dict[LocalFile, dict[NoteId, Note]] = collections.defaultdict(dict)
127128

128129
for note in map(mw.col.get_note, note_ids):

media_converter/file_converters/internal_file_converter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ class InternalFileConverter:
2929
_config: MediaConverterConfig
3030

3131
def __init__(self, editor: Optional[aqt.editor.Editor], file: LocalFile, note: Note, config: MediaConverterConfig):
32+
self._config = config
3233
self._conversion_finished = False
33-
self._fpf = FilePathFactory(note=note, editor=editor, config=self._config)
3434
self._initial_file_path = os.path.join(self._dest_dir, file.file_name)
35-
self._config = config
35+
self._fpf = FilePathFactory(note=note, editor=editor, config=config)
3636
self._destination_file_path = self._fpf.make_unique_filepath(
3737
self._dest_dir,
3838
file.file_name,
3939
extension=self._fpf.get_target_extension(file),
4040
)
41-
self._converter = FileConverter(self._initial_file_path, self._destination_file_path, config=self._config)
41+
self._converter = FileConverter(self._initial_file_path, self._destination_file_path, config=config)
4242

4343
@property
4444
def _dest_dir(self) -> str:

0 commit comments

Comments
 (0)