From b9a9f32e895c106415d13846c068fc444d15d659 Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Fri, 1 Nov 2024 09:22:54 +0100 Subject: [PATCH] Refactor cam settings, add key bindings for wb, exp, flip image --- config.toml | 15 +- frame_opencv.py | 186 ++++++++++-------------- locales/en/LC_MESSAGES/template.mo | Bin 333 -> 334 bytes locales/en/LC_MESSAGES/template.pot | 61 +++++--- locales/fr/LC_MESSAGES/template.mo | Bin 2051 -> 2702 bytes locales/fr/LC_MESSAGES/template.pot | 62 ++++---- locales/fr/LC_MESSAGES/template.pot.bak | 100 ------------- locales/gen_mo.sh | 2 + locales/template.pot | 105 ------------- 9 files changed, 155 insertions(+), 376 deletions(-) delete mode 100644 locales/fr/LC_MESSAGES/template.pot.bak delete mode 100644 locales/template.pot diff --git a/config.toml b/config.toml index 02288d8..a9ebd6b 100644 --- a/config.toml +++ b/config.toml @@ -1,6 +1,5 @@ [DEFAULT] -#camera_type = 2 -cam_is_showmewebcam = false +cam_is_showmewebcam = true use_date_for_folder = false file_extension = 'png' projects_folder = '' @@ -10,9 +9,13 @@ fullscreen_bool = true screen_w = 1920 screen_h = 1080 framerate = 16 -vflip = false -hflip = false ffmpeg_path = '/usr/bin/ffmpeg' -export_options = 'scale=1920:-1,crop=1920:1080:0:102' +export_options = 'scale=1920:-1,crop=1920:1080' [CAMERA] - +cam_w = 1920 +cam_h = 1080 +vflip = 1 +hflip = 1 +auto_exposure = 0 +white_balance_auto_preset = 0 +video_bitrate=25000000 diff --git a/frame_opencv.py b/frame_opencv.py index 9528f01..5aba6f8 100644 --- a/frame_opencv.py +++ b/frame_opencv.py @@ -25,30 +25,34 @@ _ = gettext.translation('template', localedir='locales', languages=[LOCALE]).get # Config # defaults project_settings_defaults = { - # gphoto2 = 0, picam = 1, webcam = 2 - 'camera_type': 2, - 'file_extension':'JPG', - 'trigger_mode': 'key', - 'projects_folder': '', + 'cam_is_showmewebcam': False, 'use_date_for_folder': False, + 'file_extension':'png', + 'projects_folder': '', 'onion_skin_onstartup' : False, 'onionskin_alpha_default' : 0.4, - 'onionskin_fx' : False, 'fullscreen_bool' : True, 'screen_w' : 1920, 'screen_h' : 1080, 'framerate' : 16, - 'vflip' : False, - 'hflip' : False, 'ffmpeg_path' : None, 'export_options' : 'scale=1920:-1,crop=1920:1080:0:102', - 'cache_images' : False, - 'liveview' : False, } + +camera_current_settings_defaults = { + 'cam_w' : 800, + 'cam_h' : 600, + 'vflip' : 0, + 'hflip' : 0, + 'auto_exposure' : 0, + 'white_balance_auto_preset' : 0, +} + # Load from file config_locations = ["./", "~/.", "~/.config/"] config_found_msg = _("No configuration file found, using defaults.") project_settings = project_settings_defaults +camera_current_settings = camera_current_settings_defaults for location in config_locations: # Optional config files, ~ is expanded to $HOME on *nix, %USERPROFILE% on windows if os.path.exists( os.path.expanduser(os.path.join(location, 'config.toml'))): @@ -61,13 +65,45 @@ for location in config_locations: config_found_msg = _("Found configuration file in {}").format(os.path.expanduser(location)) print(config_found_msg) -def reset_wb_exp(): - # Flip auto-exposure, white-balance on to adapt to light environment - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c auto_exposure=0 -c white_balance_auto_preset=1') - # Give some time to the captor to adapt - time.sleep(1) - # Flip back, wb 3 = fluorescent - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c auto_exposure=1 -c white_balance_auto_preset=2') +camera_current_settings = { + 'auto_exposure': dict(min=0, max=1, default=camera_settings['auto_exposure'], value=camera_settings['auto_exposure']), + 'white_balance_auto_preset': dict(min=0, max=9, default=camera_settings['white_balance_auto_preset'], value=camera_settings['white_balance_auto_preset']), + 'horizontal_flip': dict(min=0, max=1, default=camera_settings['hflip'], value=camera_settings['hflip']), + 'vertical_flip': dict(min=0, max=1, default=camera_settings['vflip'], value=camera_settings['vflip']), + 'video_bitrate': dict(min=25000000, max=25000000, default=camera_settings['video_bitrate'], value=camera_settings['video_bitrate']), + } + + +def apply_cam_setting(cam_settings:dict, to_set:list=None): + cmd = 'v4l2-ctl -d /dev/video0' + args = [] + for setting in cam_settings: + if to_set is None: + # Apply defaults + cam_settings[setting]['value'] = cam_settings[setting]['default'] + cmd += ' -c {}={}' + args.append(setting) + args.append(cam_settings[setting]['value']) + else: + # Increment settings in to_set + for setting in to_set: + if setting in cam_settings: + if cam_settings[setting]['value']+1 in range(cam_settings[setting]['min'],cam_settings[setting]['max']+1): + cam_settings[setting]['value'] += 1 + else: + cam_settings[setting]['value'] = cam_settings[setting]['min'] + cmd += ' -c {}={}' + args.append(setting) + args.append(cam_settings[setting]['value']) + else: + print(_("Unknown setting!")) + break + if project_settings['cam_is_showmewebcam']: + serialutils.send_serial_cmd(serialutils.find_cam_port(), cmd.format(*args)) + else: + # TODO: v4l2 support + print(_("Camera function not supported.")) + return cam_settings def generate_text_image(text:str, screen_w, screen_h, bullets=False): @@ -75,8 +111,6 @@ def generate_text_image(text:str, screen_w, screen_h, bullets=False): (screen_w, screen_h), (0,0,0) ) - # ~ text_image = np.zeros((screen_h,screen_w,3),np.uint8) - # ~ text_image_pil = Image.fromarray(text_image) text_image_draw = ImageDraw.Draw(text_image) if text is not None: font = ImageFont.truetype("Tuffy_Bold.ttf", (screen_w/32)) @@ -251,8 +285,6 @@ def get_onionskin_frame(folder:str, index=None): def return_next_frame_number(last_frame_name): prefix, filecount, ext = last_frame_name filename = '.{:04d}.'.format(int(filecount)+1) - # ~ filename = (".%04i." % x for x in count(int(filecount) + 1)) - # ~ return prefix + next(filename) + ext return prefix + filename + ext @@ -316,13 +348,9 @@ def batch_rename(folder:str): # initialize counter to 0 frame_list = get_frames_list(folder) counter = (".%04i." % x for x in count(0)) - # ~ for i in range(len(frame_list)): for i in frame_list: - # ~ if os.path.exists(os.path.realpath(frame_list[i])): if os.path.exists(os.path.join(folder, i)): - # ~ os.rename(os.path.realpath(frame_list[i]), os.path.realpath("{}{}{}".format(project_settings['project_letter'], next(counter), project_settings['file_extension']))) os.rename(os.path.join(folder, i), os.path.join(folder, "{}{}{}".format(project_letter, next(counter), project_settings['file_extension']))) - # ~ print(os.path.join(folder, "{}{}{}".format(project_letter, next(counter), project_settings['file_extension']))) else: print(_("{} does not exist").format(str(i))) return get_frames_list(folder) @@ -350,8 +378,6 @@ def remove_frame(img_list, img_index): send2trash(frame_path) # remove entry from dict img_list.remove(frame_name) - # offset cached images - # ~ offset_dictvalues(img_index) # rename files and get new list img_list = batch_rename(folder_path) clean_img_list(folder_path) @@ -377,7 +403,7 @@ def signal_handler(sig, frame): ctrlc_pressed = True -def parse_export_options(options:str, vflip:bool=False, hflip:bool=False): +def parse_export_options(options:str, vflip:int=0, hflip:int=0): if vflip: options += ',vflip' if hflip: @@ -404,94 +430,24 @@ def export_animation(input_filename, export_filename): def main(args): - global onionskin, playback, loop_playback, playhead, index, img_list, first_playback + global onionskin, playback, loop_playback, playhead, index, img_list, first_playback, camera_current_settings if not testDevice(0): print(_("No camera device found. Exiting...")) return 1 cam = cv2.VideoCapture(0) - # TODO : find highest def available and use that - cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) - cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) + cam.set(cv2.CAP_PROP_FRAME_WIDTH, camera_settings['cam_w']) + cam.set(cv2.CAP_PROP_FRAME_HEIGHT, camera_settings['cam_h']) frame = get_onionskin_frame(savepath, index) - - # TODO : (re)set camera settings on startup - # Using serial to send v4l2-ctl cmd to the camera - # Use v4l-ctl to flip frame - # v4l2-ctl -d /dev/video0 -c vertical_flip=1 -c control=value - # DEPRECATED : Using config file and loading with camera-ctl - # Write config file to /tmp/blah - # ~ write_config_file = '''rm /tmp/blah && echo "power_line_frequency=2 - # ~ sharpness=50 - # ~ video_bitrate=25000000 - # ~ auto_exposure=1 - # ~ auto_exposure_bias=2 - # ~ white_balance_auto_preset=3 - # ~ exposure_metering_mode=1 - # ~ " > /tmp/blah''' - # Apply config - # ~ apply_config = '/opt/camera-control/camera-ctl -c /tmp/blah -v /dev/video0 -i repeat_sequence_header -i h264_i_frame_period -i h264_level -i h264_profile -i compression_quality\rl\rq\r' - # ~ serialutils.send_serial_cmd(serialutils.find_cam_port(), write_config_file) - # ~ serialutils.send_serial_cmd(serialutils.find_cam_port(), apply_config) - - # ~ User Controls - - # ~ brightness 0x00980900 (int) : min=0 max=100 step=1 default=50 value=50 flags=slider - # ~ contrast 0x00980901 (int) : min=-100 max=100 step=1 default=0 value=-2 flags=slider - # ~ saturation 0x00980902 (int) : min=-100 max=100 step=1 default=0 value=5 flags=slider - # ~ red_balance 0x0098090e (int) : min=1 max=7999 step=1 default=1000 value=1000 flags=slider - # ~ blue_balance 0x0098090f (int) : min=1 max=7999 step=1 default=1000 value=1000 flags=slider - # ~ horizontal_flip 0x00980914 (bool) : default=0 value=0 - # ~ vertical_flip 0x00980915 (bool) : default=0 value=0 - # ~ power_line_frequency 0x00980918 (menu) : min=0 max=3 default=1 value=1 - # ~ sharpness 0x0098091b (int) : min=-100 max=100 step=1 default=0 value=10 flags=slider - # ~ color_effects 0x0098091f (menu) : min=0 max=15 default=0 value=0 - # ~ rotate 0x00980922 (int) : min=0 max=360 step=90 default=0 value=0 flags=modify-layout - # ~ color_effects_cbcr 0x0098092a (int) : min=0 max=65535 step=1 default=32896 value=32896 - - # ~ Codec Controls - - # ~ video_bitrate_mode 0x009909ce (menu) : min=0 max=1 default=0 value=0 flags=update - # ~ video_bitrate 0x009909cf (int) : min=25000 max=25000000 step=25000 default=10000000 value=25000000 - # ~ repeat_sequence_header 0x009909e2 (bool) : default=0 value=0 - # ~ h264_i_frame_period 0x00990a66 (int) : min=0 max=2147483647 step=1 default=60 value=60 - # ~ h264_level 0x00990a67 (menu) : min=0 max=11 default=11 value=11 - # ~ h264_profile 0x00990a6b (menu) : min=0 max=4 default=4 value=4 - - # ~ Camera Controls - - # ~ auto_exposure 0x009a0901 (menu) : min=0 max=3 default=0 value=0 - # ~ exposure_time_absolute 0x009a0902 (int) : min=1 max=10000 step=1 default=1000 value=1000 - # ~ exposure_dynamic_framerate 0x009a0903 (bool) : default=0 value=0 - # ~ auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=2 - # ~ white_balance_auto_preset 0x009a0914 (menu) : min=0 max=9 default=1 value=1 - # ~ image_stabilization 0x009a0916 (bool) : default=0 value=0 - # ~ iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0 - # ~ iso_sensitivity_auto 0x009a0918 (menu) : min=0 max=1 default=1 value=1 - # ~ exposure_metering_mode 0x009a0919 (menu) : min=0 max=3 default=0 value=0 - # ~ scene_mode 0x009a091a (menu) : min=0 max=13 default=0 value=0 - - # ~ JPEG Compression Controls - # ~ compression_quality 0x009d0903 (int) : min=1 max=100 step=1 default=30 value=30 + if project_settings['cam_is_showmewebcam']: - # Make sure we're using max bitrate - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c video_bitrate=25000000') - # Flip auto-exposure, white-balance on and off to adapt to light environment - reset_wb_exp() - # Flip preview (0 = vert; 1 = hor) - if project_settings['vflip']: - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c vertical_flip=1') - else: - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c vertical_flip=0') - if project_settings['hflip']: - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c horizontal_flip=1') - else: - serialutils.send_serial_cmd(serialutils.find_cam_port(), 'v4l2-ctl -d /dev/video0 -c horizontal_flip=0') + # Apply config camera settings + camera_current_settings = apply_cam_setting(camera_current_settings) time.sleep(.5) + loop_delta = 0 while True: - print(first_playback) start = timer() if playback: if onionskin: @@ -542,6 +498,15 @@ def main(args): if (k%256 == 111) or (k%256 == 47): # Toggle onionskin onionskin = not onionskin + # Key w - cycle wb + if (k%256 == 119): + camera_current_settings = apply_cam_setting(camera_current_settings, ['white_balance_auto_preset']) + # Key x - cycle exposure + if (k%256 == 120): + camera_current_settings = apply_cam_setting(camera_current_settings, ['auto_exposure']) + # Key f - flip image + if (k%256 == 102): + camera_current_settings = apply_cam_setting(camera_current_settings, ['vertical_flip','horizontal_flip']) # Key up elif (k%256 == 82) or (k%256 == 56): if len(img_list): @@ -554,7 +519,6 @@ def main(args): if playback: playback = False index, frame = first_frame(index) - print(index) # Key left elif (k%256 == 81) or (k%256 == 52): # Displau previous frame @@ -562,6 +526,7 @@ def main(args): if playback: playback = False index, frame = previous_frame(index) + # Key right elif (k%256 == 83) or (k%256 == 54): # Displau next frame if len(img_list): @@ -570,7 +535,9 @@ def main(args): index, frame = next_frame(index) # Key r / keypad 9 - reset wb,exp elif (k%256 == 114) or (k%256 == 57): - reset_wb_exp() + print(_("Reset camera settings")) + camera_current_settings = apply_cam_setting(camera_current_settings) + # ~ reset_wb_exp() # Key e / keypad * elif (k%256 == 101) or (k%256 == 42): print(_("Export")) @@ -616,7 +583,6 @@ def main(args): print(k) # else print its value end = timer() loop_delta = end - start - print(loop_playback) if 'ffmpeg_process' in locals(): if ffmpeg_process.poll() is None: @@ -658,15 +624,13 @@ else: project_letter = 'A' img_list = get_frames_list(savepath) index = len(img_list)-1 -print(project_letter) # Export settings input_filename = "{folder}{sep}{letter}.%04d.{ext}".format(folder=savepath, sep=os.sep, letter=project_letter, ext=project_settings['file_extension']) -print(input_filename) input_options = ["image2", str(project_settings['framerate'])] # ~ output_filename = "{folder}{sep}{filename}.mp4".format(folder=projects_folder, sep=os.sep, filename=savepath.split(os.sep)[-1]) output_filename = "{filename}.mp4".format(filename=project_letter) -output_options = parse_export_options(project_settings['export_options'], project_settings['vflip'], project_settings['hflip'] ) +output_options = project_settings['export_options'] export_filename = os.path.join(savepath, output_filename) diff --git a/locales/en/LC_MESSAGES/template.mo b/locales/en/LC_MESSAGES/template.mo index 21f352654fc3b60a025b88a884ee3cbd0149cd26..9f2e039f71ba6c7dad3f1903b0947d20e58ba4cc 100644 GIT binary patch delta 78 zcmX@hbdG6)3ZuwGRWJKUSH~b-Uw>T}M+FamD_>9TD1Sd!E}z8W65WuZ#Ju91#FG3X iD+RYuA0GujM_*S38&_XPPag+I7ndN{;NXdC7XSc}r5Ei0 delta 77 zcmX@dbe3s?3Zw8uRWCau10xe%14~^)BLzbXD`Nv~10w?iE}z8W65WuZ#Ju91#FG3X cD}}_Ol8n+~1se$MkXVwMlbKpnJaOFu08We;_y7O^ diff --git a/locales/en/LC_MESSAGES/template.pot b/locales/en/LC_MESSAGES/template.pot index 5ba25f6..bc34b96 100644 --- a/locales/en/LC_MESSAGES/template.pot +++ b/locales/en/LC_MESSAGES/template.pot @@ -5,9 +5,9 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-09-12 18:30+0200\n" -"PO-Revision-Date: 2024-09-12 18:30+0200\n" -"Last-Translator: arthus \n" +"POT-Creation-Date: 2024-11-01 07:59+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,91 +15,104 @@ msgstr "" "Generated-By: pygettext.py 1.5\n" -#: ../frame_opencv.py:50 +#: ../frame_opencv.py:53 msgid "No configuration file found, using defaults." msgstr "" -#: ../frame_opencv.py:61 +#: ../frame_opencv.py:65 msgid "Found configuration file in {}" msgstr "" +#: ../frame_opencv.py:99 +msgid "Unknown setting!" +msgstr "" + #: ../frame_opencv.py:105 +msgid "Camera function not supported." +msgstr "" + +#: ../frame_opencv.py:144 msgid "Yes" msgstr "" -#: ../frame_opencv.py:119 +#: ../frame_opencv.py:158 msgid "No" msgstr "" -#: ../frame_opencv.py:195 +#: ../frame_opencv.py:234 msgid "" -"A previous session was found in\n {},\n" +"A previous session was found in\n" +" {},\n" " resume shooting ?" msgstr "" -#: ../frame_opencv.py:206 +#: ../frame_opencv.py:245 msgid "Using {} as session folder." msgstr "" -#: ../frame_opencv.py:322 +#: ../frame_opencv.py:355 msgid "{} does not exist" msgstr "" -#: ../frame_opencv.py:343 +#: ../frame_opencv.py:376 msgid "Removing {}" msgstr "" -#: ../frame_opencv.py:364 +#: ../frame_opencv.py:395 msgid "Warning: unable to open video source: {}" msgstr "" -#: ../frame_opencv.py:405 +#: ../frame_opencv.py:436 msgid "No camera device found. Exiting..." msgstr "" -#: ../frame_opencv.py:523 +#: ../frame_opencv.py:489 msgid "Failed to grab frame." msgstr "" -#: ../frame_opencv.py:566 +#: ../frame_opencv.py:538 +msgid "Reset camera settings" +msgstr "" + +#: ../frame_opencv.py:543 msgid "Export" msgstr "" -#: ../frame_opencv.py:570 +#: ../frame_opencv.py:547 msgid "Playback" msgstr "" -#: ../frame_opencv.py:577 +#: ../frame_opencv.py:554 msgid "Remove frame" msgstr "" -#: ../frame_opencv.py:582 +#: ../frame_opencv.py:559 msgid "Escape hit, exiting..." msgstr "" -#: ../frame_opencv.py:585 +#: ../frame_opencv.py:562 msgid "Ctrl-C hit, exiting..." msgstr "" -#: ../frame_opencv.py:588 +#: ../frame_opencv.py:565 msgid "Window was closed, exiting..." msgstr "" -#: ../frame_opencv.py:596 +#: ../frame_opencv.py:573 msgid "File {} written." msgstr "" -#: ../frame_opencv.py:613 ../frame_opencv.py:614 +#: ../frame_opencv.py:589 ../frame_opencv.py:590 msgid "" "Ffmpeg is still running.\n" " Waiting for task to complete." msgstr "" -#: ../frame_opencv.py:623 +#: ../frame_opencv.py:599 msgid "Terminating running process..." msgstr "" -#: ../frame_opencv.py:642 +#: ../frame_opencv.py:619 msgid "No images yet! Start shooting..." msgstr "" diff --git a/locales/fr/LC_MESSAGES/template.mo b/locales/fr/LC_MESSAGES/template.mo index 5d27091fc0fd698c80b6a6e4a73872f443f590bf..3da99759b04e3a690102c32e13d1f04108b3ff8a 100644 GIT binary patch delta 1320 zcmY+?PiS049KiAECTVP~N$r0%O=qLUlD12hr1%FR6p7W+7EHiDlq$3PCc6)I-@MMe zw@te&Ifys$;G_0d6)d>ou?H_X4e$`)Kc{ z2iJeyH+oYsG|!YgJCr&pR`|oXhtJ{<_!9n(hj3~{si$xr<^3$~#P@I#Kg5IRQ1*R{ zdvOD&@keCcy845O1o#_w;gM0LB=!u>;Bh>KZ=%K=pTN&?4}O79;&&*4zu$VlhZDU2 zf)el%K8KYtrC!5nJW70ZnF+Dgb(9SQd>TK&X}WP6tGsVe-Ua*(XYtgyQqSPKcpR^y zBz6n;@9q*t7et;6_1==Kuo=2(p zeUyY_l&k1(`58(gLzI0RC|COk&*0>4`Y(6B#6$u%P!3o{xvK%vfU*jBJS3=8B8SU9 z`3~f+<=UhWIfJID13WU0@<<#>nkJNk9OOFNWy>Ucu16i?k&j3QvCD4AT#`A=BljmQ z-yTP{Cn(>7+WoreT5ojXGQH~ZB+}07Mjo!$ia&R}y(fv{q@}aAw7xQ z@<*rpgW^hMec_zV%3oIFj^#J?R@bzwj)QJkSr|;uMmm$_>SDT}Wmza5R&LEM+mLsy z4mO0?C5vjs^khSSz{-`>mb;wpxNEiI>d4akiYphF!Gbp4mRSdz$>CYsYHypa+qFr= z&YtPywp!dDd43{1KB^tJ+QnZZmnQ1<({pt__sXmFmru^si*DA%cXO$x|Eac8W)|KI+YjCyork{~_0 zKlbgp<;`Jvgx~sCP8*u-*!uq(7EIo=E#o5sZSPfYY^|bk>XJ)}+vD@aaOc-&mu>1P zlpb`9h26u|M*`R<_FQX4H-X{v_TPAyOyE$zyP6+uYGxMC80Z}L7SWLmT6RwQ!6 z)=Fd&5)0d|x@BQAE7668ov$F4{%5do^UnR0@Gi!DILp_0Cl4kEbxl{vwXxHPm}C4&rm%gX_pA@0iAM6Axo5En-C4GR>mE!Fk+@ zmv9T-L`@LlZhVLb@dfGwyT~WsnTGHe9^jG1jL2E`(^-*2xPlY-47JW1)Vy7+P+xwq z80O$KzoP{%peAnP1g@bb?EKyT!~yoBd6Df{LVdtV)cX}IVT5ITg4)@)sChr3cIX@S zQNMS{x|d87{Ttc^ZLK~|JEQI2Nl;(55&eYzkq&*(j^673Nn2keXiBdr|0*(X8li30 zgCsKUb868oq{m#4zURg>kKKpNnZ1c$y?)!8I50uO`leaGVFMEdNm#RUrnTxWXZO4N z*~-Aoi6iA%Q$9X-v|O5*bsw`=a!aB0Yq#7&uH`m!cU_qG+^c+N>RjN\n" "Language-Team: LANGUAGE \n" -"Language: French\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -35,6 +35,7 @@ msgstr "Non" msgid "A previous session was found in\n {},\n resume shooting ?" msgstr "Une session précédente à été trouvée dans\n {},\n reprendre la session ?" + #: ../frame_opencv.py:206 msgid "Using {} as session folder." msgstr "Utilisation de {} comme dossier de session." @@ -49,11 +50,11 @@ msgstr "Suppression de {}" #: ../frame_opencv.py:384 msgid "Warning: unable to open video source: {}" -msgstr "Attention: périphérique vidéo introuvable : {}" +msgstr "" #: ../frame_opencv.py:425 msgid "No camera device found. Exiting..." -msgstr "Aucune caméra trouvée. Fermeture..." +msgstr "Attention: périphérique vidéo introuvable : {}" #: ../frame_opencv.py:542 msgid "Failed to grab frame." @@ -99,39 +100,40 @@ msgstr "Terminaison des processus en cours..." msgid "No images yet! Start shooting..." msgstr "Aucune image! Commencez à tourner..." -#~ msgid "Warning: Some settings are not set to the recommended value!" -#~ msgstr "Attention: certains paramètres ne sont pas optimaux!" -#~ msgid "" -#~ "\n" -#~ "Camera not found or busy." -#~ msgstr "" -#~ "\n" -#~ "Caméra introuvable ou occupée." +msgid "Warning: Some settings are not set to the recommended value!" +msgstr "Attention: certains paramètres ne sont pas optimaux!" -#~ msgid "Resume session?" -#~ msgstr "Reprendre la session ?" +msgid "" +"\n" +"Camera not found or busy." +msgstr "" +"\n" +"Caméra introuvable ou occupée." -#~ msgid "Image is being saved to {}" -#~ msgstr "Image sauvegardée dans {}" +msgid "Resume session?" +msgstr "Reprendre la session ?" -#~ msgid "speed too high" -#~ msgstr "Vitesse trop élevée." +msgid "Image is being saved to {}" +msgstr "Image sauvegardée dans {}" -#~ msgid "Speed too low." -#~ msgstr "Vitesse trop basse." +msgid "speed too high" +msgstr "Vitesse trop élevée." -#~ msgid "Saving {}{}" -#~ msgstr "Enregistrement de {}{}" +msgid "Speed too low." +msgstr "Vitesse trop basse." -#~ msgid "Getting file {}" -#~ msgstr "Récupération du fichier {}" +msgid "Saving {}{}" +msgstr "Enregistrement de {}{}" -#~ msgid "Ending thread" -#~ msgstr "Terminaison du processus." +msgid "Getting file {}" +msgstr "Récupération du fichier {}" -#~ msgid "Exporting to {}" -#~ msgstr "Exportation dans {}" +msgid "Ending thread" +msgstr "Terminaison du processus." -#~ msgid "Mp4 files" -#~ msgstr "Fichier Mp4" +msgid "Exporting to {}" +msgstr "Exportation dans {}" + +msgid "Mp4 files" +msgstr "Fichier Mp4" diff --git a/locales/fr/LC_MESSAGES/template.pot.bak b/locales/fr/LC_MESSAGES/template.pot.bak deleted file mode 100644 index 1fdce34..0000000 --- a/locales/fr/LC_MESSAGES/template.pot.bak +++ /dev/null @@ -1,100 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-02-18 11:30+0100\n" -"PO-Revision-Date: 2024-09-09 12:28+0200\n" -"Last-Translator: arthus \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" - -msgid "Yes" -msgstr "Oui" - -msgid "No" -msgstr "Non" - -#: ../main_c.py:96 -msgid "No configuration file found, using defaults." -msgstr "Aucun fichier de configuration trouvé, utilisation des valeurs par défaut." - -#: ../main_c.py:87 -msgid "Found configuration file in {}" -msgstr "Fichier de configuration trouvé dans {}" - -#: ../main_c.py:156 -msgid "No images yet! Start shooting..." -msgstr "Aucune image! Commencez à tourner..." - -#: ../main_c.py:144 -msgid "Warning: Some settings are not set to the recommended value!" -msgstr "Attention: certains paramètres ne sont pas optimaux!" - -#: ../main_c.py:146 -msgid "" -"\n" -"Camera not found or busy." -msgstr "\nCaméra introuvable ou occupée." - -#: ../main_c.py:256 -msgid "A previous session was found in {},\n resume shooting ?" -msgstr "Une session précédente à été trouvée dans {},\n reprendre la session ?" - -#: ../main_c.py:256 -msgid "Resume session?" -msgstr "Reprendre la session ?" - -#: ../main_c.py:263 -msgid "Using {} as session folder." -msgstr "Utilisation de {} comme dossier de session." - -#: ../main_c.py:281 -msgid "Image is being saved to {}" -msgstr "Image sauvegardée dans {}" - -#: ../main_c.py:320 -msgid "{} does not exist" -msgstr "{} n'existe pas." - -#: ../main_c.py:345 -msgid "Removing {}" -msgstr "Suppression de {}" - -#: ../main_c.py:563 -msgid "speed too high" -msgstr "Vitesse trop élevée." - -#: ../main_c.py:576 -msgid "Speed too low." -msgstr "Vitesse trop basse." - -#: ../main_c.py:604 -msgid "Saving {}{}" -msgstr "Enregistrement de {}{}" - -#: ../main_c.py:606 -msgid "Getting file {}" -msgstr "Récupération du fichier {}" - -#: ../main_c.py:621 -msgid "Ending thread" -msgstr "Terminaison du processus." - -#: ../main_c.py:650 -msgid "Exporting to {}" -msgstr "Exportation dans {}" - -msgid "Mp4 files" -msgstr "Fichier Mp4" - -msgid "Ffmpeg is still running.\n Waiting for task to complete." -msgstr "Ffmpeg est toujours en cours d'éxécution.\n Attente de la fin du processus.'" - -msgid "Terminating running process..." -msgstr "Terminaison des processus en cours..." diff --git a/locales/gen_mo.sh b/locales/gen_mo.sh index ae95543..6ff468c 100755 --- a/locales/gen_mo.sh +++ b/locales/gen_mo.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # /usr/lib/python3.11/Tools/i18n/pygettext.py -o template.pot ../app.py # +# /usr/lib/python3.12/Tools/i18n/pygettext.py -o template.pot ../frame_opencv.py +# msgmerge -N template.pot fr/LC_MESSAGES/template.pot -o new.pot # Change to script dir cd "$(dirname "$0")" for locale in */LC_MESSAGES/template.pot; do diff --git a/locales/template.pot b/locales/template.pot deleted file mode 100644 index ab3cfd9..0000000 --- a/locales/template.pot +++ /dev/null @@ -1,105 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-09-12 16:29+0200\n" -"PO-Revision-Date: 2024-09-12 17:55+0200\n" -"Last-Translator: arthus \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" - - -#: ../frame_opencv.py:50 -msgid "No configuration file found, using defaults." -msgstr "" - -#: ../frame_opencv.py:61 -msgid "Found configuration file in {}" -msgstr "" - -#: ../frame_opencv.py:105 -msgid "Yes" -msgstr "" - -#: ../frame_opencv.py:119 -msgid "No" -msgstr "" - -#: ../frame_opencv.py:195 -msgid "" -"A previous session was found in {},\n" -" resume shooting ?" -msgstr "" - -#: ../frame_opencv.py:206 -msgid "Using {} as session folder." -msgstr "" - -#: ../frame_opencv.py:322 -msgid "{} does not exist" -msgstr "" - -#: ../frame_opencv.py:343 -msgid "Removing {}" -msgstr "" - -#: ../frame_opencv.py:384 -msgid "Warning: unable to open video source: {}" -msgstr "" - -#: ../frame_opencv.py:425 -msgid "No camera device found. Exiting..." -msgstr "" - -#: ../frame_opencv.py:542 -msgid "Failed to grab frame." -msgstr "" - -#: ../frame_opencv.py:585 -msgid "Export" -msgstr "" - -#: ../frame_opencv.py:589 -msgid "Playback" -msgstr "" - -#: ../frame_opencv.py:596 -msgid "Remove frame" -msgstr "" - -#: ../frame_opencv.py:601 -msgid "Escape hit, exiting..." -msgstr "" - -#: ../frame_opencv.py:604 -msgid "Ctrl-C hit, exiting..." -msgstr "" - -#: ../frame_opencv.py:607 -msgid "Window was closed, exiting..." -msgstr "" - -#: ../frame_opencv.py:615 -msgid "File {} written." -msgstr "" - -#: ../frame_opencv.py:632 ../frame_opencv.py:633 -msgid "" -"Ffmpeg is still running.\n" -" Waiting for task to complete." -msgstr "" - -#: ../frame_opencv.py:642 -msgid "Terminating running process..." -msgstr "" - -#: ../frame_opencv.py:661 -msgid "No images yet! Start shooting..." -msgstr "" -