hi, i modified a script that process media pool files, to replace original with proxy files for better editing.
it look for files with same name but different extensions to replace in the media pool. worked fine in v12. now in v13, it crashes vegas.
to test just need a file and another file with same name on a "Proxy" subfolder.
the crash happens at "mediaEnum.moveNext();", but i cant figure it out why...
any help appreciated
it look for files with same name but different extensions to replace in the media pool. worked fine in v12. now in v13, it crashes vegas.
to test just need a file and another file with same name on a "Proxy" subfolder.
the crash happens at "mediaEnum.moveNext();", but i cant figure it out why...
any help appreciated
import System.Windows.Forms;
import Sony.Vegas;
import System.IO;
var clipNumber = 0;
try {
var mediaEnum = new Enumerator(Vegas.Project.MediaPool);
while (!mediaEnum.atEnd())
{
var media = mediaEnum.item();
var replaceFilePath = Path.GetDirectoryName(media.FilePath);
if (Directory.Exists(replaceFilePath + "\\Proxy"))
{
var replaceFileName = Path.GetFileNameWithoutExtension(media.FilePath);
var proxyFinder = (replaceFilePath + "\\Proxy\\" + replaceFileName)
if (File.Exists(proxyFinder + ".avi"))
{
var originalExtension = ".avi";
}
if (File.Exists(proxyFinder + ".mov"))
{
var originalExtension = ".mov";
}
if (File.Exists(proxyFinder + ".mp4"))
{
var originalExtension = ".mp4";
}
if (File.Exists(proxyFinder + ".mxf"))
{
var originalExtension = ".mxf";
}
if (File.Exists(proxyFinder + ".m2t"))
{
var originalExtension = ".m2t";
}
if (File.Exists(proxyFinder + ".mts"))
{
var originalExtension = ".mts";
}
if (File.Exists(proxyFinder + ".m2ts"))
{
var originalExtension = ".m2ts";
}
if (File.Exists(proxyFinder + ".ts"))
{
var originalExtension = ".ts";
}
if (File.Exists(proxyFinder + ".mpg"))
{
var originalExtension = ".mpg";
}
var newFileName = (proxyFinder + originalExtension);
var replaced = media.FilePath.Replace(media.FilePath, newFileName);
var newMedia = new Media(replaced);
media.ReplaceWith(newMedia);
clipNumber++;
}
mediaEnum.moveNext();
}
}
catch (e)
{
MessageBox.Show(e);
}
if (!clipNumber == 0) Vegas.Project.MediaPool.RemoveUnusedMedia();
if (!clipNumber == 0) Vegas.UpdateUI();
if (!clipNumber == 0) MessageBox.Show(" Eventos alterados para Proxy: " + clipNumber);