Merge lp:~luismmontielg/do-plugins/YouTube into lp:do-plugins

Proposed by Luis Montiel
Status: Merged
Merged at revision: 717
Proposed branch: lp:~luismmontielg/do-plugins/YouTube
Merge into: lp:do-plugins
Diff against target: 699 lines (+335/-121)
13 files modified
.bzrignore (+2/-0)
YouTube/Makefile.am (+2/-1)
YouTube/Resources/Youtube.addin.xml.in (+5/-5)
YouTube/src/CertHandler.cs (+37/-0)
YouTube/src/Preferences.cs (+21/-1)
YouTube/src/YouTubeFavoriteItemSource.cs (+21/-1)
YouTube/src/YouTubeOwnVideosItemSource.cs (+20/-6)
YouTube/src/YouTubeSearchAction.cs (+22/-15)
YouTube/src/YouTubeSubscriptionItem.cs (+22/-1)
YouTube/src/YouTubeSubscriptionItemSource.cs (+22/-1)
YouTube/src/Youtube.cs (+119/-87)
YouTube/src/YoutubeConfig.cs (+21/-1)
YouTube/src/YoutubeVideoItem.cs (+21/-2)
To merge this branch: bzr merge lp:~luismmontielg/do-plugins/YouTube
Reviewer Review Type Date Requested Status
Do Plugins Team Pending
Review via email: mp+24958@code.launchpad.net

Description of the change

