Lua script to change file extension?

Started by ShittyWebsite, December 21, 2021, 01:23:16 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

ShittyWebsite

Hello, so, i have a little problem, a pin on my CF slot is gone, i was wondering, if i could copy files via USB (but i'm guessing it wont show any MLV) is i possible configure a lua script to bypass USB files and change all mlv to .mov? i would copy the files then change back to .mlv

Fixing the CF is not gonna be possible, no new parts where i live, i managed to run CF using a copper wire but removing the CF and the wire from the camera too many times files would be a problem

Walter Schulz

Can be done by LUA but I recommend replacing the CF-slot. It is available from various sites beginning at around 35 USD (without shipping).
There is are several replacement tutorials online including one from IFixedIt.

ShittyWebsite

I'm from brazil, i'm not sure if i can do it on my own, seems.. complicated..



I could not find a starting point in lua

kitor

Walter wrote about replacing whole PCB with CF slot, not the slot itself.

As for LUA, I never used it, but from what I see it uses `FIO_RenameFile` and `FIO_MoveFile`


/***
Renames/moves a file on the card (or between cards).
@tparam string filename
@treturn bool success
@function rename
*/
static int luaCB_dryos_rename(lua_State * L)
{
    LUA_PARAM_STRING(src, 1);
    LUA_PARAM_STRING(dst, 2);
    int err = FIO_RenameFile(src, dst);
    if (err)
    {
        err = FIO_MoveFile(src, dst);
    }
    lua_pushboolean(L, err == 0);
    return 1;
}


I guess `dryos_rename` is the function then? Of course needs to be combined with other functions (`dryos_directory` `directory_files` ? ) to iterate over files first and find files to rename.
Too many Canon cameras.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.

ShittyWebsite

Ooh i see, thank you, what i'm doing rn, i go to file manager and copy from card A to B card, so everything goes to the SD

Nice code, i will try

kitor

Code from above is C source from lua.mo, not the actual Lua script code. As stated before, I never used lua.mo nor written in Lua. Thus this part you need to solve yourself.
I only wrote that it should be possible with what I was able to find in module code.
Too many Canon cameras.
If you have a dead R, RP, 250D mainboard (e.g. after camera repair) and want to donate for experiments, I'll cover shipping costs.