Merge lp:~e7appew/ubuntu/wily/bombono-dvd/mux-files-with-spaces-wily into lp:ubuntu/wily/bombono-dvd

Proposed by Carlos Maddela
Status: Needs review
Proposed branch: lp:~e7appew/ubuntu/wily/bombono-dvd/mux-files-with-spaces-wily
Merge into: lp:ubuntu/wily/bombono-dvd
Diff against target: 346 lines (+292/-2)
6 files modified
.pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp (+242/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+7/-0)
debian/patches/0002-Allow-muxing-of-files-with-spaces.patch (+39/-0)
debian/patches/series (+1/-0)
src/mgui/mux.cpp (+2/-2)
To merge this branch: bzr merge lp:~e7appew/ubuntu/wily/bombono-dvd/mux-files-with-spaces-wily
Reviewer Review Type Date Requested Status
Brian Murray Needs Fixing
Review via email: mp+279986@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

The patch's quoting of %2% is inconsistent, in one part it is bordered by \" and in another it isn't.

review: Needs Fixing
Revision history for this message
Carlos Maddela (e7appew) wrote :

It's been a while since I looked at this, but if I remember correctly,
when you quote %2% as well, all the rest of the arguments would be
treated as a single string, and the command fails.

On 08/06/16 04:51, Brian Murray wrote:
> Review: Needs Fixing
>
> The patch's quoting of %2% is inconsistent, in one part it is bordered by \" and in another it isn't.
>
> Diff comments:
>
>> === added file 'debian/patches/0002-Allow-muxing-of-files-with-spaces.patch'
>> --- debian/patches/0002-Allow-muxing-of-files-with-spaces.patch 1970-01-01 00:00:00 +0000
>> +++ debian/patches/0002-Allow-muxing-of-files-with-spaces.patch 2015-12-09 09:32:38 +0000
>> @@ -0,0 +1,39 @@
>> +From: Carlos Maddela <email address hidden>
>> +Date: Thu, 13 Aug 2015 15:05:04 +1000
>> +Subject: Allow muxing of files whose name or path contains spaces
>> +
>> +Description: Allow muxing of files whose name or path contains spaces.
>> + Arguments to mplex command should be quoted in case the files to be
>> + muxed have names or paths containing spaces.
>> +Author: Carlos Maddela <email address hidden>
>> +Origin: vendor
>> +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bombono-dvd/+bug/1484397
>> +Last-Update: 2015-12-09
>> +---
>> +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
>> +---
>> + src/mgui/mux.cpp | 4 ++--
>> + 1 file changed, 2 insertions(+), 2 deletions(-)
>> +
>> +diff --git a/src/mgui/mux.cpp b/src/mgui/mux.cpp
>> +index 427058e..cc4922b 100644
>> +--- a/src/mgui/mux.cpp
>> ++++ b/src/mgui/mux.cpp
>> +@@ -99,7 +99,7 @@ static bool RunMuxing(const std::string& dest_path, const std::string& args)
>> + ExitData ed;
>> + {
>> + Execution::Pulse pls(prg_bar);
>> +- std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;
>> ++ std::string cmd = boost::format("mplex -f 8 -o \"%1%\" %2%") % dest_path % args % bf::stop;
> Shouldn't %2% be treated the same way as %1% here?
>
>> + AppendCommandText(txt_view, cmd);
>> + ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
>> + }
>> +@@ -234,7 +234,7 @@ bool MuxStreams(std::string& dest_fname, const std::string& src_fname)
>> + if( res )
>> + {
>> + dlg.hide();
>> +- res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
>> ++ res = RunMuxing(dest_fname, boost::format("\"%1%\" \"%2%\"") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
>> + }
>> +
>> + return res;
>

Unmerged revisions

27. By Carlos Maddela

Merge branch 'mux-files-with-spaces-vivid' into mux-files-with-spaces-wily

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory '.pc/0002-Allow-muxing-of-files-with-spaces.patch'
=== added directory '.pc/0002-Allow-muxing-of-files-with-spaces.patch/src'
=== added directory '.pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui'
=== added file '.pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp'
--- .pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp 1970-01-01 00:00:00 +0000
+++ .pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp 2015-12-09 09:32:38 +0000
@@ -0,0 +1,242 @@
1//
2// mgui/mux.cpp
3// This file is part of Bombono DVD project.
4//
5// Copyright (c) 2010 Ilya Murav'jov
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20//
21
22#include <mgui/_pc_.h>
23
24#include "mux.h"
25#include "execution.h" // ExecuteAsync()
26
27#include <mgui/sdk/textview.h>
28#include <mgui/sdk/packing.h>
29#include <mgui/sdk/widget.h>
30
31#include <mgui/execution.h>
32#include <mgui/gettext.h>
33#include <mgui/dialog.h>
34
35#include <mlib/filesystem.h>
36
37#include <gtk/gtkwindow.h> // gtk_window_set_geometry_hints()
38
39static void OnNewText(Gtk::TextView& txt_view, const char* dat, int sz, bool is_out,
40 const ReadReadyFnr& add_fnr, const std::string& prefix)
41{
42 AppendNewText(txt_view, prefix + std::string(dat, sz), is_out);
43 if( add_fnr )
44 add_fnr(dat, sz, is_out);
45}
46
47ReadReadyFnr TextViewAppender(Gtk::TextView& txt_view, const ReadReadyFnr& add_fnr,
48 const std::string& prefix)
49{
50 return bb::bind(&OnNewText, boost::ref(txt_view), _1, _2, _3, add_fnr, prefix);
51}
52
53static void OnResponse(Execution::Data& edat, int resp)
54{
55 if( resp == Gtk::RESPONSE_CANCEL)
56 {
57 // повтороне нажатие - закрытие диалога
58 if( !edat.userAbort )
59 edat.StopExecution(_("muxing"));
60 }
61}
62
63void SetDialogStrict(Gtk::Dialog& dlg, int min_wdh, int min_hgt, bool set_resizable)
64{
65 dlg.set_resizable(set_resizable); // чтоб при закрытии экспандера диалог уменьшался
66 // размер окна пошире
67 GdkGeometry geom;
68 geom.min_width = min_wdh;
69 geom.min_height = min_hgt;
70 gtk_window_set_geometry_hints(static_cast<Gtk::Window&>(dlg).gobj(), 0, &geom, GDK_HINT_MIN_SIZE);
71}
72
73static bool RunMuxing(const std::string& dest_path, const std::string& args)
74{
75 Gtk::Dialog dlg(BF_("Muxing \"%1%\"") % fs::name_str(dest_path) % bf::stop);
76 SetDialogStrict(dlg, 400, -1);
77
78 Gtk::TextView& txt_view = NewManaged<Gtk::TextView>();
79 Execution::Data edat;
80 Gtk::ProgressBar& prg_bar = NewManaged<Gtk::ProgressBar>();
81
82 {
83 Gtk::VBox& box = *dlg.get_vbox();
84 PackStart(box, prg_bar);
85
86 Gtk::Expander& expdr = PackStart(box, NewManaged<Gtk::Expander>(_("Show/_hide Details"), true));
87 txt_view.set_editable(false);
88 txt_view.set_size_request(0, 200);
89 expdr.add(PackDetails(txt_view));
90
91 dlg.get_action_area()->set_layout(Gtk::BUTTONBOX_CENTER);
92 dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
93 dlg.signal_response().connect(bb::bind(&OnResponse, boost::ref(edat), _1));
94
95 dlg.show_all();
96 }
97
98 //dlg.run();
99 ExitData ed;
100 {
101 Execution::Pulse pls(prg_bar);
102 std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;
103 AppendCommandText(txt_view, cmd);
104 ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
105 }
106
107 if( !ed.IsGood() && !edat.userAbort )
108 {
109 MessageBox(_("Muxing error"), Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
110 BF_("The reason is \"%1%\" (see Details)") % ExitDescription(ed) % bf::stop);
111 dlg.run();
112 }
113 return ed.IsGood();
114}
115
116struct SaveChooser: public Gtk::Table
117{
118 Gtk::Entry& ent;
119 Gtk::FileChooserButton& fcb;
120
121 SaveChooser(const char* type);
122};
123
124SaveChooser::SaveChooser(const char* type):
125 ent(NewManaged<Gtk::Entry>()),
126 fcb(NewManaged<Gtk::FileChooserButton>(_("Select a folder"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER))
127{
128 // вариант с виджетом - слишком большой, хоть и более функциональный
129 //Gtk::FileChooserWidget& fcw = NewManaged<Gtk::FileChooserWidget>(Gtk::FILE_CHOOSER_ACTION_SAVE);
130 //Gtk::Frame& frm = PackStart(vbox, NewManagedFrame(Gtk::SHADOW_ETCHED_IN, " Output: "), Gtk::PACK_EXPAND_WIDGET);
131 //Add(Add(frm, NewPaddingAlg(0, 5, 5, 5)), fcw);
132
133 set_col_spacings(5);
134 Gtk::Label& o_lbl = NewManaged<Gtk::Label>(type);
135 SetAlign(o_lbl, true);
136 attach(o_lbl, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL);
137 attach(ent, 1, 2, 0, 1);
138 Gtk::Label& i_lbl = NewManaged<Gtk::Label>(_("in"));
139 SetAlign(i_lbl, false);
140 attach(i_lbl, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL);
141 attach(fcb, 1, 2, 1, 2);
142}
143
144fs::path GetFilename(Gtk::FileChooser& fc)
145{
146 // fs::path v3 не понимает ustring
147 // однако в gtkmm >= будет возвращать std::string, и это не понадобится
148 return fs::path(fc.get_filename().raw());
149}
150
151std::string GetFilename(SaveChooser& sc)
152{
153 std::string fname = sc.ent.get_text();
154 if( !fname.empty() )
155 fname = (GetFilename(sc.fcb)/fname).string();
156
157 return fname;
158}
159
160static void OnVideoSelected(Gtk::FileChooserButton& v_btn, Gtk::FileChooserButton& a_btn, SaveChooser& sc)
161{
162 fs::path pth = GetFilename(v_btn);
163 if( pth.empty() )
164 return;
165 std::string folder = pth.branch_path().string();
166
167 if( a_btn.get_filename().empty() )
168 a_btn.set_current_folder(folder);
169
170 if( GetFilename(sc).empty() )
171 {
172 sc.fcb.set_current_folder(folder);
173 sc.ent.set_text(get_basename(pth) + ".mpg");
174 }
175}
176
177bool MuxStreams(std::string& dest_fname, const std::string& src_fname)
178{
179 Gtk::Dialog dlg(_("Mux streams"));
180 SetDialogStrict(dlg, 400, -1);
181 SaveChooser& sc = NewManaged<SaveChooser>(SMCLN_("Output"));
182 Gtk::FileChooserButton& v_btn = NewManaged<Gtk::FileChooserButton>(_("Select elementary video"), Gtk::FILE_CHOOSER_ACTION_OPEN);
183 Gtk::FileChooserButton& a_btn = NewManaged<Gtk::FileChooserButton>(_("Select audio"), Gtk::FILE_CHOOSER_ACTION_OPEN);
184 {
185 DialogVBox& vbox = AddHIGedVBox(dlg);
186
187 AppendWithLabel(vbox, v_btn, SMCLN_("Video"));
188 {
189 Gtk::FileFilter f;
190 f.set_name(_("MPEG2 elementary video (m2v)"));
191 f.add_pattern("*.m2v");
192 v_btn.add_filter(f);
193 }
194
195 AppendWithLabel(vbox, a_btn, SMCLN_("Audio"));
196 {
197 Gtk::FileFilter f;
198 f.set_name(_("Audio for DVD") + std::string(" (mp2/mpa, ac3, dts or 16bit lpcm)"));
199 FillSoundFilter(f);
200 a_btn.add_filter(f);
201 }
202
203 PackStart(vbox, sc);
204
205 CompleteDialog(dlg);
206 }
207
208 v_btn.signal_selection_changed().connect(bb::bind(&OnVideoSelected, boost::ref(v_btn), boost::ref(a_btn), boost::ref(sc)));
209 if( !src_fname.empty() )
210 {
211 if( get_extension(src_fname) == "m2v" )
212 v_btn.set_filename(src_fname);
213 else
214 a_btn.set_filename(src_fname);
215 }
216
217 bool res = false;
218 for( ; res = Gtk::RESPONSE_OK == dlg.run(), res; )
219 {
220 dest_fname = GetFilename(sc);
221
222 if( v_btn.get_filename().empty() )
223 ErrorBox(_("Elementary video file is not selected."));
224 else if( a_btn.get_filename().empty() )
225 ErrorBox(_("Audio file is not selected."));
226 else if( dest_fname.empty() )
227 ErrorBox(_("Output file name is empty."));
228 else if( CheckKeepOrigin(dest_fname) )
229 ;
230 else
231 break;
232 }
233
234 if( res )
235 {
236 dlg.hide();
237 res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
238 }
239
240 return res;
241}
242
0243
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2015-08-12 12:16:58 +0000
+++ .pc/applied-patches 2015-12-09 09:32:38 +0000
@@ -1,2 +1,3 @@
10001-ffmpeg-has-renamed-CodecID-AVCodecID.patch10001-ffmpeg-has-renamed-CodecID-AVCodecID.patch
20002-Allow-muxing-of-files-with-spaces.patch
21000-ubuntu-stop-using-ffmpeg-AVFormatContext-data_offset-now-private.patch31000-ubuntu-stop-using-ffmpeg-AVFormatContext-data_offset-now-private.patch
34
=== modified file 'debian/changelog'
--- debian/changelog 2015-09-07 08:27:53 +0000
+++ debian/changelog 2015-12-09 09:32:38 +0000
@@ -1,3 +1,10 @@
1bombono-dvd (1.2.2-0ubuntu9) wily; urgency=medium
2
3 * Allow muxing of files whose name or path contains spaces
4 (LP: #1484397).
5
6 -- Carlos Maddela <maddela@labyrinth.net.au> Wed, 09 Dec 2015 15:08:55 +1000
7
1bombono-dvd (1.2.2-0ubuntu8) wily; urgency=medium8bombono-dvd (1.2.2-0ubuntu8) wily; urgency=medium
29
3 * No-change rebuild for libxml++ soname change.10 * No-change rebuild for libxml++ soname change.
411
=== added file 'debian/patches/0002-Allow-muxing-of-files-with-spaces.patch'
--- debian/patches/0002-Allow-muxing-of-files-with-spaces.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/0002-Allow-muxing-of-files-with-spaces.patch 2015-12-09 09:32:38 +0000
@@ -0,0 +1,39 @@
1From: Carlos Maddela <maddela@labyrinth.net.au>
2Date: Thu, 13 Aug 2015 15:05:04 +1000
3Subject: Allow muxing of files whose name or path contains spaces
4
5Description: Allow muxing of files whose name or path contains spaces.
6 Arguments to mplex command should be quoted in case the files to be
7 muxed have names or paths containing spaces.
8Author: Carlos Maddela <maddela@labyrinth.net.au>
9Origin: vendor
10Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bombono-dvd/+bug/1484397
11Last-Update: 2015-12-09
12---
13This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
14---
15 src/mgui/mux.cpp | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/mgui/mux.cpp b/src/mgui/mux.cpp
19index 427058e..cc4922b 100644
20--- a/src/mgui/mux.cpp
21+++ b/src/mgui/mux.cpp
22@@ -99,7 +99,7 @@ static bool RunMuxing(const std::string& dest_path, const std::string& args)
23 ExitData ed;
24 {
25 Execution::Pulse pls(prg_bar);
26- std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;
27+ std::string cmd = boost::format("mplex -f 8 -o \"%1%\" %2%") % dest_path % args % bf::stop;
28 AppendCommandText(txt_view, cmd);
29 ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
30 }
31@@ -234,7 +234,7 @@ bool MuxStreams(std::string& dest_fname, const std::string& src_fname)
32 if( res )
33 {
34 dlg.hide();
35- res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
36+ res = RunMuxing(dest_fname, boost::format("\"%1%\" \"%2%\"") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
37 }
38
39 return res;
040
=== modified file 'debian/patches/series'
--- debian/patches/series 2015-08-12 12:16:58 +0000
+++ debian/patches/series 2015-12-09 09:32:38 +0000
@@ -1,2 +1,3 @@
10001-ffmpeg-has-renamed-CodecID-AVCodecID.patch10001-ffmpeg-has-renamed-CodecID-AVCodecID.patch
20002-Allow-muxing-of-files-with-spaces.patch
21000-ubuntu-stop-using-ffmpeg-AVFormatContext-data_offset-now-private.patch31000-ubuntu-stop-using-ffmpeg-AVFormatContext-data_offset-now-private.patch
34
=== modified file 'src/mgui/mux.cpp'
--- src/mgui/mux.cpp 2013-11-07 19:03:05 +0000
+++ src/mgui/mux.cpp 2015-12-09 09:32:38 +0000
@@ -99,7 +99,7 @@
99 ExitData ed;99 ExitData ed;
100 {100 {
101 Execution::Pulse pls(prg_bar);101 Execution::Pulse pls(prg_bar);
102 std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;102 std::string cmd = boost::format("mplex -f 8 -o \"%1%\" %2%") % dest_path % args % bf::stop;
103 AppendCommandText(txt_view, cmd);103 AppendCommandText(txt_view, cmd);
104 ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);104 ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
105 }105 }
@@ -234,7 +234,7 @@
234 if( res )234 if( res )
235 {235 {
236 dlg.hide();236 dlg.hide();
237 res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );237 res = RunMuxing(dest_fname, boost::format("\"%1%\" \"%2%\"") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
238 }238 }
239239
240 return res;240 return res;

Subscribers

People subscribed via source and target branches