MediaConvert: Added error messages
... when converted file cannot be writen to destination Signed-off-by: Adrien Destugues <[email protected]> Fixes #12334.
This commit is contained in:
committed by
Adrien Destugues
parent
ad7783e44d
commit
fdd3fd9e06
@@ -204,6 +204,18 @@ MediaConverterApp::_CreateOutputFile(BDirectory directory,
|
|||||||
|
|
||||||
name.Append(outputFormat->file_extension);
|
name.Append(outputFormat->file_extension);
|
||||||
|
|
||||||
|
BEntry directoryEntry;
|
||||||
|
directory.GetEntry(&directoryEntry);
|
||||||
|
if (!directoryEntry.Exists()) {
|
||||||
|
BAlert* alert = new BAlert(B_TRANSLATE("Error"),
|
||||||
|
B_TRANSLATE("Selected directory not found. "
|
||||||
|
"Defaulting to /boot/home"),
|
||||||
|
B_TRANSLATE("OK"));
|
||||||
|
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||||
|
alert->Go();
|
||||||
|
directory.SetTo("/boot/home");
|
||||||
|
}
|
||||||
|
|
||||||
BEntry inEntry(ref);
|
BEntry inEntry(ref);
|
||||||
BEntry outEntry;
|
BEntry outEntry;
|
||||||
|
|
||||||
@@ -318,6 +330,11 @@ MediaConverterApp::_RunConvert()
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
srcIndex++;
|
||||||
|
BString error(
|
||||||
|
B_TRANSLATE("Error converting '%filename'"));
|
||||||
|
error.ReplaceAll("%filename", inRef.name);
|
||||||
|
fWin->SetStatusMessage(error.String());
|
||||||
fWin->Unlock();
|
fWin->Unlock();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -391,6 +408,9 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
|||||||
B_TRANSLATE("Audio quality not supported"));
|
B_TRANSLATE("Audio quality not supported"));
|
||||||
fWin->Unlock();
|
fWin->Unlock();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fWin->SetStatusMessage(
|
||||||
|
B_TRANSLATE("Error creating track."));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (inFormat.IsVideo() && (videoCodec != NULL)) {
|
} else if (inFormat.IsVideo() && (videoCodec != NULL)) {
|
||||||
@@ -465,9 +485,14 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
|||||||
fWin->SetVideoQualityLabel(videoQualitySupport);
|
fWin->SetVideoQualityLabel(videoQualitySupport);
|
||||||
fWin->Unlock();
|
fWin->Unlock();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fWin->SetStatusMessage(
|
||||||
|
B_TRANSLATE("Error creating video."));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// didn't do anything with the track
|
// didn't do anything with the track
|
||||||
|
fWin->SetStatusMessage(
|
||||||
|
B_TRANSLATE("Input file not recognized as Audio or Video"));
|
||||||
inFile->ReleaseTrack(inTrack);
|
inFile->ReleaseTrack(inTrack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
@@ -1005,6 +1006,19 @@ MediaConverterWindow::_CreateMenu()
|
|||||||
void
|
void
|
||||||
MediaConverterWindow::_SetOutputFolder(BEntry entry)
|
MediaConverterWindow::_SetOutputFolder(BEntry entry)
|
||||||
{
|
{
|
||||||
fOutputDir.SetTo(&entry);
|
BPath path;
|
||||||
|
entry.GetPath(&path);
|
||||||
|
if (access(path.Path(), W_OK) != -1) {
|
||||||
|
fOutputDir.SetTo(&entry);
|
||||||
|
} else {
|
||||||
|
BString errorString(B_TRANSLATE("Error writing to location: %strPath%."
|
||||||
|
" Defaulting to location: /boot/home"));
|
||||||
|
errorString.ReplaceFirst("%strPath%", path.Path());
|
||||||
|
BAlert* alert = new BAlert(B_TRANSLATE("Error"),
|
||||||
|
errorString.String(), B_TRANSLATE("OK"));
|
||||||
|
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||||
|
alert->Go();
|
||||||
|
fOutputDir.SetTo("/boot/home");
|
||||||
|
}
|
||||||
TruncateOutputFolderPath();
|
TruncateOutputFolderPath();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user