Exemplo n.º 1
0
 /// <summary>
 /// Add tracks to the tracklist.
 /// </summary>
 /// <param name="uri">URI for track to add</param>
 /// <param name="atPosition">position in tracklist to add track</param>
 /// <returns></returns>
 /// <remarks>
 /// If uris is given instead of tracks, the URIs are looked up in the library
 /// and the resulting tracks are added to the tracklist.
 /// If at_position is given, the tracks are inserted at the given position
 /// in the tracklist.If at_position is not given,
 /// the tracks are appended to the end of the tracklist.
 /// </remarks>
 public static Task <(bool Succeeded, TlTrack[] Result)> Add(
     string uri,
     int?atPosition = null
     )
 {
     return(Tracklist.Add(new string[] { uri }, atPosition));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Remove the matching tracks from the tracklist.
        /// </summary>
        /// <param name="tlId">one or more rules to match by</param>
        /// <returns></returns>
        public static Task <(bool Succeeded, TlTrack[] Result)> Remove(
            int tlId
            )
        {
            var criteria = new Criteria();

            criteria.TlId.Add((int)tlId);

            return(Tracklist.Remove(criteria));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Remove the matching tracks from the tracklist.
        /// </summary>
        /// <param name="uri">one or more rules to match by</param>
        /// <returns></returns>
        public static Task <(bool Succeeded, TlTrack[] Result)> Remove(
            string uri
            )
        {
            var criteria = new Criteria();

            if (uri != null)
            {
                criteria.Uri.Add(uri);
            }

            return(Tracklist.Remove(criteria));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Remove the matching tracks from the tracklist.
        /// </summary>
        /// <param name="tlId">one or more rules to match by</param>
        /// <returns></returns>
        public static Task <(bool Succeeded, TlTrack[] Result)> Remove(
            int[] tlId
            )
        {
            var criteria = new Criteria();

            if (tlId != null && 0 < tlId.Length)
            {
                criteria.TlId.AddRange(tlId);
            }

            return(Tracklist.Remove(criteria));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Filter the tracklist by the given criteria.
        /// </summary>
        /// <param name="tlId">one or more rules to match by</param>
        /// <param name="uri">one or more rules to match by</param>
        /// <returns></returns>
        /// <remarks>
        /// Each rule in the criteria consists of a model field
        /// and a list of values to compare it against.
        /// If the model field matches any of the values, it may be returned.
        /// Only tracks that match all the given criteria are returned.
        /// </remarks>
        public static Task <(bool Succeeded, TlTrack[] Result)> Filter(
            int?tlId   = null,
            string uri = null
            )
        {
            var criteria = new Criteria();

            if (tlId != null)
            {
                criteria.TlId.Add((int)tlId);
            }
            if (uri != null)
            {
                criteria.Uri.Add(uri);
            }

            return(Tracklist.Filter(criteria));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Filter the tracklist by the given criteria.
        /// </summary>
        /// <param name="tlId">one or more rules to match by</param>
        /// <param name="uri">one or more rules to match by</param>
        /// <returns></returns>
        /// <remarks>
        /// Each rule in the criteria consists of a model field
        /// and a list of values to compare it against.
        /// If the model field matches any of the values, it may be returned.
        /// Only tracks that match all the given criteria are returned.
        /// </remarks>
        public static Task <(bool Succeeded, TlTrack[] Result)> Filter(
            int[] tlId   = null,
            string[] uri = null
            )
        {
            var criteria = new Criteria();

            if (tlId != null && 0 < tlId.Length)
            {
                criteria.TlId.AddRange(tlId);
            }
            if (uri != null && 0 < uri.Length)
            {
                criteria.Uri.AddRange(uri);
            }

            return(Tracklist.Filter(criteria));
        }