ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Player.cpp
(Generate patch)

Comparing DecentralizedMedia/Player.cpp (file contents):
Revision 545 by douglas, 2005-07-03T03:56:51-07:00 vs.
Revision 546 by douglas, 2005-07-03T22:13:07-07:00

# Line 7 | Line 7
7   #include <menes/standard.hh>
8  
9   #include <menes-api/pcre/regex.hpp>
10 + #include <menes-api/posix/signals.hpp>
11 + #include <menes-ext/stack.hpp>
12   #include <menes-hop/bind.hpp>
13  
14   #include "Player.hpp"
# Line 20 | Line 22 | inline void Sleep()
22  
23   Player::Player(const _R<dbi::Connection>& connection, int player) : remote(player), player_(remote.IsRunning() ? NULL : new _H<api::Process>(_B("/usr/X11R6/bin/beep-media-player"))), position(remote.GetPlaylistPosition()), adder(hop::BindAll(&Player::Adder, this)), copier(hop::BindAll(&Player::Copier, this))
24   {
25 +        api::Posix::SetSignalHandler(SIGUSR2, hop::BindAll(&Player::Change, this));
26 +
27          if (!player_.IsEmpty())
28          {
29                  player_->ClearReader();
# Line 111 | Line 115 | int Player::Copier() const
115  
116                                  _assert(match);
117  
118 +                                {
119 +                                        api::Path parent(path);
120 +                                        ext::Stack<api::Path> stack;
121 +
122 +                                        while ((parent = parent.GetParent()) != Share::shares)
123 +                                                stack.Push(parent);
124 +
125 +                                        while (stack.Pop(parent))
126 +                                                if (!parent.Exists())
127 +                                                        parent.CreateDirectory();
128 +                                }
129 +
130                                  ext::ScopeReadLock<mta::ReaderWriterLock> readLock(sharesLock);
131  
132 <                                const _R<Share>& share(shares[api::InternetAddress(match[1], 6996)][match[2]]);
132 >                                const _R<Share>& share(shares[api::Address::Resolve(match[1], _B("6996")).First()][match[2]]);
133                          }
134                  }
135                  else _desynchronized (queueLock)
# Line 121 | Line 137 | int Player::Copier() const
137  
138          return 0;
139   }
140 +
141 + void Player::Change()
142 + {
143 +        position = remote.GetPlaylistPosition();
144 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines