Hello community, here is the log from the commit of package banshee-doubanfm for openSUSE:Factory checked in at 2012-10-13 19:51:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/banshee-doubanfm (Old) and /work/SRC/openSUSE:Factory/.banshee-doubanfm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "banshee-doubanfm", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/banshee-doubanfm/banshee-doubanfm.changes 2012-06-25 12:22:25.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.banshee-doubanfm.new/banshee-doubanfm.changes 2012-10-13 19:55:05.000000000 +0200 @@ -1,0 +2,7 @@ +Wed Sep 26 21:51:05 CST 2012 - [email protected] + ++ Update to version 0.3.4: + - Reachieve offline radio. + - Fix some bugs. + +------------------------------------------------------------------- Old: ---- pro711-banshee-doubanfm-18ba48f65d87.tar.bz2 New: ---- pro711-banshee-doubanfm-44400efeb772.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ banshee-doubanfm.spec ++++++ --- /var/tmp/diff_new_pack.N566DG/_old 2012-10-13 19:55:07.000000000 +0200 +++ /var/tmp/diff_new_pack.N566DG/_new 2012-10-13 19:55:07.000000000 +0200 @@ -17,20 +17,20 @@ Name: banshee-doubanfm -Version: 0.3.2 -Release: 1 -License: MIT +Version: 0.3.4 +Release: 0 Summary: DoubanFM Extension for Banshee media player +License: MIT +Group: Productivity/Multimedia/Sound/Players Summary(zh_CN): Banshee 播放器的豆瓣扩展 Url: https://bitbucket.org/pro711/banshee-doubanfm/overview -Group: Productivity/Multimedia/Sound/Players -Source: pro711-%{name}-18ba48f65d87.tar.bz2 +Source: pro711-%{name}-44400efeb772.tar.bz2 BuildRequires: gconf2-devel BuildRequires: intltool # needed for autogen.sh +BuildRequires: gnome-doc-utils-devel >= 0.17.3 BuildRequires: libtool BuildRequires: mono-devel >= 1.9.1 -BuildRequires: gnome-doc-utils-devel >= 0.17.3 BuildRequires: pkgconfig(banshee-thickclient) >= 1.9.6 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -59,7 +59,7 @@ %lang_package -n banshee-extension-doubanfm %prep -%setup -q -n pro711-%{name}-18ba48f65d87 +%setup -q -n pro711-%{name}-44400efeb772 %build # There's no configure, so we need to call autogen.sh first ++++++ pro711-banshee-doubanfm-18ba48f65d87.tar.bz2 -> pro711-banshee-doubanfm-44400efeb772.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/.hg_archival.txt new/pro711-banshee-doubanfm-44400efeb772/.hg_archival.txt --- old/pro711-banshee-doubanfm-18ba48f65d87/.hg_archival.txt 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/.hg_archival.txt 2012-09-10 09:33:31.000000000 +0200 @@ -1,5 +1,5 @@ repo: 77750bd141c5d9156d6c61dcac251b9bd27f6947 -node: 18ba48f65d870e7b4c6fb9bad3e5b05d53f767c2 +node: 44400efeb772d9f6892a6841ccef007d0e07a8bf branch: default -latesttag: 0.3.2 -latesttagdistance: 3 +latesttag: 0.3.1 +latesttagdistance: 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/.hgtags new/pro711-banshee-doubanfm-44400efeb772/.hgtags --- old/pro711-banshee-doubanfm-18ba48f65d87/.hgtags 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/.hgtags 2012-09-10 09:33:31.000000000 +0200 @@ -3,3 +3,7 @@ f8732fdf18330c39224f0c89bed91c353a16747a 0.3.0 443e901c8e12f243787a4b0d59c050546a5c16fb 0.3.1 70af000c6b82813791961e77e3441921221a8857 0.3.2 +70af000c6b82813791961e77e3441921221a8857 0.3.2 +18ba48f65d870e7b4c6fb9bad3e5b05d53f767c2 0.3.2 +18ba48f65d870e7b4c6fb9bad3e5b05d53f767c2 0.3.2 +0000000000000000000000000000000000000000 0.3.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/po/POTFILES.in new/pro711-banshee-doubanfm-44400efeb772/po/POTFILES.in --- old/pro711-banshee-doubanfm-18ba48f65d87/po/POTFILES.in 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/po/POTFILES.in 2012-09-10 09:33:31.000000000 +0200 @@ -9,3 +9,4 @@ src/DoubanFM/Banshee.DoubanFM/Widgets.cs src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs +src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/po/zh_CN.po new/pro711-banshee-doubanfm-44400efeb772/po/zh_CN.po --- old/pro711-banshee-doubanfm-18ba48f65d87/po/zh_CN.po 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/po/zh_CN.po 2012-09-10 09:33:31.000000000 +0200 @@ -2,101 +2,107 @@ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# Chen Tao <[email protected]>, 2011. +# asy <[email protected]>, 2012. # msgid "" msgstr "" -"Project-Id-Version: banshee-doubanfm\n" +"Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-09-01 18:15+0800\n" -"PO-Revision-Date: 2011-09-01 18:15+0800\n" -"Last-Translator: Chen Tao <[email protected]>\n" -"Language-Team: LANGUAGE <[email protected]>\n" -"Language: zh_CN\n" +"POT-Creation-Date: 2012-06-04 13:48+0800\n" +"PO-Revision-Date: 2012-06-04 14:11+0800\n" +"Last-Translator: asy <[email protected]>\n" +"Language-Team: 汉语 <>\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:54 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:52 msgid "Love Track" msgstr "喜欢" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:55 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:53 msgid "Mark current track as loved" -msgstr "标记当前歌曲为喜欢的" +msgstr "标记当前歌曲为喜欢" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:59 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:57 msgid "Cancel Love Track" msgstr "取消喜欢" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:60 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:58 msgid "Cancel marking track as loved" -msgstr "取消标记当前歌曲为喜欢的" +msgstr "取消标记当前歌曲为喜欢" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:64 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:62 msgid "Ban Track" msgstr "禁止" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:65 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:63 msgid "Mark current track as banned" -msgstr "标记当前歌曲为禁止播放" +msgstr "标记当前歌曲为禁止" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:70 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:68 msgid "View track info on Douban.com" -msgstr "在豆瓣网上查看歌曲信息" +msgstr "在douban.com查看歌曲信息" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:85 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:83 msgid "_DoubanFM" -msgstr "豆瓣电台(_D)" +msgstr "豆瓣电台" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:86 -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:89 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:84 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:87 msgid "Configure DoubanFM" msgstr "配置豆瓣电台" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:88 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs:86 msgid "_Configure" -msgstr "配置(_C)" +msgstr "配置" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSourceContents.cs:83 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSourceContents.cs:80 msgid "Channels" msgstr "频道" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:81 -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:82 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:87 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:88 msgid "DoubanFM" msgstr "豆瓣电台" -#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:143 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:145 msgid "" "Douban FM login error. Please check Internet connection and your username " "and password." -msgstr "登录豆瓣电台失败。请检查网络连接以及用户名和密码设置。" +msgstr "登录豆瓣电台失败,请检查网络连接和用户信息" -#: ../src/DoubanFM/Banshee.DoubanFM/Widgets.cs:78 +#: ../src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs:203 +msgid "You may can't play this without login" +msgstr "在没登录的情况下你可能不能播放这个" + +#: ../src/DoubanFM/Banshee.DoubanFM/Widgets.cs:97 msgid "Loading channels" msgstr "载入频道" -#: ../src/DoubanFM/Banshee.DoubanFM/Widgets.cs:79 +#: ../src/DoubanFM/Banshee.DoubanFM/Widgets.cs:98 msgid "Please wait..." -msgstr "请稍候…" +msgstr "请稍后……" -#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs:19 +#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs:17 msgid "Please input verification code" msgstr "请输入验证码" -#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs:26 +#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs:20 msgid "DoubanFM Configuration" -msgstr "豆瓣电台设置" +msgstr "豆瓣电台配置" -#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs:41 +#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs:35 msgid "Email" -msgstr "电子邮件" +msgstr "邮箱地址" -#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs:49 +#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs:43 msgid "Password" msgstr "密码" -#: ../src/DoubanFM/gtk-gui/Banshee.DoubanFM.DoubanFMSource.cs:201 -msgid "You may can't play this without login" -msgstr "没有登录有些电台会不可用" +#: ../src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs:44 +#: ../src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs:45 +msgid "DoubanOfflineFM" +msgstr "离线电台" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFM.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFM.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFM.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFM.cs 2012-09-10 09:33:31.000000000 +0200 @@ -127,11 +127,6 @@ this.Song = song; } } - - /// <summary> - /// Douban FM rate handler. - /// </summary> - public delegate void DoubanFMRateHandler (object sender,DoubanFMRateEventArgs e); /// <summary> @@ -139,7 +134,7 @@ /// </summary> public class DoubanFM : IDoubanFMPlayQueue, IDisposable { - public event DoubanFMRateHandler DoubanFMRateEvent; + public static DoubanFM Instance { get; @@ -187,21 +182,13 @@ // Thread loadChannelsThread = new Thread(new ThreadStart(LoadChannels)); // loadChannelsThread.Start(); if (this.currentuser != null && !string.IsNullOrEmpty (this.currentuser.Username) && - !string.IsNullOrEmpty (this.currentuser.Password)) { + !string.IsNullOrEmpty (this.currentuser.Password)) { Login (this.currentuser); } LoadChannels (); // loadChannelsThread.Join(); } - - private void EmitDoubanFMRateEvent (object sender, DoubanFMRateEventArgs e) - { - if (this.DoubanFMRateEvent != null) { - Hyena.Log.Debug ("DoubanFM Rate Event emit"); - this.DoubanFMRateEvent (sender, e); - } - } public void ConnectPlaybackFinished () { @@ -257,7 +244,8 @@ captcha.Run (); captchaText = captcha.CaptchaText; captcha.Destroy (); - }); + } + ); // wait for user to input captcha while (captchaText == "") Thread.Sleep (100); @@ -348,14 +336,7 @@ request.CookieContainer = DoubanFMContext.Instance.CookieJar; response = (HttpWebResponse)request.GetResponse (); throw new CaptchaException (ParseCaptchaId (new StreamReader (response.GetResponseStream ()).ReadToEnd ())); - }/* else if (location.Contains ("error=notmatch")) {//notmatch==>1011 - // username/password mismatch -// LoginErrorEvent(); - throw new DoubanLoginException (); - } else if (location.Contains ("error=notused")) {//notused==>1011 - // username does not exist - throw new DoubanLoginException (); - } */ else if (location.Contains ("error=")) { + } else if (location.Contains ("error=")) { // other errors throw new DoubanLoginException (); } @@ -502,7 +483,8 @@ }*/ Gtk.Application.Invoke (delegate { RefreshChannels (); - }); + } + ); } /// <summary> @@ -598,7 +580,6 @@ // Read the content. responseFromServer = reader.ReadToEnd (); - Hyena.Log.Debug ("Response: " + responseFromServer); } catch (WebException e) { Hyena.Log.Exception (e); } @@ -609,6 +590,7 @@ public List<DoubanFMSong> JsonToDoubanFMSongs (string json) { Deserializer deserializer = new Deserializer (json); + Hyena.Log.Debug (string.Format ("JSON:{0}", json)); JsonObject obj = (JsonObject)deserializer.Deserialize (); try { JsonArray song = (JsonArray)obj ["song"]; @@ -690,7 +672,7 @@ var _params = GetDefaultParams ("n"); _params ["h"] = FormatHistoryList (10); string results = RemoteFM (_params); - Hyena.Log.Debug (string.Format ("results={0}", results)); + //Hyena.Log.Debug (string.Format ("results={0}", results)); return JsonToDoubanFMSongs (results); } @@ -720,7 +702,7 @@ public List<DoubanFMSong> BanSong (string sid, string aid) { List<DoubanFMSong> songs = BanSong (sid, aid, Enumerable.Empty<string> ().ToList ()); - this.EmitDoubanFMRateEvent (this, new DoubanFMRateEventArgs (DoubanFMRateAction.Hate, songs != null && songs.Count > 0 ? songs [0] : null)); + EventBus.Instance.EmitDoubanFMRateEvent (this, new DoubanFMRateEventArgs (DoubanFMRateAction.Hate, songs != null && songs.Count > 0 ? songs [0] : null)); this.playList = songs; ServiceManager.PlaybackController.Next (); return songs; @@ -734,7 +716,7 @@ string results = RemoteFM (_params); song.like = true; - this.EmitDoubanFMRateEvent (this, new DoubanFMRateEventArgs (DoubanFMRateAction.Love, song)); + EventBus.Instance.EmitDoubanFMRateEvent (this, new DoubanFMRateEventArgs (DoubanFMRateAction.Love, song)); List<DoubanFMSong> songs = JsonToDoubanFMSongs (results); playList = songs; return songs; @@ -749,7 +731,7 @@ string results = RemoteFM (_params); song.like = false; - this.EmitDoubanFMRateEvent (this, new DoubanFMRateEventArgs (DoubanFMRateAction.CancelLove, song)); + EventBus.Instance.EmitDoubanFMRateEvent (this, new DoubanFMRateEventArgs (DoubanFMRateAction.CancelLove, song)); List<DoubanFMSong> songs = JsonToDoubanFMSongs (results); playList = songs; return songs; @@ -795,7 +777,8 @@ } catch (System.Net.WebException e) { Hyena.Log.Warning ("Got Exception Trying to PlayedSong", e.ToString (), false); } - }); + } + ); song.status = DoubanFMSongStatus.Finished; history.Add (song); } @@ -824,7 +807,8 @@ } catch (System.Net.WebException e) { Hyena.Log.Warning ("Got Exception Trying to SkipSong", e.ToString (), false); } - }); + } + ); song.status = DoubanFMSongStatus.Skipped; history.Add (song); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFMActions.cs 2012-09-10 09:33:31.000000000 +0200 @@ -100,7 +100,7 @@ public void ListenFMEvent () { - this.fmSource.fm.DoubanFMRateEvent += new DoubanFMRateHandler (OnDoubanFMRateEvent); + EventBus.Instance.DoubanFMRateEvent += new DoubanFMRateHandler (OnDoubanFMRateEvent); } public override void Dispose () @@ -196,13 +196,16 @@ TrackInfo current_track = ServiceManager.PlayerEngine.CurrentTrack; //for the anonymous user all button is invisible bool isanonymous = DoubanFMUser.IsAnonymousUser (DoubanFMContext.Instance.User); + //all action buttons should hide when the playing source is not DoubanFMSource + bool isonline_source = ServiceManager.PlaybackController.Source is DoubanFMSource; this ["DoubanFMFavAction"].Visible = (current_track is DoubanFMSong) && - !((DoubanFMSong)current_track).like && !isanonymous; + !((DoubanFMSong)current_track).like && !isanonymous && isonline_source; this ["DoubanFMUnfavAction"].Visible = (current_track is DoubanFMSong) && - ((DoubanFMSong)current_track).like && !isanonymous; + ((DoubanFMSong)current_track).like && !isanonymous && isonline_source; // only personal channel has hate action - this ["DoubanFMHateAction"].Visible = (current_track is DoubanFMSong) && !isanonymous; - this ["DoubanFMInfoAction"].Visible = (current_track is DoubanFMSong); + this ["DoubanFMHateAction"].Visible = (current_track is DoubanFMSong) && !isanonymous + && isonline_source; + this ["DoubanFMInfoAction"].Visible = (current_track is DoubanFMSong) && isonline_source; updating = false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFMSong.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFMSong.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFMSong.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFMSong.cs 2012-09-10 09:33:31.000000000 +0200 @@ -24,6 +24,7 @@ using Banshee.Collection; using Hyena; using Hyena.Json; +using System.Xml.Serialization; namespace Banshee.DoubanFM { @@ -41,12 +42,14 @@ public override string AlbumTitle { get; set; } public override string ArtistName { get; set; } - + public string company; public string sid; public string aid; public string ssid; public string picture; + + public string PublicTime{ get; set; } public override TimeSpan Duration { get; set; } @@ -55,11 +58,12 @@ public bool commited { get; set; } public DoubanFMSongStatus status { get; set; } - + public override SafeUri Uri { get; set; } + /// <summary> /// Lookup for an field in a JsonObject @@ -68,7 +72,11 @@ { return o.ContainsKey (key) ? (T)o [key] : fallback; } - + + public DoubanFMSong ():base() + { + } + public DoubanFMSong (JsonObject o) : base() { try { @@ -80,6 +88,7 @@ aid = Lookup<string> (o, "aid", ""); ssid = Lookup<string> (o, "ssid", ""); picture = Lookup<string> (o, "picture", ""); + PublicTime = Lookup<string> (o, "public_time", string.Empty); try { like = Lookup<string> (o, "like", "0") == "0" ? false : true; } catch { @@ -89,7 +98,12 @@ like = Lookup<bool> (o, "like", false); } } - Duration = new TimeSpan (0, 0, Lookup<int> (o, "length", 0)); + try { + Duration = new TimeSpan (0, 0, Lookup<int> (o, "length", 0)); + } catch { + string length = Lookup<string> (o, "length", "0").Trim (); + Duration = new TimeSpan (0, 0, (int)float.Parse (length)); + } this.Uri = new SafeUri ((string)o ["url"]); status = DoubanFMSongStatus.Unfinished; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/DoubanFMSource.cs 2012-09-10 09:33:31.000000000 +0200 @@ -55,6 +55,7 @@ using Hyena.Json; using System.Runtime.Remoting.Messaging; using Banshee.DoubanFM.Service; +using Banshee.DoubanFM.OfflineFM; namespace Banshee.DoubanFM { @@ -95,6 +96,7 @@ actions = new DoubanFMActions (this); trackListModel = new MemoryTrackListModel (); + DoubanOfflineFMSource.Create (this); ServiceManager.SourceManager.AddSource (this); ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged; } @@ -366,7 +368,9 @@ { ServiceManager.PlaybackController.SourceChanged -= OnPlaybackSourceChanged; actions.Dispose (); - this.doubanservice.Dispose (); + if (this.doubanservice != null) { + this.doubanservice.Dispose (); + } actions = null; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/EventBus.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/EventBus.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/EventBus.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/EventBus.cs 2012-09-10 09:33:31.000000000 +0200 @@ -30,6 +30,11 @@ public delegate void DoubanFMUserLoginHandler (object sender,DoubanFMUserLoginEventArgs e); public delegate void DoubanFMChangeChannelHandler (object sender,DoubanFMChannel channel); + + /// <summary> + /// Douban FM rate handler. + /// </summary> + public delegate void DoubanFMRateHandler (object sender,DoubanFMRateEventArgs e); /// <summary> /// Event bus. @@ -45,6 +50,7 @@ /// </summary> public event DoubanFMUserLoginHandler LoginEvent; public event DoubanFMChangeChannelHandler ChangeChannelRequest; + public event DoubanFMRateHandler DoubanFMRateEvent; public void EmitLoginEvent (object sender, DoubanFMUserLoginEventArgs e) { @@ -52,7 +58,15 @@ this.LoginEvent (sender, e); } } - + + public void EmitDoubanFMRateEvent (object sender, DoubanFMRateEventArgs e) + { + if (this.DoubanFMRateEvent != null) { + Hyena.Log.Debug ("DoubanFM Rate Event emit"); + this.DoubanFMRateEvent (sender, e); + } + } + private EventBus () { } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs 1970-01-01 01:00:00.000000000 +0100 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs 2012-09-10 09:33:31.000000000 +0200 @@ -0,0 +1,292 @@ +// +// DoubanFMLocalSource.cs +// +// Author: +// asy <[email protected]> +// +// Copyright (c) 2012 asy +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using Banshee.Sources; +using Banshee.PlaybackController; +using Banshee.MediaEngine; +using Banshee.Collection; +using Gdk; +using Mono.Addins; +using Banshee.ServiceStack; +using System.ComponentModel; +using System.Net; +using System.IO; +using Banshee.Library; +using Banshee.Sources.Gui; +using System.Collections.Generic; +using Banshee.Collection.Database; +using Banshee.Configuration; + +namespace Banshee.DoubanFM.OfflineFM +{ + /// <summary> + /// Douban FM local source. + /// </summary> + public class DoubanOfflineFMSource:PrimarySource + { + const int sort_order = 190; + private int current_paly_index = -1; + private static string USER_HOME = System.Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); + private static string PATH = Path.Combine (USER_HOME, ".doubanFM"); + public static string DATA_PATH = Path.Combine (PATH, "data"); + + private DoubanOfflineFMSource ():base (AddinManager.CurrentLocalizer.GetString ("DoubanOfflineFM"), + AddinManager.CurrentLocalizer.GetString ("DoubanOfflineFM"), + "DoubanOfflineFM", + sort_order) + { + this.CheckFilePath (); + Pixbuf icon = new Pixbuf (System.Reflection.Assembly.GetExecutingAssembly (). + GetManifestResourceStream ("doubanfm_like.png") + ); + Properties.Set<Pixbuf> ("Icon.Pixbuf_16", icon.ScaleSimple (16, 16, InterpType.Bilinear)); + Properties.Set<string> ("SearchEntryDescription", AddinManager.CurrentLocalizer.GetString ("Search your DoubanFM songs")); + DoubanOfflineFMSourceInitialize (); + ServiceManager.PlaybackController.TrackStarted += new EventHandler (OnTrackStarted); + ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged; + this.AfterInitialized (); + } + + public override bool CanRemoveTracks { + get { + return false; + } + } + + public override bool HasEditableTrackProperties { + get { + return false; + } + } + + private void CheckFilePath () + { + if (!System.IO.Directory.Exists (PATH)) { + System.IO.Directory.CreateDirectory (PATH); + } + if (!System.IO.Directory.Exists (DATA_PATH)) { + System.IO.Directory.CreateDirectory (DATA_PATH); + } + } + + protected override void Initialize () + { + base.Initialize (); + DoubanOfflineFMSourceInitialize (); + } + + private void DoubanOfflineFMSourceInitialize () + { + DatabaseTrackModel.AddCondition (String.Format ("CoreTracks.PrimarySourceID = {0}", DbId)); + } + + + private void OnDownloading (object sender, DoWorkEventArgs e) + { + DatabaseTrackInfo song = e.Argument as DatabaseTrackInfo; + if (song != null) { + string song_url = song.Uri; + if (!string.IsNullOrEmpty (song_url)) { + try { + string file_name = string.Format ("{0}_{1}_{2}.mp3", song.AlbumTitle, song.ArtistName, song.TrackTitle); + file_name = file_name.Replace ("/", "_M_").Replace ("\\", "_M_"); + string file_path = Path.Combine (DATA_PATH, file_name); + if (!System.IO.File.Exists (file_path)) { + this.DownloadHttpData (new Uri (song_url), file_path); + song.Uri = new Hyena.SafeUri ("file://" + file_path); + e.Result = song; + } else { + Hyena.Log.Debug ("File already exists,Ignore!"); + } + } catch (Exception ex) { + e.Result = ex; + } + } + } + } + + private void DownloadHttpData (Uri uri, string file_path) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create (uri); + string temp_file_name = Path.GetTempFileName (); + using (HttpWebResponse response=(HttpWebResponse)request.GetResponse()) { + if (response.ContentLength != 0 && response.StatusCode == HttpStatusCode.OK) { + using (Stream fs=new FileStream(temp_file_name,FileMode.Create)) { + Stream rs = response.GetResponseStream (); + byte [] buff = new byte[1024]; + int len = rs.Read (buff, 0, buff.Length); + while (len > 0) { + fs.Write (buff, 0, len); + len = rs.Read (buff, 0, buff.Length); + } + } + File.Move (temp_file_name, file_path); + } + } + } + + public override bool CanSearch { + get { + return true; + } + } + + protected override void AddTrack (DatabaseTrackInfo track) + { + if (track.PrimarySourceId == DbId) + return; + track.PrimarySource = this; + + track.Save (false); + } + + private void OnSongDownloaded (object sender, RunWorkerCompletedEventArgs e) + { + if (e.Result is Exception) { + Hyena.Log.DebugException (e.Result as Exception); + } else { + DatabaseTrackInfo track = e.Result as DatabaseTrackInfo; + if (track != null) { + this.AddTrack (track); + this.Save (); + this.NotifyTracksChanged (); + } + } + } + + public override void Save () + { + ServiceManager.DbConnection.Execute ( + "UPDATE CorePrimarySources SET CachedCount = ? WHERE PrimarySourceID = ?", + Count, DbId + ); + } + + private void OnPlaybackSourceChanged (object o, EventArgs args) + { + if (ServiceManager.PlaybackController.Source is DoubanOfflineFMSource) { + ServiceManager.PlayerEngine.ConnectEvent (OnRequestNextTrack, PlayerEvent.RequestNextTrack); + } else { + ServiceManager.PlayerEngine.DisconnectEvent (OnRequestNextTrack); + } + } + + private void OnTrackStarted (object sender, EventArgs e) + { + DoubanFMSong track = ServiceManager.PlaybackController.CurrentTrack as DoubanFMSong; + if (track != null) { + DatabaseTrackInfo dbtrack = this.FromDoubanFMSong (track); + if (track.like) { + BackgroundWorker worker = new BackgroundWorker (); + worker.DoWork += new DoWorkEventHandler (this.OnDownloading); + worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler (this.OnSongDownloaded); + worker.RunWorkerAsync (dbtrack); + } //TODO if the song.like is false then remove the song + } + } + + + private DatabaseTrackInfo FromDoubanFMSong (DoubanFMSong song) + { + DatabaseTrackInfo track = new DatabaseTrackInfo (); + track.AlbumArtist = song.AlbumArtist; + track.AlbumArtistSort = song.AlbumArtistSort; + track.AlbumMusicBrainzId = song.AlbumMusicBrainzId; + track.AlbumTitle = song.AlbumTitle; + track.AlbumTitleSort = song.AlbumTitleSort; + track.ArtistMusicBrainzId = song.ArtistMusicBrainzId; + track.ArtistName = song.ArtistName; + track.ArtistNameSort = song.ArtistNameSort; + track.BitRate = song.BitRate; + track.BitsPerSample = song.BitsPerSample; + track.Bpm = song.Bpm; + track.CacheEntryId = song.CacheEntryId; + track.CacheModelId = song.CacheModelId; + track.CanPlay = song.CanPlay; + track.CanSaveToDatabase = song.CanSaveToDatabase; + track.Comment = song.Comment; + track.Composer = song.Composer; + track.Conductor = song.Conductor; + track.Copyright = song.Copyright; + track.DateAdded = song.DateAdded; + track.DiscCount = song.DiscCount; + track.DiscNumber = song.DiscNumber; + track.Duration = song.Duration; + track.Uri = song.Uri; + track.TrackTitle = song.TrackTitle; + return track; + } + + private void OnRequestNextTrack (PlayerEventArgs args) + { + this.Next (true, true); + } + + public static void Create (DoubanFMSource doubanfm) + { + if (doubanfm != null) { + DoubanOfflineFMSource local_source = new DoubanOfflineFMSource (); + doubanfm.AddChildSource (local_source); + } + } + + + public override void Activate () + { + base.Activate (); + } + + #region Implement of IBasicPlaybackController + public bool First () + { + this.current_paly_index = 0; + return this.Next (true, true); + } + + public bool Next (bool restart, bool changeImmediately) + { + if (this.current_paly_index < this.Count) { + ServiceManager.PlayerEngine.OpenPlay (this.TrackModel [this.current_paly_index]); + this.current_paly_index++; + } else { + this.current_paly_index = 0; + return false; + } + return true; + } + + public bool Previous (bool restart) + { + if (this.current_paly_index > 0) { + this.current_paly_index--; + return this.Next (restart, true); + } + return false; + } + #endregion + } +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/Service/DoubanFMServiceImp.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/Service/DoubanFMServiceImp.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/Service/DoubanFMServiceImp.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/Service/DoubanFMServiceImp.cs 2012-09-10 09:33:31.000000000 +0200 @@ -45,6 +45,12 @@ this.channel_changed (channel.ID); } }); + EventBus.Instance.DoubanFMRateEvent += new DoubanFMRateHandler ((object sender,DoubanFMRateEventArgs e) => + { + if (this.song_status_changed != null) { + this.song_status_changed (this.GetPlayingSong ()); + } + }); } public DoubanFMSongStruct GetPlayingSong () @@ -127,6 +133,13 @@ remove{ channel_changed -= value;} } + private event SongStatusChangedHandler song_status_changed; + + public event SongStatusChangedHandler SongStatusChanged { + add{ song_status_changed += value;} + remove{ song_status_changed -= value;} + } + public DoubanFMChannelStruct[] GetChannelList () { List<DoubanFMChannelStruct> channels = new List<DoubanFMChannelStruct> (); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/Service/IDoubanFMService.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/Service/IDoubanFMService.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Banshee.DoubanFM/Service/IDoubanFMService.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Banshee.DoubanFM/Service/IDoubanFMService.cs 2012-09-10 09:33:31.000000000 +0200 @@ -37,6 +37,8 @@ IDictionary<string, object> changed_properties, string[] invalidated_properties); + public delegate void SongStatusChangedHandler (DoubanFMSongStruct song); + public struct DoubanFMChannelStruct { public string Name; @@ -56,6 +58,7 @@ public interface IDoubanFMService { event ChannelChangedHandler ChannelChanged; + event SongStatusChangedHandler SongStatusChanged; void Love (); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/DoubanFM.csproj new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/DoubanFM.csproj --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/DoubanFM.csproj 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/DoubanFM.csproj 2012-09-10 09:33:31.000000000 +0200 @@ -69,6 +69,7 @@ <Reference Include="dbus-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5675b0c3093115b5"> <Private>False</Private> </Reference> + <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="DoubanFM.addin.xml"> @@ -86,6 +87,9 @@ <EmbeddedResource Include="Resources\UI.xml"> <LogicalName>UI.xml</LogicalName> </EmbeddedResource> + <EmbeddedResource Include="Resources\doubanfm_like.png"> + <LogicalName>doubanfm_like.png</LogicalName> + </EmbeddedResource> </ItemGroup> <ItemGroup> <Compile Include="Banshee.DoubanFM\DoubanFMSource.cs" /> @@ -110,6 +114,7 @@ <Compile Include="Banshee.DoubanFM\Service\IDoubanFMService.cs" /> <Compile Include="Banshee.DoubanFM\Service\DoubanFMDBusService.cs" /> <Compile Include="Banshee.DoubanFM\Service\DoubanFMServiceImp.cs" /> + <Compile Include="Banshee.DoubanFM\OfflineFM\DoubanOfflineFMSource.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> @@ -132,5 +137,6 @@ <Folder Include="Banshee.DoubanFM\" /> <Folder Include="Resources\" /> <Folder Include="Banshee.DoubanFM\Service\" /> + <Folder Include="Banshee.DoubanFM\OfflineFM\" /> </ItemGroup> </Project> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Makefile.am new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Makefile.am --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Makefile.am 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Makefile.am 2012-09-10 09:33:31.000000000 +0200 @@ -17,6 +17,7 @@ Banshee.DoubanFM/EventBus.cs \ Banshee.DoubanFM/HTTPUtils.cs \ Banshee.DoubanFM/IDoubanFMPlayQueue.cs \ + Banshee.DoubanFM/OfflineFM/DoubanOfflineFMSource.cs \ Banshee.DoubanFM/Service/DoubanFMDBusService.cs \ Banshee.DoubanFM/Service/DoubanFMServiceImp.cs \ Banshee.DoubanFM/Service/IDoubanFMService.cs \ @@ -30,6 +31,7 @@ gtk-gui/gui.stetic \ Resources/doubanfm.png \ Resources/doubanfm_banner.jpg \ + Resources/doubanfm_like.png \ Resources/UI.xml include $(top_srcdir)/build/build.mk Files old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/Resources/doubanfm_like.png and new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/Resources/doubanfm_like.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Captcha.cs 2012-09-10 09:33:31.000000000 +0200 @@ -7,7 +7,7 @@ private global::Gtk.Image captchaimage; private global::Gtk.Entry captchatext; private global::Gtk.Button buttonOk; - + protected virtual void Build () { global::Stetic.Gui.Initialize (this); @@ -66,7 +66,7 @@ this.Child.ShowAll (); } this.DefaultWidth = 364; - this.DefaultHeight = 200; + this.DefaultHeight = 213; this.buttonOk.HasDefault = true; this.Show (); this.buttonOk.Clicked += new global::System.EventHandler (this.OnButtonOkClicked); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/Banshee.DoubanFM.Configuration.cs 2012-09-10 09:33:31.000000000 +0200 @@ -11,7 +11,7 @@ private global::Gtk.Entry username; private global::Gtk.Button buttonCancel; private global::Gtk.Button buttonOk; - + protected virtual void Build () { global::Stetic.Gui.Initialize (this); @@ -113,7 +113,7 @@ this.Child.ShowAll (); } this.DefaultWidth = 309; - this.DefaultHeight = 153; + this.DefaultHeight = 171; this.buttonOk.HasDefault = true; this.Show (); this.buttonCancel.Pressed += new global::System.EventHandler (this.OnButtonCancelPressed); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/generated.cs new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/generated.cs --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/generated.cs 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/generated.cs 2012-09-10 09:33:31.000000000 +0200 @@ -5,7 +5,7 @@ internal class Gui { private static bool initialized; - + internal static void Initialize (Gtk.Widget iconRenderer) { if ((Stetic.Gui.initialized == false)) { @@ -13,7 +13,7 @@ } } } - + internal class IconLoader { public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size) @@ -47,14 +47,14 @@ } } } - + internal class ActionGroups { public static Gtk.ActionGroup GetActionGroup (System.Type type) { return Stetic.ActionGroups.GetActionGroup (type.FullName); } - + public static Gtk.ActionGroup GetActionGroup (string name) { return null; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/gui.stetic new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/gui.stetic --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/gtk-gui/gui.stetic 2012-05-11 09:30:21.000000000 +0200 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/gtk-gui/gui.stetic 2012-09-10 09:33:31.000000000 +0200 @@ -164,7 +164,7 @@ </widget> </child> </widget> - <widget class="Gtk.Dialog" id="Banshee.DoubanFM.Captcha" design-size="364 213"> + <widget class="Gtk.Dialog" id="Banshee.DoubanFM.Captcha" design-size="364 215"> <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Title" translatable="yes">Please input verification code</property> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/test_dbus.py new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/test_dbus.py --- old/pro711-banshee-doubanfm-18ba48f65d87/src/DoubanFM/test_dbus.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pro711-banshee-doubanfm-44400efeb772/src/DoubanFM/test_dbus.py 2012-09-10 09:33:31.000000000 +0200 @@ -0,0 +1,26 @@ +#!/usr/bin/python2 +import dbus +from dbus.mainloop.glib import DBusGMainLoop +import gobject + +def on_channel_changed(channel): + print("Channel changed to {0}".format(channel)) + +def on_song_status_changed(song): + print(song) + +if __name__=="__main__": + loop=gobject.MainLoop() + dbus_loop=DBusGMainLoop(set_as_default=True) + bus = dbus.SessionBus() + proxy = bus.get_object('fm.douban.banshee', + '/fm/douban/banshee') + doubanfm_iface=dbus.Interface(proxy,dbus_interface="fm.douban.banshee") + print("Test Change Channel") + doubanfm_iface.ChangeChannel("-3") + print("Test Get Channel List") + print(doubanfm_iface.GetChannelList()) + print("Test Signal") + doubanfm_iface.connect_to_signal("ChannelChanged",on_channel_changed) + doubanfm_iface.connect_to_signal("SongStatusChanged",on_song_status_changed) + loop.run() -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
