diff --git a/operators/imports.py b/operators/imports.py index 84089f8..fcd8718 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) +from vse_toolbox.bl_utils import (get_scene_settings, get_addon_prefs, get_scene_settings, abspath) from vse_toolbox.file_utils import install_module, parse, find_last, expand @@ -368,16 +368,19 @@ 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: @@ -391,7 +394,7 @@ class VSETB_OT_import_shots(Operator): if shot_name.startswith(sequence_name): shot_name = shot_name.replace(sequence_name, '', 1) - preview_dir = self.get_preview_dir() + preview_dir = abspath(project.import_shots.previews_folder)#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) @@ -621,7 +624,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: - tmp_dir = '//sources' + project.import_shots.previews_folder = '//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 df28b4d..9049848 100644 --- a/operators/sequencer.py +++ b/operators/sequencer.py @@ -418,7 +418,11 @@ 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 and len(preview_areas) == 1: + if len(video_channels) < 2: + self.report({"ERROR"}, 'You need two channels to split the view') + return {"CANCELLED"} + + if len(preview_areas) == 1: # Split area with bpy.context.temp_override(area=preview_areas[0]): bpy.ops.screen.area_split(direction="VERTICAL") @@ -427,7 +431,7 @@ class WM_OT_split_view(Operator): # Update areas preview_areas = self.get_preview_areas(context) - preview_areas[-1].spaces[0].display_channel = video_channels[-1] + preview_areas[-1].spaces[0].display_channel = 0 #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 9e21a81..b8a38fc 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.') + self.report({'ERROR'}, f'Cannot connect to tracker, check login and password') return {"CANCELLED"} @@ -173,6 +173,7 @@ 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 38a97dc..15af0df 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,13 +148,14 @@ class Kitsu(Tracker): def get_metadata_types(self, project=None): project = self.get_project(project) - metadatas = [] - for metadata in gazu.project.all_metadata_descriptors(project): - if metadata['name']: - metadatas.append(metadata) + try : + metadatas = gazu.project.all_metadata_descriptors(project) + except gazu.exception.NotAllowedException: + print('No autorized to fetch metadata') + return [] - return metadatas + return [m for m in metadatas if m['name']] def get_task_status(self, status=None): status_id = self.get_id(status) diff --git a/ui/panels.py b/ui/panels.py index 755f653..afc9090 100644 --- a/ui/panels.py +++ b/ui/panels.py @@ -53,6 +53,9 @@ 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='')