Example #1
0
        public uint Count(string aMediaServerId, string aId, out uint aUpdateId)
        {
            // we are in the library container
            if (aMediaServerId == string.Empty)
            {
                iMutex.WaitOne();
                aUpdateId = iUpdateId;
                uint count = (uint)iHomeContainer.ChildCount;
                iMutex.ReleaseMutex();

                return(count);
            }
            else
            {
                ModelMediaServer server = ModelMediaServer(aMediaServerId);
                if (server != null)
                {
                    DidlLite result;
                    uint     numberReturned, totalMatches;
                    server.Browse(aId, 0, 1, out result, out numberReturned, out totalMatches, out aUpdateId);

                    return(totalMatches);
                }
            }

            // we get here if the media server we are querying is not in our media server list
            throw new LibraryNotFoundException(aMediaServerId);
        }
Example #2
0
        public DidlLite Items(string aMediaServerId, string aId, uint aStartIndex, uint aCount, out uint aUpdateId)
        {
            if (aMediaServerId == string.Empty)
            {
                DidlLite result = new DidlLite();

                iMutex.WaitOne();

                aUpdateId = iUpdateId;
                uint endIndex = aStartIndex + aCount;
                for (uint i = 0; i < endIndex && i < iMediaServerList.Values.Count; ++i)
                {
                    MediaServer      server = iMediaServerList.Values[(int)i];
                    ModelMediaServer s;
                    if (iMediaServerByUdn.TryGetValue(server.Device.Udn, out s))
                    {
                        result.Add(s.Metadata);
                    }
                }

                iMutex.ReleaseMutex();

                return(result);
            }
            else
            {
                ModelMediaServer server = ModelMediaServer(aMediaServerId);
                if (server != null)
                {
                    DidlLite result;
                    uint     numberReturned, totalMatches;
                    server.Browse(aId, aStartIndex, aCount, out result, out numberReturned, out totalMatches, out aUpdateId);
                    return(result);
                }
            }

            // we get here if the media server we are querying is not in our media server list
            throw new LibraryNotFoundException(aMediaServerId);
        }