public E <LocalStr> Enqueue(InvokerData invoker, string message, string audioType = null)
        {
            var result = ResourceFactoryManager.Load(message, audioType);

            if (!result)
            {
                return(result.Error);
            }
            return(Enqueue(invoker, new PlaylistItem(result.Value.BaseData)));
        }
Esempio n. 2
0
        // TODO xml doc doesnt match here
        /// <summary>Playes the passed <see cref="PlayData.PlayResource"/></summary>
        /// <param name="invoker">The invoker of this resource. Used for responses and association.</param>
        /// <param name="audioType">The associated <see cref="AudioType"/> to a factory.</param>
        /// <param name="link">The link to resolve, load and play.</param>
        /// <param name="meta">Allows overriding certain settings for the resource. Can be null.</param>
        /// <returns>Ok if successful, or an error message otherwise.</returns>
        public R Play(InvokerData invoker, string link, AudioType?type = null, MetaData meta = null)
        {
            var result = ResourceFactoryManager.Load(link, type);

            if (!result)
            {
                return(result.Message);
            }
            return(Play(invoker, result.Value, meta ?? new MetaData()));
        }
        /// <summary>Tries to play the passed link.</summary>
        /// <param name="invoker">The invoker of this resource. Used for responses and association.</param>
        /// <param name="link">The link to resolve, load and play.</param>
        /// <param name="audioType">The associated resource type string to a factory.</param>
        /// <param name="meta">Allows overriding certain settings for the resource. Can be null.</param>
        /// <returns>Ok if successful, or an error message otherwise.</returns>
        public E <LocalStr> Play(InvokerData invoker, string link, string audioType = null, MetaData meta = null)
        {
            var result = ResourceFactoryManager.Load(link, audioType);

            if (!result)
            {
                return(result.Error);
            }
            return(Play(invoker, result.Value, meta ?? new MetaData()));
        }
Esempio n. 4
0
        /// <summary>Playes the passed <see cref="AudioResource"/></summary>
        /// <param name="invoker">The invoker of this resource. Used for responses and association.</param>
        /// <param name="ar">The resource to load and play.</param>
        /// <param name="meta">Allows overriding certain settings for the resource. Can be null.</param>
        /// <returns>Ok if successful, or an error message otherwise.</returns>
        public R Play(InvokerData invoker, AudioResource ar, MetaData meta = null)
        {
            var result = ResourceFactoryManager.Load(ar);

            if (!result)
            {
                return(result.Message);
            }
            return(Play(invoker, result.Value, meta ?? new MetaData()));
        }
Esempio n. 5
0
        public R Enqueue(InvokerData invoker, string message, AudioType?type = null)
        {
            var result = ResourceFactoryManager.Load(message, type);

            if (!result)
            {
                return(result.Message);
            }
            return(EnqueueInternal(invoker, new PlaylistItem(result.Value.BaseData)));
        }
        /// <summary>Tries to play the passed <see cref="AudioResource"/></summary>
        /// <param name="invoker">The invoker of this resource. Used for responses and association.</param>
        /// <param name="ar">The resource to load and play.</param>
        /// <param name="meta">Allows overriding certain settings for the resource. Can be null.</param>
        /// <returns>Ok if successful, or an error message otherwise.</returns>
        public E <LocalStr> Play(InvokerData invoker, AudioResource ar, MetaData meta = null)
        {
            if (ar is null)
            {
                throw new ArgumentNullException(nameof(ar));
            }

            var result = ResourceFactoryManager.Load(ar);

            if (!result)
            {
                return(result.Error);
            }
            return(Play(invoker, result.Value, meta ?? new MetaData()));
        }
Esempio n. 7
0
        public R Play(InvokerData invoker, uint historyId, MetaData meta = null)
        {
            var getresult = HistoryManager.GetEntryById(historyId);

            if (!getresult)
            {
                return(getresult.Message);
            }

            var loadresult = ResourceFactoryManager.Load(getresult.Value.AudioResource);

            if (!loadresult)
            {
                return(loadresult.Message);
            }

            return(Play(invoker, loadresult.Value, meta ?? new MetaData()));
        }
        /// <summary>
        /// Goes through a list of <see cref="AudioLogEntry"/> and checks if the contained <see cref="AudioResource"/>
        /// is playable/resolvable.
        /// </summary>
        /// <param name="list">The list to iterate.</param>
        /// <returns>A new list with all working items.</returns>
        private List <AudioLogEntry> FilterList(ResourceFactoryManager resourceFactory, IReadOnlyCollection <AudioLogEntry> list)
        {
            int userNotifyCnt = 0;
            var nextIter      = new List <AudioLogEntry>(list.Count);

            foreach (var entry in list)
            {
                var result = resourceFactory.Load(entry.AudioResource);
                if (!result)
                {
                    Log.Debug("Cleaning: ({0}) Reason: {1}", entry.AudioResource.UniqueId, result.Error);
                    nextIter.Add(entry);
                }

                if (++userNotifyCnt % 100 == 0)
                {
                    Log.Debug("Clean in progress {0}", new string('.', userNotifyCnt / 100 % 10));
                }
            }
            return(nextIter);
        }