public async Task <string> YandexTrackAsync(string trackId, SocketGuild contextGuild)
        {
            var yandexMusicApi = new YandexMusicApi();
            var track          = yandexMusicApi.GetTrack(trackId);

            return($"{track.Title} - {track.Artists.First().Name}");
        }
        public YandexMusicApi Authorize()
        {
            var api = new YandexMusicApi();

            api.Authorize(new string(UserName), new string(Password));
            return(api);
        }
Exemple #3
0
        public YandexTestHarness()
        {
            AppSettings = GetAppSettings();

            Storage = new YAuthStorage();

            API = new YandexMusicApi();
        }
Exemple #4
0
        public YandexMusicClient()
        {
            Api = new YandexMusicApi();

            Track    = new YandexTrackEndpoint(Api);
            Playlist = new YandexPlaylistEndpoint(Api);
            Artist   = new YandexArtistEndpoint(Api);
            Album    = new YandexAlbumEndpoint(Api);
            User     = new YandexUserEndpoint(Api);
        }
        public YandexClient( )
        {
            Log.Information("Connecting to Yandex Music...");

            yAuthStorage      = new AuthStorage(  );
            yandexMusicClient = new YandexMusicApi( );
            yandexMusicClient.User.Authorize(yAuthStorage, Config.YMLogin, Config.YMPassword);

            Log.Information("Connection to Yandex Music successful");
        }
Exemple #6
0
        public YandexTestHarness()
        {
            AppSettings = GetAppSettings();

            Storage = new AuthStorage(new DebugSettings("responses", "log.txt")
            {
                ClearDirectory = true
            });

            API = new YandexMusicApi();
        }
Exemple #7
0
        public LofiTest(LofiTestHarness fixture, ITestOutputHelper output = null)
        {
            Fixture = fixture;

            Api = new YandexMusicApi();

            if (output != null)
            {
                Log.Logger = new LoggerConfiguration()
                             .WriteTo
                             .TestOutput(output, LogEventLevel.Verbose)
                             .CreateLogger();
            }
        }
        public async Task GetLyricsAsync(SocketUser user, IGuild guild, string query = null)
        {
            LavaPlayer player = _lavaNode.GetPlayer(guild);
            //Массив строк для неопреледелённого количества сообщения для вывода текста песен
            var listLyrics = new List <string>();

            if (player.Track != null)
            {
                query = player.Track.Title;
            }

            var musicApi     = new YandexMusicApi();
            var yandexTracks = musicApi.SearchTrack(query);

            if (yandexTracks is null || yandexTracks.Count < 1)
            {
                Console.WriteLine("Yandex DEBUG ---------------------->> NUUUUUULL");
                listLyrics[0] = "**NOT FOUND**";
            }

            var track = yandexTracks?.First();

            if (track is null)
            {
                listLyrics[0] = "**NOT FOUND**";
            }
            else
            {
                var parser = new ParserGenius($"{track.Artists.First().Name} - {track.Title}");
                parser.Initialization().Wait();

                listLyrics = parser.DivideLyrics();
            }

            var dmChannel = user.GetOrCreateDMChannelAsync();

            for (int i = 0; i < listLyrics.Count; i++)
            {
                var builder = new EmbedBuilder();

                builder.WithTitle("Lyrics")
                .WithDescription(listLyrics[i])
                .WithColor(Color.Red);

                await dmChannel.Result.SendMessageAsync("", false, builder.Build());
            }
        }
        static Clients( )
        {
            Log.Information("Connecting to Spotify...");

            SpotifyClientConfig spotify_config = SpotifyClientConfig.CreateDefault( )
                                                 .WithAuthenticator(
                new ClientCredentialsAuthenticator(
                    Config.SotifyClientID,
                    Config.SotifyClientSecret));

            _spotify_client = new SpotifyClient(spotify_config);

            Log.Information("Connection to Spotify successful");

            Log.Information("Connecting to Yandex Music...");

            _yAusthStorage       = new AuthStorage(  );
            _yandex_music_client = new YandexMusicApi( );
            _yandex_music_client.User.Authorize(_yAusthStorage, Config.YMLogin, Config.YMPassword);

            Log.Information("Connection to Yandex Music successful");
        }
 public YandexMusicClient(DebugSettings settings = null)
 {
     api     = new YandexMusicApi();
     storage = new AuthStorage(settings);
 }
 public YGetPlaylistMainPageRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
Exemple #12
0
 public YExecutionContextConverter(YandexMusicApi yandex, AuthStorage auth)
 {
     api     = yandex;
     storage = auth;
 }
        static void Main(string[] args)
        {
            string login;
            string password;

            if (args.Length > 0)
            {
                login    = args[0];
                password = args[1];
            }
            else
            {
                Console.WriteLine("Введите логин");
                login = Console.ReadLine();
                Console.WriteLine("Введите пароль");
                password = Console.ReadLine();
                Console.Clear();
            }
            DebugSettings debugSettings = new DebugSettings(@"C:\yandex_music", @"C:\yandex_music\log.txt");

            debugSettings.Clear();
            AuthStorage authStorage = new AuthStorage(debugSettings);

            authStorage.User.Login = login;
            var api = new YandexMusicApi();

            api.User.Authorize(authStorage, authStorage.User.Login, password);
            if (authStorage.IsAuthorized)
            {
                Console.WriteLine("Успешная авторизация");
            }
            else
            {
                Console.WriteLine("Неверный логин или пароль");
                return;
            }

            Console.WriteLine("Какой трек Вы хотите прослушать?");
            string searchingQuery = Console.ReadLine();
            var    search         = api.Search.Track(authStorage, searchingQuery);

            if (search.Result.Tracks == null)
            {
                Console.WriteLine("По Вашему запросу ничего не найдено :(");
                return;
            }

            int count = 1;

            foreach (var item in search.Result.Tracks.Results)
            {
                Console.WriteLine($"{count}. {item.Artists[0].Name} - {item.Title}");
                count++;
            }

            Console.WriteLine("Выберите трек из списка:");
            int choice = Convert.ToInt32(Console.ReadLine());

            if (choice < 1 || choice > 20)
            {
                Console.WriteLine("Вы ввели неверное число.");
                return;
            }

            YTrack track = api.Track.Get(authStorage, search.Result.Tracks.Results[choice - 1].Id).Result[0];

            var fileLink = api.Track.GetFileLink(authStorage, track);

            using (var client = new WebClient())
            {
                client.DownloadFile(fileLink, @$ "{debugSettings.OutputDir}\{track.Title}.mp3");
 public YAlbumAPI(YandexMusicApi yandex) : base(yandex)
 {
 }
Exemple #15
0
        static void Main(string[] args)
        {
            var musicDir = "music";

            if (!Directory.Exists(musicDir))
            {
                Directory.CreateDirectory(musicDir);
            }

            var api = new YandexMusicApi();

            var login = new LoginPanel(api);

            login.Login();

            Console.WriteLine("Extracting your favorites...");
            var tracks    = api.GetListFavorites();
            var index     = 1;
            var tableData = new List <string[]>();
            var border    = 9;

            tracks.ForEach(x =>
            {
                var list = new string[4];

                var title = x.Title;
                if (title.Length >= border)
                {
                    title = $"{title.Substring(0, border)}...";
                }

                var artist = x.Artists.First().Name;
                if (artist.Length >= border)
                {
                    artist = $"{artist.Substring(0, border)}...";
                }
                var size = x.FileSize / 1024;

                list[0] = index.ToString();
                list[1] = title;
                list[2] = artist;
                list[3] = size.ToString();

                tableData.Add(list);

                index++;
            });

            Console.Clear();
            var table = new Table();

            table.SetHeader("#", "TITLE", "ARTIST", "SIZE");
            table.SetData(tableData);
            table.Show();

            var audio = new AudioPlayer(api, tracks);

            audio.Play();

            Console.ReadKey();
        }
Exemple #16
0
 public YLibraryAddRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
Exemple #17
0
 public YRequest(YandexMusicApi yandex, AuthStorage auth)
 {
     api     = yandex;
     storage = auth;
 }
 public YAuthorizeRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
Exemple #19
0
 public YGetTrackRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
Exemple #20
0
 public YGetStationRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
 public YTrackAPI(YandexMusicApi yandex) : base(yandex)
 {
 }
 public YGetArtistRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
 public YSearchRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
Exemple #24
0
 public YPlaylistRenameRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
 public YArtistAPI(YandexMusicApi yandex) : base(yandex)
 {
 }
 public YGetLibrarySectionRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
Exemple #27
0
 public YGetPlaylistFavoritesRequest(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
 public YSetSettings2Request(YandexMusicApi yandex, AuthStorage storage) : base(yandex, storage)
 {
 }
 public YPlaylistAPI(YandexMusicApi yandex) : base(yandex)
 {
 }
 public YRadioAPI(YandexMusicApi yandex) : base(yandex)
 {
 }