private static void DoMusic(RequestSearch requestSearch, Socket asker)
        {
            var result = Indexation.GetAllMusics()
                         .Where(m => Search.Find(requestSearch.Name, m.Title)).OrderBy(x => Search.FindStrength(requestSearch.Name, x.Title)).OrderByDescending(x => x.Rating);

            foreach (var m in result)
            {
                MyServer.Log.Info("  " + m.Title);
            }

            requestSearch.SenderUID = MyServer.Clients.GetUser(asker).UID;

            //ServerCom.GlobalSend(requestSearch);
            (new RequestAnswer(result.Cast <IElement>().ToList(), ElementType.Music, requestSearch.Name)).Send(asker);
        }
        private static void DoMusic(RequestSearch requestSearch, Socket asker)
        {
            var result = Indexation.GetAllMusics()
                         .Where(m => Search.Find(requestSearch.Name, m.Title));

            foreach (var m in result)
            {
                MyServer.Log.Info("  " + m.Title);
            }

            requestSearch.SenderUID = MyServer.Clients.GetUser(asker).UID;

            ServerCom.GlobalSend(requestSearch);
            MyServer.SendObject(new RequestAnswer(result.Cast <IElement>().ToList(), ElementType.Music), asker);
        }
Example #3
0
 static public IEnumerable <Music> GetMostLikedMusic(int length)
 => Indexation.GetAllMusics()
 .OrderBy(m => m.Rating)
 .Take(length);
Example #4
0
 static public IEnumerable <Music> GetMostLikedMusicByGenre(string genre, int length)
 => Indexation.GetAllMusics()
 .Where(m => m.Genre.Contains(genre))
 .OrderBy(m => m.Rating)
 .Take(length);