diff --git a/operators/imports.py b/operators/imports.py index fcd8718..84089f8 100644 --- a/operators/imports.py +++ b/operators/imports.py @@ -15,7 +15,7 @@ from vse_toolbox.constants import (EDITS, EDIT_SUFFIXES, MOVIES, MOVIE_SUFFIXES, from vse_toolbox.sequencer_utils import (clean_sequencer, import_edit, import_movie, import_sound, get_strips, get_channel_index, get_empty_channel, scale_clip_to_fit) -from vse_toolbox.bl_utils import (get_scene_settings, get_addon_prefs, get_scene_settings, abspath) +from vse_toolbox.bl_utils import (get_scene_settings, get_addon_prefs, get_scene_settings) from vse_toolbox.file_utils import install_module, parse, find_last, expand @@ -368,19 +368,16 @@ class VSETB_OT_import_shots(Operator): channel_index += 1 - # def get_preview_dir(self): - # preview_dir = Path(bpy.app.tempdir, 'previews') - # if bpy.data.filepath: - # preview_dir = Path(bpy.data.filepath).parent / 'previews' - # return preview_dir + def get_preview_dir(self): + preview_dir = Path(bpy.app.tempdir, 'previews') + if bpy.data.filepath: + preview_dir = Path(bpy.data.filepath).parent / 'previews' + return preview_dir def download_preview(self, task_type, shot): prefs = get_addon_prefs() tracker = prefs.tracker - settings = get_scene_settings() - project = settings.active_project - task = tracker.get_task(task_type.id or task_type.name, entity=shot) last_comment = tracker.get_last_comment_with_preview(task) if not last_comment: @@ -394,7 +391,7 @@ class VSETB_OT_import_shots(Operator): if shot_name.startswith(sequence_name): shot_name = shot_name.replace(sequence_name, '', 1) - preview_dir = abspath(project.import_shots.previews_folder)#self.get_preview_dir() + preview_dir = self.get_preview_dir() filepath = Path(preview_dir, f'{sequence_name}{shot_name}_{task_type.name}.{ext}') filepath.parent.mkdir(parents=True, exist_ok=True) @@ -624,7 +621,7 @@ class VSETB_OT_import_shots(Operator): tmp_dir = Path(gettempdir(), 'reviews') if bpy.data.filepath and Path(project.import_shots.previews_folder) == tmp_dir: - project.import_shots.previews_folder = '//sources' + tmp_dir = '//sources' if not bpy.data.filepath and project.import_shots.previews_folder == '//sources': project.import_shots.previews_folder = str(tmp_dir) diff --git a/operators/sequencer.py b/operators/sequencer.py index c272161..2450e74 100644 --- a/operators/sequencer.py +++ b/operators/sequencer.py @@ -418,11 +418,7 @@ class WM_OT_split_view(Operator): scn = context.scene video_channels = [i for i, c in enumerate(scn.sequence_editor.channels) if 'Video' in c.name] - if len(video_channels) < 2: - self.report({"ERROR"}, 'You need two channels to split the view') - return {"CANCELLED"} - - if len(preview_areas) == 1: + if len(video_channels) == 2 and len(preview_areas) == 1: # Split area with bpy.context.temp_override(area=preview_areas[0]): bpy.ops.screen.area_split(direction="VERTICAL") @@ -431,7 +427,7 @@ class WM_OT_split_view(Operator): # Update areas preview_areas = self.get_preview_areas(context) - preview_areas[-1].spaces[0].display_channel = 0 #video_channels[-1] + preview_areas[-1].spaces[0].display_channel = video_channels[-1] preview_areas[0].spaces[0].display_channel = video_channels[-2] preview_areas[0].spaces[0].show_gizmo_navigate = False diff --git a/operators/tracker.py b/operators/tracker.py index b8a38fc..9e21a81 100644 --- a/operators/tracker.py +++ b/operators/tracker.py @@ -37,11 +37,11 @@ class VSETB_OT_tracker_connect(Operator): settings = get_scene_settings() try: prefs.tracker.connect() - self.report({'INFO'}, f'Successfully login to {settings.tracker_name.title()}') + self.report({'INFO'}, f'successfully login to {settings.tracker_name.title()}') return {"FINISHED"} except Exception as e: print('e: ', e) - self.report({'ERROR'}, f'Cannot connect to tracker, check login and password') + self.report({'ERROR'}, f'Cannot connect to tracker.') return {"CANCELLED"} @@ -173,7 +173,6 @@ class VSETB_OT_load_projects(Operator): sequence.id = sequence_data['id'] project.metadata_types.clear() - for metadata_data in tracker.get_metadata_types(project_data): #pprint(metadata_data) metadata_type = project.metadata_types.add() diff --git a/resources/trackers/kitsu.py b/resources/trackers/kitsu.py index 15af0df..38a97dc 100644 --- a/resources/trackers/kitsu.py +++ b/resources/trackers/kitsu.py @@ -74,14 +74,14 @@ class Kitsu(Tracker): if not gazu.client.host_is_up(): print('Error: Kitsu Host is down') - #try: - print(f'Info: Log in to kitsu as {login}') - res = gazu.log_in(login, password) - LOGIN = login - print(f'Info: successfully login to Kitsu as {res["user"]["full_name"]}') - return res['user'] - #except Exception as e: - # print(f'Error: {traceback.format_exc()}') + try: + print(f'Info: Log in to kitsu as {login}') + res = gazu.log_in(login, password) + LOGIN = login + print(f'Info: successfully login to Kitsu as {res["user"]["full_name"]}') + return res['user'] + except Exception as e: + print(f'Error: {traceback.format_exc()}') def get_id(self, data): if isinstance(data, str): @@ -148,14 +148,13 @@ class Kitsu(Tracker): def get_metadata_types(self, project=None): project = self.get_project(project) + metadatas = [] - try : - metadatas = gazu.project.all_metadata_descriptors(project) - except gazu.exception.NotAllowedException: - print('No autorized to fetch metadata') - return [] + for metadata in gazu.project.all_metadata_descriptors(project): + if metadata['name']: + metadatas.append(metadata) - return [m for m in metadatas if m['name']] + return metadatas def get_task_status(self, status=None): status_id = self.get_id(status) diff --git a/ui/panels.py b/ui/panels.py index afc9090..755f653 100644 --- a/ui/panels.py +++ b/ui/panels.py @@ -53,9 +53,6 @@ class VSETB_PT_main(VSETB_main, Panel): project = settings.active_project - if not project: - return - if project and project.type == 'TVSHOW': row.separator(factor=0.5) row.prop(project, 'episode_name', text='')