Multi Commander > Script
Copy and convert audio. Can I do this as a script?
force_redo:
Hi,
I have a little problem that I hope the Multi Commander scripting could help me with but I'm not much of a programmer. I was hoping someone here could help me with this.
- I have an old mp3 player that really only plays mp3 files, no other formats.
- I regularly download podcasts, but not all of them come as mp3 format. Some are m4a etc.
So, what I would like to do is to have a script that copies all files (recursively) from one place to another as long as they're mp3s. If they're not, it should convert it to mp3 and then copy it. (e.g. via lame with some standard settings)
In other words the resulting file/folder structure should look like the source, only that all files are mp3 files.
Is this possible with scripting?
Thanks a lot in advance!
FR
Mathias (Author):
It might be possible with script.
From script you can get list of files, build command line commands and execute them, Start copy operations.
Reset:
I know it's an old post but maybe it will help someone else ;-)
It is possible by means of ffmpeg. https://www.ffmpeg.org/download.html
Here is a small script which converts a file from any format supported by ffmpeg from the active window to mp3 and places it in the inactivated window.
You just have to install a loop counter ;-)
--- Code: ---@var $SourceFile = GetSourceFocusPath();
@var $TargetFile = GetTargetFocusPath();
@var $path = PathGetPathPart($TargetFile);
@var $name = PathGetNamePart($SourceFile, 1);
@var $s =' -i ' + '"' + $SourceFile + '" ' + '"' + $path + $name + '.mp3"';
MC.Run CMD="C:\ffmpeg\bin\ffmpeg.exe" ARG="{$s}"
--- End code ---
Gruß
force_redo:
Hi Reset,
it was an old post, but I hadn't solved it myself yet. With your help and a bit of copy & paste I came up with this now, which does the trick for the selected files in the current directory. No idea how this would work with recursive subdirectories, but this does the trick for now:
--- Code: newbielink:javascript:void(0); [nonactive] ---@var $arr = GetSourceSelectedPaths();
@var $items = arrayCount($arr);
@var $path = GetTargetPath();
@var $SourceFile
@var $s
@var $name
@var $n = 0;
//loop
for( $n = 0; $n < $items; $n++ )
{
$SourceFile = $arr[ $n ];
$name = PathGetNamePart($SourceFile, 1);
$s =' -i ' + '"' + $SourceFile + '" ' + '-map a "' + $path + $name + '.mp3"';
MC.Run CMD="C:\Program Files\ffmpeg\bin\ffmpeg.exe" ARG="{$s}"
}
--- End code ---
P.S.: What is the difference between GetSelectedPaths and GetSourceSelectedPaths? The documentation says:
"An array of the complete paths for all the selected files and folders in the source view" for one
and
"Get an array with the full paths of all selected items in the source view" for the other.
Thanks again!
Reset:
You can speed up the Process, if you add the "-threads x" (where x is the Number of your CPU-Cores) to the ffmpeg Command.
Gruß
Navigation
[0] Message Index
[#] Next page
Go to full version