Merge lp:~alexlauni/do-plugins/bansheeplugin into lp:do-plugins

Proposed by Alex Launi
Status: Merged
Approved by: Alex Launi
Approved revision: 317
Merged at revision: not available
Proposed branch: lp:~alexlauni/do-plugins/bansheeplugin
Merge into: lp:do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp:~alexlauni/do-plugins/bansheeplugin
Reviewer Review Type Date Requested Status
Alex Launi (community) Approve
Review via email: mp+4038@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

The full version of the banshee plugin complete with collection indexing, and playback control. STD free and ready for action.

315. By Alex Launi

update addin manifest

316. By Alex Launi

maybe fix Play not playing expected songs

317. By Alex Launi

merge trunk

Revision history for this message
Alex Launi (alexlauni) wrote :
Download full text (7.0 KiB)

Alex Launi proposed lp:~alexlauni/do-plugins/bansheeplugin for merging into lp:do-plugins

The full version of the banshee plugin complete with collection indexing, and playback control. STD free and ready for action.

=== modified file 'Banshee/Resources/Banshee.addin.xml'
--- a/Banshee/Resources/Banshee.addin.xml 2009-03-02 19:58:39 +0000
+++ b/Banshee/Resources/Banshee.addin.xml 2009-03-13 21:55:50 +0000
@@ -1,16 +1,21 @@
 <Addin
  id="Banshee"
  namespace= "Do"
+<<<<<<< TREE
  version="0.9"
  name="Banshee (beta)"
  description="Search your music library and control playback."
+=======
+ version="1.0"
+ name="Banshee Media Player"
+ description="Search your media collection and control playback."
+>>>>>>> MERGE-SOURCE
  author="Alex Launi"
  category="Official"
 >

  <Runtime>
   <Import assembly="Banshee.dll"/>
- <Import assembly="Banshee.CollectionIndexer.dll"/>
  </Runtime>

  <Dependencies>
@@ -18,6 +23,10 @@
  </Dependencies>

  <!-- Extensions included in this assembly -->
+ <!-- Itemsources -->
+ <Extension path = "/Do/ItemSource">
+ <ItemSource type = "Banshee.MediaItemSource" />
+ </Extension>

  <!-- Actions -->
  <Extension path = "/Do/Action">
@@ -25,5 +34,7 @@
   <Action type = "Banshee.PauseAction" />
   <Action type = "Banshee.NextAction" />
   <Action type = "Banshee.PreviousAction" />
+ <Action type = "Banshee.EnqueueAction" />
+ <Action type = "Banshee.SearchCollectionAction" />
  </Extension>
 </Addin>