Fixed plugin, is working now, also changed namespace

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-05-08 01:02:38 +0000
3+++ .bzrignore 2010-05-09 17:35:41 +0000
4@@ -1,1 +1,3 @@
5 Emesene.addin.xml
6+.bzrignore
7+../Resources/Youtube.addin.xml
8
9=== modified file 'YouTube/Makefile.am'
10--- YouTube/Makefile.am 2009-06-22 04:05:16 +0000
11+++ YouTube/Makefile.am 2010-05-09 17:35:41 +0000
12@@ -13,7 +13,8 @@
13 src/YouTubeSearchAction.cs \
14 src/YouTubeSubscriptionItem.cs \
15 src/YouTubeSubscriptionItemSource.cs \
16- src/YoutubeVideoItem.cs
17+ src/YoutubeVideoItem.cs \
18+ src/CertHandler.cs
19
20 RESOURCES = \
21 Resources/Youtube.addin.xml \
22
23=== modified file 'YouTube/Resources/Youtube.addin.xml.in'
24--- YouTube/Resources/Youtube.addin.xml.in 2009-06-22 21:50:13 +0000
25+++ YouTube/Resources/Youtube.addin.xml.in 2010-05-09 17:35:41 +0000
26@@ -1,7 +1,7 @@
27 <Addin
28 id="YouTube"
29 namespace= "Do"
30- version="1.0"
31+ version="1.1"
32 name="YouTube"
33 description="Search your favorites, subscriptions, uploaded videos, and more."
34 author="Luis Miguel Montiel G"
35@@ -22,11 +22,11 @@
36 <!-- Extensions included in this assembly -->
37 <!-- Sources -->
38 <Extension path = "/Do/ItemSource">
39- <ItemSource type="Do.Universe.YouTubeFavoriteItemSource" />
40- <ItemSource type="Do.Universe.YouTubeSubscriptionItemSource" />
41- <ItemSource type="Do.Universe.YouTubeOwnVideosItemSource" />
42+ <ItemSource type="Youtube.YouTubeFavoriteItemSource" />
43+ <ItemSource type="Youtube.YouTubeSubscriptionItemSource" />
44+ <ItemSource type="Youtube.YouTubeOwnVideosItemSource" />
45 </Extension>
46 <Extension path = "/Do/Action">
47- <Action type="Do.Universe.YouTubeSearchAction" />
48+ <Action type="Youtube.YouTubeSearchAction" />
49 </Extension>
50 </Addin>
51
52=== added file 'YouTube/src/CertHandler.cs'
53--- YouTube/src/CertHandler.cs 1970-01-01 00:00:00 +0000
54+++ YouTube/src/CertHandler.cs 2010-05-09 17:35:41 +0000
55@@ -0,0 +1,37 @@
56+/* CertHandler.cs
57+ *
58+ * GNOME Do is the legal property of its developers. Please refer to the
59+ * COPYRIGHT file distributed with this
60+ * source distribution.
61+ *
62+ * This program is free software: you can redistribute it and/or modify
63+ * it under the terms of the GNU General Public License as published by
64+ * the Free Software Foundation, either version 3 of the License, or
65+ * (at your option) any later version.
66+ *
67+ * This program is distributed in the hope that it will be useful,
68+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
69+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70+ * GNU General Public License for more details.
71+ *
72+ * You should have received a copy of the GNU General Public License
73+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
74+ */
75+
76+using System;
77+using System.Net;
78+using System.Collections;
79+using System.Security.Cryptography.X509Certificates;
80+
81+namespace Youtube
82+{
83+
84+ public class CertHandler : ICertificatePolicy
85+ {
86+ public bool CheckValidationResult (ServicePoint sp, X509Certificate cert,
87+ WebRequest request, int error)
88+ {
89+ return true;
90+ }
91+ }
92+}
93
94=== modified file 'YouTube/src/Preferences.cs'
95--- YouTube/src/Preferences.cs 2009-06-22 04:05:16 +0000
96+++ YouTube/src/Preferences.cs 2010-05-09 17:35:41 +0000
97@@ -1,8 +1,28 @@
98+/* Preferences.cs
99+ *
100+ * GNOME Do is the legal property of its developers. Please refer to the
101+ * COPYRIGHT file distributed with this
102+ * source distribution.
103+ *
104+ * This program is free software: you can redistribute it and/or modify
105+ * it under the terms of the GNU General Public License as published by
106+ * the Free Software Foundation, either version 3 of the License, or
107+ * (at your option) any later version.
108+ *
109+ * This program is distributed in the hope that it will be useful,
110+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112+ * GNU General Public License for more details.
113+ *
114+ * You should have received a copy of the GNU General Public License
115+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
116+ */
117+
118 using System;
119 using Mono.Addins;
120 using Do.Platform;
121
122-namespace Do.Universe
123+namespace Youtube
124 {
125 public class YouTubePreferences
126 {
127
128=== modified file 'YouTube/src/YouTubeFavoriteItemSource.cs'
129--- YouTube/src/YouTubeFavoriteItemSource.cs 2009-06-22 04:05:16 +0000
130+++ YouTube/src/YouTubeFavoriteItemSource.cs 2010-05-09 17:35:41 +0000
131@@ -1,3 +1,23 @@
132+/* YouTubeFavoriteItemSource.cs
133+ *
134+ * GNOME Do is the legal property of its developers. Please refer to the
135+ * COPYRIGHT file distributed with this
136+ * source distribution.
137+ *
138+ * This program is free software: you can redistribute it and/or modify
139+ * it under the terms of the GNU General Public License as published by
140+ * the Free Software Foundation, either version 3 of the License, or
141+ * (at your option) any later version.
142+ *
143+ * This program is distributed in the hope that it will be useful,
144+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
145+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146+ * GNU General Public License for more details.
147+ *
148+ * You should have received a copy of the GNU General Public License
149+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
150+ */
151+
152 using System;
153 using System.Collections.Generic;
154 using Mono.Addins;
155@@ -6,7 +26,7 @@
156 using Do.Platform.Linux;
157 using System.Threading;
158
159-namespace Do.Universe
160+namespace Youtube
161 {
162 public class YouTubeFavoriteItemSource : ItemSource, IConfigurable
163 {
164
165=== modified file 'YouTube/src/YouTubeOwnVideosItemSource.cs'
166--- YouTube/src/YouTubeOwnVideosItemSource.cs 2009-06-22 04:05:16 +0000
167+++ YouTube/src/YouTubeOwnVideosItemSource.cs 2010-05-09 17:35:41 +0000
168@@ -1,8 +1,22 @@
169-// YouTubeOwnVideosSource.cs created with MonoDevelop
170-// User: luis at 08:50 p 10/09/2008
171-//
172-// To change standard headers go to Edit->Preferences->Coding->Standard Headers
173-//
174+/* YouTubeOwnVideosItemSource.cs
175+ *
176+ * GNOME Do is the legal property of its developers. Please refer to the
177+ * COPYRIGHT file distributed with this
178+ * source distribution.
179+ *
180+ * This program is free software: you can redistribute it and/or modify
181+ * it under the terms of the GNU General Public License as published by
182+ * the Free Software Foundation, either version 3 of the License, or
183+ * (at your option) any later version.
184+ *
185+ * This program is distributed in the hope that it will be useful,
186+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
187+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
188+ * GNU General Public License for more details.
189+ *
190+ * You should have received a copy of the GNU General Public License
191+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
192+ */
193
194 using System;
195 using System.Collections.Generic;
196@@ -10,7 +24,7 @@
197 using System.Threading;
198 using Do.Universe;
199
200-namespace Do.Universe
201+namespace Youtube
202 {
203
204
205
206=== modified file 'YouTube/src/YouTubeSearchAction.cs'
207--- YouTube/src/YouTubeSearchAction.cs 2009-02-01 20:19:36 +0000
208+++ YouTube/src/YouTubeSearchAction.cs 2010-05-09 17:35:41 +0000
209@@ -1,10 +1,30 @@
210+/* YouTubeSearchAction.cs
211+ *
212+ * GNOME Do is the legal property of its developers. Please refer to the
213+ * COPYRIGHT file distributed with this
214+ * source distribution.
215+ *
216+ * This program is free software: you can redistribute it and/or modify
217+ * it under the terms of the GNU General Public License as published by
218+ * the Free Software Foundation, either version 3 of the License, or
219+ * (at your option) any later version.
220+ *
221+ * This program is distributed in the hope that it will be useful,
222+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
223+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
224+ * GNU General Public License for more details.
225+ *
226+ * You should have received a copy of the GNU General Public License
227+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
228+ */
229+
230 using System;
231 using System.Collections.Generic;
232 using Do.Universe;
233 using Do.Platform;
234 using System.Linq;
235
236-namespace Do.Universe
237+namespace Youtube
238 {
239 public class YouTubeSearchAction : Act
240 {
241@@ -39,22 +59,9 @@
242
243 public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
244 {
245-
246- //string search = "";
247-
248-// foreach (Item item in items) {
249-// if (item is IUrlItem) {
250-// search = (item as IUrlItem).Url;
251-// } else if (item is ITextItem) {
252-// search = (item as ITextItem).Text;
253-// }
254-// search = search.Replace (" ", "%20");
255-// Services.Environment.OpenUrl(url+search);
256-// }
257-
258 string search = (items.First() as ITextItem).Text;
259 search = search.Replace (" ", "%20");
260- Services.Environment.OpenUrl(Youtube.searchUrl+search);
261+ Services.Environment.OpenUrl(String.Format(Youtube.searchUrl, search));
262 yield break;
263 }
264 }
265
266=== modified file 'YouTube/src/YouTubeSubscriptionItem.cs'
267--- YouTube/src/YouTubeSubscriptionItem.cs 2009-02-01 20:19:36 +0000
268+++ YouTube/src/YouTubeSubscriptionItem.cs 2010-05-09 17:35:41 +0000
269@@ -1,7 +1,28 @@
270+/* YouTubeSubscriptionItem.cs
271+ *
272+ * GNOME Do is the legal property of its developers. Please refer to the
273+ * COPYRIGHT file distributed with this
274+ * source distribution.
275+ *
276+ * This program is free software: you can redistribute it and/or modify
277+ * it under the terms of the GNU General Public License as published by
278+ * the Free Software Foundation, either version 3 of the License, or
279+ * (at your option) any later version.
280+ *
281+ * This program is distributed in the hope that it will be useful,
282+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
283+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
284+ * GNU General Public License for more details.
285+ *
286+ * You should have received a copy of the GNU General Public License
287+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
288+ */
289+
290+
291 using System;
292 using Do.Universe;
293
294-namespace Do.Universe
295+namespace Youtube
296 {
297 public class YouTubeSubscriptionItem : Item, IUrlItem
298 {
299
300=== modified file 'YouTube/src/YouTubeSubscriptionItemSource.cs'
301--- YouTube/src/YouTubeSubscriptionItemSource.cs 2009-06-22 04:05:16 +0000
302+++ YouTube/src/YouTubeSubscriptionItemSource.cs 2010-05-09 17:35:41 +0000
303@@ -1,10 +1,31 @@
304+/* YouTubeSubscriptionItemSource.cs
305+ *
306+ * GNOME Do is the legal property of its developers. Please refer to the
307+ * COPYRIGHT file distributed with this
308+ * source distribution.
309+ *
310+ * This program is free software: you can redistribute it and/or modify
311+ * it under the terms of the GNU General Public License as published by
312+ * the Free Software Foundation, either version 3 of the License, or
313+ * (at your option) any later version.
314+ *
315+ * This program is distributed in the hope that it will be useful,
316+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
317+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
318+ * GNU General Public License for more details.
319+ *
320+ * You should have received a copy of the GNU General Public License
321+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
322+ */
323+
324+
325 using System;
326 using System.Collections.Generic;
327 using Mono.Addins;
328 using System.Threading;
329 using Do.Universe;
330
331-namespace Do.Universe
332+namespace Youtube
333 {
334 public class YouTubeSubscriptionItemSource : ItemSource
335 {
336
337=== modified file 'YouTube/src/Youtube.cs'
338--- YouTube/src/Youtube.cs 2009-06-22 04:05:16 +0000
339+++ YouTube/src/Youtube.cs 2010-05-09 17:35:41 +0000
340@@ -1,3 +1,23 @@
341+/* Youtube.cs
342+ *
343+ * GNOME Do is the legal property of its developers. Please refer to the
344+ * COPYRIGHT file distributed with this
345+ * source distribution.
346+ *
347+ * This program is free software: you can redistribute it and/or modify
348+ * it under the terms of the GNU General Public License as published by
349+ * the Free Software Foundation, either version 3 of the License, or
350+ * (at your option) any later version.
351+ *
352+ * This program is distributed in the hope that it will be useful,
353+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
354+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
355+ * GNU General Public License for more details.
356+ *
357+ * You should have received a copy of the GNU General Public License
358+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
359+ */
360+
361 using System;
362 using System.IO;
363 using System.Net;
364@@ -10,119 +30,127 @@
365 using Google.GData.YouTube;
366 using Google.GData.Extensions.MediaRss;
367
368-namespace Do.Universe
369+namespace Youtube
370 {
371 public class Youtube
372 {
373
374 static readonly string ConnectionErrorMessage = AddinManager.CurrentLocalizer.GetString ("An error occurred connecting to YouTube, "
375 + "are your credentials valid?");
376-
377+
378 static readonly string MissingCredentialsMessage = AddinManager.CurrentLocalizer.GetString ("Missing login credentials. Please set "
379 + "login information in YouTube plugin configuration.");
380-
381- public const string appName = "luismmontielg-gnomeDoYoutubePlugin0.1";
382- public const string searchUrl = "http://www.youtube.com/results?search_query=";
383- public static string clientID = "ytapi-lmg-test-ojd8d285-0";
384- public static string developerKey = "AI39si5c61jYzQLvzEDjAnU1HOQIf-DzyzvIBXAkGJ82NlXoMg10RDW1sRz5Uyodv9_ETPzmJXdfFqVRNt51yGkkNo2YW0BdxQ";
385+
386+ private const string appName = "gnome-do-plugin";
387+ public const string searchUrl = "http://www.youtube.com/results?search_query={0}";
388+ private const string clientID = "gnome-do-client";
389+ private const string developerKey = "AI39si5utjLEVOmAty2JLxz8KlixVQkwbSsEZqUXVUV-hUK1zDctrUbujGL2kWJBs47a7CaO-LOf_FXUiyuvQ9j7pbq8YO9wsA";
390+
391 public static List<Item> favorites;
392 public static List<Item> subscriptions;
393 public static List<Item> own;
394+
395 private static YouTubeService service;
396 private static string username;
397 private static string password;
398+
399 private static int subUpdate;
400 private static int favUpdate;
401 private static int ownUpdate;
402-
403+
404+ private const string favoritesQueryTemplate = "http://gdata.youtube.com/feeds/api/users/default/favorites?start-index={0}&max-results={1}";
405+ private const string ownQueryTemplate = "http://gdata.youtube.com/feeds/api/users/default/uploads?start-index={0}&max-results={1}";
406+ private const string youtubeWatchUrlTemplate = "http://www.youtube.com/watch?v={0}";
407+
408 public static YouTubePreferences Preferences { get; private set; }
409-
410+
411 static Youtube()
412 {
413 Youtube.favorites = new List<Item>();
414 Youtube.own = new List<Item>();
415 Youtube.subscriptions = new List<Item>();
416+
417 Preferences = new YouTubePreferences ();
418+
419 subUpdate = 0;
420 favUpdate = 0;
421 ownUpdate = 0;
422+
423 username = Preferences.Username;
424 password = Preferences.Password;
425+
426 Connect (username, password);
427 }
428-
429+
430+ private static void parseFeed(YouTubeFeed feed, List<Item> videos)
431+ {
432+ string description = "";
433+ string url = null;
434+ foreach(YouTubeEntry entry in feed.Entries)
435+ {
436+ description = "";
437+ url = String.Format(youtubeWatchUrlTemplate, entry.VideoId);
438+ if (entry.Media.Description != null)
439+ {
440+ description = entry.Media.Description.Value;
441+ }
442+ YoutubeVideoItem video = new YoutubeVideoItem(entry.Title.Text, url, description);
443+ videos.Add(video);
444+ }
445+ }
446+
447+ private static void update(string queryTemplate, List<Item> videos, ref int counter, string category)
448+ {
449+ if (videos.Count != 0 || (counter % 20 != 0 && counter != 0))
450+ {
451+ counter = counter + 1;
452+ return;
453+ }
454+
455+ counter = counter + 1;
456+
457+ videos.Clear();
458+ int maxResults = 50;
459+ int startIndex = 1;
460+
461+ string feedUrl = String.Format(queryTemplate, startIndex, maxResults);
462+
463+ YouTubeQuery query = new YouTubeQuery(feedUrl);
464+ YouTubeFeed videoFeed = null;
465+
466+ try
467+ {
468+ videoFeed = service.Query(query);
469+ while(videoFeed.Entries.Count > 0)
470+ {
471+ parseFeed(videoFeed, videos);
472+
473+ startIndex += maxResults;
474+ feedUrl = String.Format(queryTemplate, startIndex, maxResults);
475+ query = new YouTubeQuery(feedUrl);
476+ videoFeed = service.Query(query);
477+ }
478+ startIndex = 1;
479+ Log<Youtube>.Debug("Finished updating {0} videos", category);
480+ }
481+ catch(Exception e)
482+ {
483+ Log<Youtube>.Error ("Error getting {0} videos - {1}", category, e.Message);
484+ Log<Youtube>.Debug (e.StackTrace);
485+ }
486+
487+ }
488+
489 public static void updateFavorites()
490 {
491- favUpdate++;
492- Log<Youtube>.Debug("Update favorites videos tries = {0} - favorite.Count : {1}", favUpdate, Youtube.favorites.Count);
493- if (Youtube.favorites.Count == 0 || favUpdate%20 == 0){
494- Youtube.favorites.Clear();
495- int maxResults = 50;
496- int startIndex = 1;
497-
498- string feedUrl = "http://gdata.youtube.com/feeds/api/users/"+ username +"/favorites?start-index="+ startIndex +"&max-results="+maxResults;
499- YouTubeQuery query = new YouTubeQuery(feedUrl);
500- Log<Youtube>.Debug("feedUrl for favorites videos: {0}", feedUrl);
501- try{
502- YouTubeFeed videoFeed = service.Query(query);
503- while(videoFeed.Entries.Count > 0){
504- foreach (YouTubeEntry entry in videoFeed.Entries)
505- {
506- //Log<Youtube>.Debug("Video #{0}, Title: {1}", ++i, entry.Title.Text);
507- string url = ("http://www.youtube.com/watch?v="+entry.VideoId);
508- //Log<Youtube>.Debug("Video url: {0}", url);
509- YoutubeVideoItem video = new YoutubeVideoItem(entry.Title.Text, url, entry.Media.Description.Value);
510- favorites.Add(video);
511- }
512- startIndex += maxResults;
513- feedUrl = "http://gdata.youtube.com/feeds/api/users/"+ username +"/favorites?start-index="+ startIndex +"&max-results="+maxResults;
514- query = new YouTubeQuery(feedUrl);
515- videoFeed = service.Query(query);
516- }
517- startIndex = 1;
518- Log<Youtube>.Debug("Finished updating favorite videos");
519- }catch(Exception e) {
520- Log<Youtube>.Error ("Error getting favorites videos - {0}", e.Message);
521- Log<Youtube>.Debug (e.StackTrace);
522- }
523- }
524+ update (favoritesQueryTemplate, Youtube.favorites, ref favUpdate, "favorites");
525 }
526-
527+
528 public static void updateOwn()
529 {
530- ownUpdate++;
531- Log<Youtube>.Debug("Update own videos tries = {0} - own.Count : {1}", ownUpdate, Youtube.own.Count);
532- if (Youtube.own.Count == 0 || ownUpdate%20 == 0){
533- Youtube.own.Clear();
534- int maxResults = 50;
535- int startIndex = 1;
536-
537- string feedUrl = "http://gdata.youtube.com/feeds/api/users/"+ username +"/uploads?start-index="+ startIndex +"&max-results="+maxResults;
538- YouTubeQuery query = new YouTubeQuery(feedUrl);
539- Log<Youtube>.Debug("feedUrl for own videos: {0}", feedUrl);
540- try{
541- YouTubeFeed videoFeed = service.Query(query);
542- while(videoFeed.Entries.Count > 0){
543- foreach (YouTubeEntry entry in videoFeed.Entries)
544- {
545- //Log<Youtube>.Debug("Video #{0}, Title(own video): {1}", ++i, entry.Title.Text);
546- string url = "http://www.youtube.com/watch?v="+entry.VideoId;
547- YoutubeVideoItem video = new YoutubeVideoItem(entry.Title.Text, url, entry.Media.Description.Value);
548- own.Add(video);
549- }
550- startIndex += maxResults;
551- feedUrl = "http://gdata.youtube.com/feeds/api/users/"+ username +"/uploads?start-index="+ startIndex +"&max-results="+maxResults;
552- query = new YouTubeQuery(feedUrl);
553- videoFeed = service.Query(query);
554- }
555- Log<Youtube>.Debug("Finished updating own videos");
556- }catch(Exception e) {
557- Log<Youtube>.Error ("Error getting own videos - {0}", e.Message);
558- Log<Youtube>.Debug (e.StackTrace);
559- }
560- }
561- }
562-
563+ update (ownQueryTemplate, Youtube.own, ref ownUpdate, "own youtube");
564+ }
565+
566 public static void updateSubscriptions()
567 {
568 subUpdate++;
569@@ -130,19 +158,19 @@
570 if (Youtube.subscriptions.Count == 0 || subUpdate%20==0){
571 Youtube.subscriptions.Clear();
572
573- string feedUrl = "http://gdata.youtube.com/feeds/api/users/"+ username +"/subscriptions";
574+ string feedUrl = "http://gdata.youtube.com/feeds/api/users/default/subscriptions";
575 YouTubeQuery query = new YouTubeQuery(feedUrl);
576 Log<Youtube>.Debug("feedUrl for subscriptions: {0}", feedUrl);
577+ SubscriptionFeed subFeed = null;
578+ string url = "http://www.youtube.com/user/{0}";
579 try
580 {
581- SubscriptionFeed subFeed = service.GetSubscriptions(query);
582+ subFeed = service.GetSubscriptions(query);
583 if(subFeed.Entries.Count > 0){
584 foreach (SubscriptionEntry entry in subFeed.Entries)
585 {
586- //Log<Youtube>.Debug("Subscriptions - {0}", ++i);
587- //Log<Youtube>.Debug("{0}", entry.Title.Text);
588- string url = "http://www.youtube.com/user/" + entry.UserName;
589- YouTubeSubscriptionItem subscription = new YouTubeSubscriptionItem(entry.UserName, url, entry.Title.Text);
590+ YouTubeSubscriptionItem subscription =
591+ new YouTubeSubscriptionItem(entry.UserName, String.Format(url, entry.UserName), entry.Title.Text);
592 Youtube.subscriptions.Add(subscription);
593 }
594 }
595@@ -150,12 +178,14 @@
596 }
597 catch(Exception e)
598 {
599- Log<Youtube>.Error ("Error getting subscriptions - {0}", e.Message);
600- Log<Youtube>.Debug (e.StackTrace);
601+ Log<Youtube>.Error ("Error getting subscriptions - {0}", e.Message);
602+ Log<Youtube>.Debug (e.StackTrace);
603 }
604 }
605- }
606-
607+ }
608+
609+
610+
611 public static bool TryConnect (string username, string password)
612 {
613 try {
614@@ -180,8 +210,10 @@
615 try {
616 service = new YouTubeService (appName, clientID, developerKey);
617 service.setUserCredentials (username, password);
618+ ServicePointManager.CertificatePolicy = new CertHandler ();
619 } catch (Exception e) {
620 Log<Youtube>.Error (ConnectionErrorMessage);
621+ Log<Youtube>.Error (e.Message);
622 }
623 }
624 }
625
626=== modified file 'YouTube/src/YoutubeConfig.cs'
627--- YouTube/src/YoutubeConfig.cs 2009-02-01 20:19:36 +0000
628+++ YouTube/src/YoutubeConfig.cs 2010-05-09 17:35:41 +0000
629@@ -1,9 +1,29 @@
630+/* YoutubeConfig.cs
631+ *
632+ * GNOME Do is the legal property of its developers. Please refer to the
633+ * COPYRIGHT file distributed with this
634+ * source distribution.
635+ *
636+ * This program is free software: you can redistribute it and/or modify
637+ * it under the terms of the GNU General Public License as published by
638+ * the Free Software Foundation, either version 3 of the License, or
639+ * (at your option) any later version.
640+ *
641+ * This program is distributed in the hope that it will be useful,
642+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
643+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
644+ * GNU General Public License for more details.
645+ *
646+ * You should have received a copy of the GNU General Public License
647+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
648+ */
649+
650 using System;
651 using Gtk;
652 using Do.Platform;
653 using Do.Platform.Linux;
654
655-namespace Do.Universe
656+namespace Youtube
657 {
658
659 public class YouTubeConfig : AbstractLoginWidget
660
661=== modified file 'YouTube/src/YoutubeVideoItem.cs'
662--- YouTube/src/YoutubeVideoItem.cs 2009-02-01 20:19:36 +0000
663+++ YouTube/src/YoutubeVideoItem.cs 2010-05-09 17:35:41 +0000
664@@ -1,7 +1,27 @@
665+/* YouTubeVideoItem.cs
666+ *
667+ * GNOME Do is the legal property of its developers. Please refer to the
668+ * COPYRIGHT file distributed with this
669+ * source distribution.
670+ *
671+ * This program is free software: you can redistribute it and/or modify
672+ * it under the terms of the GNU General Public License as published by
673+ * the Free Software Foundation, either version 3 of the License, or
674+ * (at your option) any later version.
675+ *
676+ * This program is distributed in the hope that it will be useful,
677+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
678+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
679+ * GNU General Public License for more details.
680+ *
681+ * You should have received a copy of the GNU General Public License
682+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
683+ */
684+
685 using System;
686 using Do.Universe;
687
688-namespace Do.Universe
689+namespace Youtube
690 {
691 public class YoutubeVideoItem : Item, IUrlItem
692 {
693@@ -35,6 +55,5 @@
694 {
695 get { return url; }
696 }
697-
698 }
699 }

Subscribers

People subscribed via source and target branches