Skip to content

Commit 3f94c32

Browse files
authored
Fixed Issue robertsanseries#146
Fixed Issue robertsanseries#146 with an ugly way. P.S. I'm not a vala programmer, so, the fix might be really ugly. Fixed time and bitrate display a little bit. If there is a N/A in time or bitrate, it will display as "N/A".
1 parent 31ae620 commit 3f94c32

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/Controllers/ConverterController.vala

+16-7
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,9 @@ namespace Ciano.Controllers {
142142
SList<string> uris = chooser_file.get_filenames ();
143143

144144
foreach (unowned string uri in uris) {
145-
146-
var file = File.new_for_uri (uri);
147-
int index = file.get_basename ().last_index_of("/");
148-
string name = file.get_basename ().substring(index + 1, -1);
149-
string directory = file.get_basename ().substring(0, index + 1);
150-
145+
int index = uri.last_index_of("/");
146+
string name = Path.get_basename (uri);
147+
string directory = Path.get_dirname (uri)+"/";
151148
list_store.append (out iter);
152149
list_store.set (iter, 0, name, 1, directory);
153150
tree_view.expand_all ();
@@ -487,6 +484,13 @@ namespace Ciano.Controllers {
487484
if (str_return.contains ("time=") && str_return.contains ("size=") && str_return.contains ("bitrate=") ) {
488485
int index_time = str_return.index_of ("time=");
489486
time = str_return.substring ( index_time + 5, 11);
487+
string time_to_display = time;
488+
489+
// This is really an ugly fix...
490+
if (time.contains("N/A")) {
491+
time="00:00:00.00";
492+
time_to_display = "N/A";
493+
}
490494

491495
int loading = TimeUtil.duration_in_seconds (time);
492496
double progress = (100 * loading) / total;
@@ -498,7 +502,12 @@ namespace Ciano.Controllers {
498502
int index_bitrate = str_return.index_of ("bitrate=");
499503
bitrate = str_return.substring ( index_bitrate + 8, 11);
500504

501-
row.status.label = Properties.TEXT_PERCENTAGE + progress.to_string() + "%" + Properties.TEXT_SIZE_CUSTOM + size.strip () + Properties.TEXT_TIME_CUSTOM + time.strip () + Properties.TEXT_BITRATE_CUSTOM + bitrate.strip ();
505+
// Another ugly fix...
506+
if (bitrate.contains("N/A")) {
507+
bitrate="N/A";
508+
}
509+
510+
row.status.label = Properties.TEXT_PERCENTAGE + progress.to_string() + "%" + Properties.TEXT_SIZE_CUSTOM + size.strip () + Properties.TEXT_TIME_CUSTOM + time_to_display.strip () + Properties.TEXT_BITRATE_CUSTOM + bitrate.strip ();
502511
}
503512

504513
if (str_return.contains ("No such file or directory")) {

0 commit comments

Comments
 (0)