=== modified file 'Banshee/src/Banshee.cs'
--- a/Banshee/src/Banshee.cs 2009-01-23 07:32:12 +0000
+++ b/Banshee/src/Banshee.cs 2009-03-13 21:55:50 +0000
@@ -53,10 +53,11 @@
   {
    if (index_mutex.ThreadState == ThreadState.Running)
     return;
- if (index_mutex.ThreadState == ThreadState.Unstarted)
+ else if (index_mutex.ThreadState == ThreadState.Unstarted)
     index_mutex.Start ();
- else
+ else {
     index_mutex = MakeIndexerThread ();
+ }
   }

   public static bool IsPlaying {

=== modified file 'Banshee/src/BansheeDBus.cs'
--- a/Banshee/src/BansheeDBus.cs 2009-01-22 04:17:45 +0000
+++ b/Banshee/src/BansheeDBus.cs 2009-03-13 21:55:50 +0000
@@ -20,6 +20,7 @@

 using System;
 using System.Linq;
+using System.Threading;
 using System.Collections.Generic;

 using NDesk.DBus;
@@ -45,6 +46,7 @@
  [Interface ("org.bansheeproject.Banshee.PlaybackController")]
  interface IBansheeController
  {
+ void First ();
   void Next (bool restart);
   void Previous (bool restart);
   int ShuffleMode { get; set; }
@@ -53,12 +55,14 @@
  public class BansheeDBus
  {
   const string BusName = "org.bansheeproject.Banshee";
+ const string SessionBusName = "org.freedesktop.DBus";
   const string ErrorMessage = "Banshee encountered an error in {0}; {1}";

   # region static Banshee d-bus members

   static Dictionary<Type, string> object_paths;

+ static IBus session_bus;
   static IBansheePlayer player;
   static IBansheePlayQueue play_queue;
   static IBansheeController controller;
@@ -66,18 +70,39 @@
   static BansheeDBus ()
   {
    BuildObjectPathsDict ();
- }
-
- static T GetIBansheeObject<T> (string object_path)
- {
- if (!Bus.Session.NameHasOwner (BusName)) {
- Bus.Session.StartServic...

Read more...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Banshee/Resources/Banshee.addin.xml'
2--- Banshee/Resources/Banshee.addin.xml 2009-01-30 00:17:11 +0000
3+++ Banshee/Resources/Banshee.addin.xml 2009-02-28 20:03:30 +0000
4@@ -1,16 +1,15 @@
5 <Addin
6 id="Banshee"
7 namespace= "Do"
8- version="0.9"
9- name="Banshee (beta)"
10- description="Control Banshee Media Player playback and Search Collection"
11+ version="1.0"
12+ name="Banshee Media Player"
13+ description="Search your media collection and control playback."
14 author="Alex Launi"
15 category="Official"
16 >
17
18 <Runtime>
19 <Import assembly="Banshee.dll"/>
20- <Import assembly="Banshee.CollectionIndexer.dll"/>
21 </Runtime>
22
23 <Dependencies>
24@@ -18,6 +17,10 @@
25 </Dependencies>
26
27 <!-- Extensions included in this assembly -->
28+ <!-- Itemsources -->
29+ <Extension path = "/Do/ItemSource">
30+ <ItemSource type = "Banshee.MediaItemSource" />
31+ </Extension>
32
33 <!-- Actions -->
34 <Extension path = "/Do/Action">
35@@ -25,5 +28,7 @@
36 <Action type = "Banshee.PauseAction" />
37 <Action type = "Banshee.NextAction" />
38 <Action type = "Banshee.PreviousAction" />
39+ <Action type = "Banshee.EnqueueAction" />
40+ <Action type = "Banshee.SearchCollectionAction" />
41 </Extension>
42 </Addin>
43
44=== modified file 'Banshee/src/Banshee.cs'
45--- Banshee/src/Banshee.cs 2009-01-23 07:32:12 +0000
46+++ Banshee/src/Banshee.cs 2009-01-27 04:01:24 +0000
47@@ -53,10 +53,11 @@
48 {
49 if (index_mutex.ThreadState == ThreadState.Running)
50 return;
51- if (index_mutex.ThreadState == ThreadState.Unstarted)
52+ else if (index_mutex.ThreadState == ThreadState.Unstarted)
53 index_mutex.Start ();
54- else
55+ else {
56 index_mutex = MakeIndexerThread ();
57+ }
58 }
59
60 public static bool IsPlaying {
61
62=== modified file 'Banshee/src/BansheeDBus.cs'
63--- Banshee/src/BansheeDBus.cs 2009-01-22 04:17:45 +0000
64+++ Banshee/src/BansheeDBus.cs 2009-02-27 06:17:30 +0000
65@@ -20,6 +20,7 @@
66
67 using System;
68 using System.Linq;
69+using System.Threading;
70 using System.Collections.Generic;
71
72 using NDesk.DBus;
73@@ -53,12 +54,14 @@
74 public class BansheeDBus
75 {
76 const string BusName = "org.bansheeproject.Banshee";
77+ const string SessionBusName = "org.freedesktop.DBus";
78 const string ErrorMessage = "Banshee encountered an error in {0}; {1}";
79
80 # region static Banshee d-bus members
81
82 static Dictionary<Type, string> object_paths;
83
84+ static IBus session_bus;
85 static IBansheePlayer player;
86 static IBansheePlayQueue play_queue;
87 static IBansheeController controller;
88@@ -66,18 +69,39 @@
89 static BansheeDBus ()
90 {
91 BuildObjectPathsDict ();
92- }
93-
94- static T GetIBansheeObject<T> (string object_path)
95- {
96- if (!Bus.Session.NameHasOwner (BusName)) {
97- Bus.Session.StartServiceByName (BusName);
98- System.Threading.Thread.Sleep (5000);
99- if (!Bus.Session.NameHasOwner (BusName))
100- throw new Exception (string.Format("Name {0} has no owner.", BusName));
101- }
102+ session_bus = Bus.Session.GetObject<IBus> (SessionBusName, new ObjectPath (object_paths[typeof (IBus)]));
103+ session_bus.NameOwnerChanged += HandleNameOwnerChanged;
104+ }
105+
106+ static void HandleNameOwnerChanged(string name, string old_owner, string new_owner)
107+ {
108+ // when the owner changes on this path, we release our dbus objects.
109+ if (name == BusName) {
110+ player = null;
111+ controller = null;
112+ play_queue = null;
113+ }
114+ }
115+
116+ static bool FullApplicationAvailable {
117+ get { return Bus.Session.NameHasOwner (BusName); }
118+ }
119+
120+ static void MaybeStartFullApplication ()
121+ {
122+ if (FullApplicationAvailable) return;
123
124- return Bus.Session.GetObject<T> (BusName, new ObjectPath (object_path));
125+ Bus.Session.StartServiceByName (BusName);
126+ Thread.Sleep (5000);
127+
128+ if (!FullApplicationAvailable)
129+ throw new Exception (string.Format("Name {0} has no owner.", BusName));
130+ }
131+
132+ static T GetIBansheeObject<T> (string objectPath)
133+ {
134+ MaybeStartFullApplication ();
135+ return Bus.Session.GetObject<T> (BusName, new ObjectPath (objectPath));
136 }
137
138 static IBansheePlayer Player {
139@@ -115,9 +139,9 @@
140 }
141
142 public bool IsPlaying ()
143- {
144+ {
145 try {
146- return player != null && Player.CurrentState == "playing";
147+ return (player != null || FullApplicationAvailable) && Player.CurrentState == "playing";
148 } catch (Exception e) {
149 LogError ("IsPlaying", e);
150 }
151@@ -152,6 +176,8 @@
152 void Enqueue (IEnumerable<IMediaFile> media, bool prepend)
153 {
154 try {
155+ MaybeStartFullApplication (); //if banshee isn't already started the enqueue seems to fail
156+
157 // if we're prepending to the queue we need to queue in the uris in reverse order
158 if (prepend) media = media.Reverse ();
159
160@@ -183,6 +209,7 @@
161 static void BuildObjectPathsDict ()
162 {
163 object_paths = new Dictionary<Type, string> ();
164+ object_paths.Add (typeof (IBus), "/org/freedesktop/DBus");
165 object_paths.Add (typeof (IBansheePlayer), "/org/bansheeproject/Banshee/PlayerEngine");
166 object_paths.Add (typeof (IBansheeController), "/org/bansheeproject/Banshee/PlaybackController");
167 object_paths.Add (typeof (IBansheePlayQueue), "/org/bansheeproject/Banshee/SourceManager/PlayQueue");
168
169=== modified file 'Banshee/src/PauseAction.cs'
170--- Banshee/src/PauseAction.cs 2009-01-22 03:02:27 +0000
171+++ Banshee/src/PauseAction.cs 2009-02-27 06:17:30 +0000
172@@ -22,6 +22,7 @@
173
174 using Mono.Unix;
175
176+using Do.Platform;
177 using Do.Universe;
178
179 namespace Banshee
180
181=== modified file 'Banshee/src/PlayAction.cs'
182--- Banshee/src/PlayAction.cs 2009-01-22 01:04:35 +0000
183+++ Banshee/src/PlayAction.cs 2009-02-27 06:17:30 +0000
184@@ -69,5 +69,11 @@
185
186 yield break;
187 }
188+
189+ protected override bool IsAvailable ()
190+ {
191+ return !Banshee.IsPlaying;
192+ }
193+
194 }
195 }
196\ No newline at end of file

Subscribers

People subscribed via source and target branches