Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing parentheses from clip name? #17

Open
apiszcz opened this issue May 3, 2023 · 10 comments
Open

Consider removing parentheses from clip name? #17

apiszcz opened this issue May 3, 2023 · 10 comments

Comments

@apiszcz
Copy link

apiszcz commented May 3, 2023

I set clean_file=no, however parens and spaces still appear

Eliminate spaces and parenthesis.

FROM
    filename = string.format(
            '%s (%s-%s)',
            filename,
            human_readable_time(main_menu.timings['start']),
            human_readable_time(main_menu.timings['end'])

TO
    filename = string.format(
            '%s_%s_%s',
            filename,
            human_readable_time(main_menu.timings['start']),
            human_readable_time(main_menu.timings['end'])
@apiszcz
Copy link
Author

apiszcz commented May 3, 2023

BTW fantastic effort, appreciate the utility.

@apiszcz
Copy link
Author

apiszcz commented May 3, 2023

I am finding certain filename (perhaps with strange characters (not sure which characters might be the problem) are causing the write to clip to fail:

        notify(string.format("Error: couldn't create the clip.\nDoes %s exist?", location), "error", 5)

@tatsumoto-ren
Copy link
Member

Eliminate spaces and parenthesis.
%s_%s_%s

Looks fine.

@tatsumoto-ren
Copy link
Member

certain filename are causing the write to clip to fail

any examples?

@apiszcz
Copy link
Author

apiszcz commented May 3, 2023

Working on understanding it. Some files work others don't, plan to report when I get time on this.

@apiszcz
Copy link
Author

apiszcz commented May 4, 2023

It may not be a filename issue, the error statement could be due to a general processing problem/error, what is the best way to find out the debug / errors from the follow (not a 'lua' expert)

I think i need to see the output of
local process_result = function(_, ret, _)

    if clip_type == 'video' then
        args = encoder.mkargs_video(clip_filename)
        location = config.video_folder_path
    else
        args = encoder.mkargs_audio(clip_filename)
        location = config.audio_folder_path
    end

    **local process_result = function(_, ret, _)**
        if ret.status ~= 0 or string.match(ret.stdout, "could not open") then
            notify(string.format("Error: couldn't create the clip.\nDoes %s exist?", location), "error", 5)
        else
            notify(string.format("Clip saved to %s.", location), "info", 2)
        end
    end

@tatsumoto-ren
Copy link
Member

The parameters the function takes are success, result, error. Try outputting them with print().

@apiszcz
Copy link
Author

apiszcz commented May 5, 2023

using notify(res.stdout) works, tried print not sure where output goes (did not see in console)

Error couldn't create the clip

Some files work and some don't so the output path is ok, speculating it is the encoder command failing. need to see that command line output

tried notify(args) after if clip_type == 'video'
however only Please wait... displays

progress on windows you have to use mpv.com NOT mpv.exe to see print/console output

created a hello-world.lua and it works fine printing to console, however videoclip.lua does not print
when I use notify lua error mp.defaults :568 is not a string

maybe this is related to the issue?
print(ret.error)
[videoclip] nil

the problem appears to be related to the files, videoclip is fine. However if there is a way to display the error or stack trace when the clip is not successful that would be useful. I'd like to be able to run the command line that videoclip generates but have not figure out how to display that at this time.

@tatsumoto-ren
Copy link
Member

tatsumoto-ren commented May 5, 2023

tried print not sure where output goes (did not see in console)

If you launch mpv from the terminal, it goes to the terminal. Otherwise you should see it if you press ~ while mpv is open.

you have to use mpv.com NOT mpv.exe to see print/console output

I didn't know about this. On GNU/Linux the executable is just mpv.

lua error mp.defaults :568 is not a string

try converting parameters with tostring()

@apiszcz
Copy link
Author

apiszcz commented May 6, 2023

mpv.com on windows displays to the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants