Merge lp:~shockone89/audience/fix-1163695 into lp:~audience-members/audience/trunk

Proposed by Volodymyr Shatsky
Status: Merged
Merged at revision: 258
Proposed branch: lp:~shockone89/audience/fix-1163695
Merge into: lp:~audience-members/audience/trunk
Diff against target: 132 lines (+48/-9)
5 files modified
Audience/Audience.vala (+36/-0)
Audience/Utils.vala (+8/-6)
Audience/Widgets/MediaSlider.vala (+1/-1)
Audience/Widgets/TagView.vala (+2/-2)
Audience/Widgets/VideoPlayer.vala (+1/-0)
To merge this branch: bzr merge lp:~shockone89/audience/fix-1163695
Reviewer Review Type Date Requested Status
Tom Beckmann Approve
Review via email: mp+157280@code.launchpad.net

Description of the change

MediaSlider now keeps the aspect ratio; Title isn't cut on the first dot and displays apostrophes correctly

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

replace ("%7D", "}").replace ("_", " ").replace ("."," ").

replace ("%7D", "}").replace ("_", " ").replace (".", " ").

replace (" "," ").replace ("%60", "\'");

replace (" ", " ").replace ("%60", "\'");

controls.slider.preview.width = (float)video_width / video_height * controls.slider.preview.height;

controls.slider.preview.width = (float) video_width / video_height * controls.slider.preview.height;

lp:~shockone89/audience/fix-1163695 updated
252. By Volodymyr Shatsky

Fixed formatting. Add audio and subtitles shortcuts

253. By Volodymyr Shatsky

Move debug information calls

Revision history for this message
Volodymyr Shatsky (shockone89) wrote :

Done.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Looks pretty awesome to me, good job!

For the aspect ratio in the preview, for 16:9 we now get a small overflow on the sides, but I suppose that doesn't really matter all that much.

Audio switching looks fine to me, you'd just have to update the currently set track in the UI too.

Text switching is a bit more problematical. Updating the UI is obviously required here as well, but the cycling should include turning off. You could fallback to the videoplayer's current-text property instead of the playbin's which is supposed to handle this by turning subtitles off when set to -1 (but that's still quite buggy for unknown reasons), so once we got it working there, the cycling will work fine too.

Looking at the get_basename function now, I wonder why I wrote it that complicated. If you want to invest some more time in it, you may want to consider using string.last_index_of instead of the loop. Otherwise it works fine with your fix and we'd revisit that later.

And on a last, small note, you got a typo at the preview width line ("priview").

Once you fixed those issues we can merge the branch, and that's why one usually creates a separate branch for each fix, so we can merge them sooner ;)

Revision history for this message
Tom Beckmann (tombeckmann) :
review: Needs Fixing
Revision history for this message
Cody Garver (codygarver) wrote :

It would be better if you submitted one branch per bug fix.

lp:~shockone89/audience/fix-1163695 updated
254. By Volodymyr Shatsky

Switching audio or subtitles from keyboard now changes the combobox in UI

Revision history for this message
Volodymyr Shatsky (shockone89) wrote :

Sorry about branches, I'm not very comfortable with bzr. Will do.

What is the cause of the overflow. Could we fix it casting the number to int?

In order to sync audio and subtitles switching, I had to make these fields in TagView public:
public Gtk.ComboBoxText languages;
public Gtk.ComboBoxText subtitles;
Yeah, dealing with disabled subtitles was a bit complicated, currently I'm getting the value directly from the combobox — the only way it works properly.

I tried to rewrite the utility methods with last_index_of_char, but it produced a lot of errors, so I changed it back.
https://dl.dropbox.com/u/608214/scrn/1365231619.png . I think it would be easy to fix adding some NULL checks, but it would became clumsy and not so much better than the old variant. Besides, for loop works faster ☺.

Do you receive a notification, when I push into this repo, or should I write a comment?

lp:~shockone89/audience/fix-1163695 updated
255. By Volodymyr Shatsky

Small formatting fix

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Looks good to me now from the code. I'll test it tomorrow, and I'll see if we can get this branch in first lp:~tombeckmann/audience/external-subtitles which possibly fixes subtitle switching, we're still testing on it.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Oh and for the notifications, we only receive emails when you comment on the merge request. For commits there'll be no message.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

I had two fixes two small conflicts, but now it looks like it's working perfectly. Well done!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Audience/Audience.vala'
2--- Audience/Audience.vala 2013-04-02 16:46:22 +0000
3+++ Audience/Audience.vala 2013-04-06 11:47:23 +0000
4@@ -248,6 +248,12 @@
5 case Gdk.Key.Right:
6 video_player.progress += 0.05;
7 break;
8+ case Gdk.Key.a:
9+ next_audio ();
10+ break;
11+ case Gdk.Key.s:
12+ next_text ();
13+ break;
14 default:
15 break;
16 }
17@@ -500,6 +506,36 @@
18 }
19 });
20 }
21+
22+ public void next_audio () {
23+ int n_audio;
24+ video_player.playbin.get ("n-audio", out n_audio);
25+ int current = video_player.current_audio;
26+
27+ if (n_audio > 1) {
28+ if (current < n_audio - 1) {
29+ current += 1;
30+ } else {
31+ current = 0;
32+ }
33+ }
34+ tagview.languages.active_id = current.to_string ();
35+ }
36+
37+ public void next_text () {
38+ int n_text;
39+ video_player.playbin.get ("n-text", out n_text);
40+ int current = int.parse (tagview.subtitles.active_id);
41+
42+ if (n_text > 1) {
43+ if (current < n_text - 1) {
44+ current += 1;
45+ } else {
46+ current = -1;
47+ }
48+ }
49+ tagview.subtitles.active_id = current.to_string ();
50+ }
51
52 private inline void save_last_played_videos () {
53 string res = "";
54
55=== modified file 'Audience/Utils.vala'
56--- Audience/Utils.vala 2013-04-01 01:21:39 +0000
57+++ Audience/Utils.vala 2013-04-06 11:47:23 +0000
58@@ -29,7 +29,8 @@
59 title = title.replace ("%20", " ").
60 replace ("%3B", ";").
61 replace ("%5B", "[").replace ("%5D", "]").replace ("%7B", "{").
62- replace ("%7D", "}").replace ("_", " ").replace ("."," ").replace (" "," ");
63+ replace ("%7D", "}").replace ("_", " ").replace (".", " ").
64+ replace (" ", " ").replace ("%60", "\'");
65 return title;
66 }
67
68@@ -37,18 +38,19 @@
69 int i=0;
70 for (i=filename.length;i!=0;i--) {
71 if (filename [i] == '.')
72- break;
73+ break;
74 }
75 return filename.substring (i+1);
76 }
77+
78 public static string get_basename (string filename) {
79 int start = 0, end = 0;
80 for (start=filename.length; start != 0; start--) {
81 if (filename[start] == '/') {
82- start ++;
83- break;
84- }
85- if (filename[start] == '.')
86+ start ++;
87+ break;
88+ }
89+ if (filename[start] == '.' && end == 0)
90 end = start;
91 }
92 return filename.substring (start, end - start);
93
94=== modified file 'Audience/Widgets/MediaSlider.vala'
95--- Audience/Widgets/MediaSlider.vala 2013-04-02 16:46:22 +0000
96+++ Audience/Widgets/MediaSlider.vala 2013-04-06 11:47:23 +0000
97@@ -43,7 +43,7 @@
98 preview.scale_y = 0.0;
99 preview.scale_gravity = Clutter.Gravity.CENTER;
100 preview.height = 90.0f;
101- preview.width = 120.0f;
102+ // preview.width is set in VideoPlayer.vala
103
104 // connect gstreamer stuff
105 #if HAS_CLUTTER_GST_1
106
107=== modified file 'Audience/Widgets/TagView.vala'
108--- Audience/Widgets/TagView.vala 2013-04-01 04:45:31 +0000
109+++ Audience/Widgets/TagView.vala 2013-04-06 11:47:23 +0000
110@@ -24,8 +24,8 @@
111 public Gtk.Grid taggrid;
112 public Audience.App app;
113
114- private Gtk.ComboBoxText languages;
115- private Gtk.ComboBoxText subtitles;
116+ public Gtk.ComboBoxText languages;
117+ public Gtk.ComboBoxText subtitles;
118
119 private Granite.Drawing.BufferSurface buffer;
120 int shadow_blur = 30;
121
122=== modified file 'Audience/Widgets/VideoPlayer.vala'
123--- Audience/Widgets/VideoPlayer.vala 2013-04-02 16:46:22 +0000
124+++ Audience/Widgets/VideoPlayer.vala 2013-04-06 11:47:23 +0000
125@@ -444,6 +444,7 @@
126 controls.content.invalidate ();
127
128 panel.x = get_stage ().width - panel.width - 10;
129+ controls.slider.preview.width = (float) video_width / video_height * controls.slider.preview.height;
130
131 return true;
132 }

Subscribers

People subscribed via source and target branches