small fixes

pull/5/head
ChristopheSeux 2024-04-16 18:28:36 +02:00
parent 0055e0f39e
commit 7f60aae277
5 changed files with 37 additions and 25 deletions

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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='')