public AudioFile(string name, int id, AudioGenre genre, TimeSpan duration) { Name = name; Id = id; Genre = genre; Duration = duration; }
public AudioFile(string resourceName, TimeSpan duration, AudioGenre genre, string name, string imageResource) { _resourceName = resourceName; _imageResource = imageResource; Duration = duration; Genre = genre; Name = name; }
private void AudioSongEditor_Load(object sender, EventArgs e) { this.ArtistTextBox.Text = _Audio.Artist; this.TitleTextBox.Text = _Audio.Title; if (_Audio.LyricsId != null) { this.LyricsTextBox.Text = _AudioApi.GetText(Convert.ToInt64(_Audio.LyricsId)); } foreach (var genre in AudioGenre.GetRegistered()) { this.GenreComboBox.Items.Add(genre.ToString()); } this.GenreComboBox.SelectedIndex = this.GenreComboBox.Items.IndexOf(AudioGenre.FromVkNet(_Audio.Genre).Name); }
public long Edit(long audioId, long ownerId, string artist, string title, string text, bool? noSearch = null, AudioGenre? genreId = AudioGenre.Other) { var parameters = new AudioEditParams { AudioId = audioId, OwnerId = ownerId, Artist = artist, Title = title, Text = text, NoSearch = noSearch, GenreId = genreId }; return Edit(parameters); }
public bool GetGenreName(int genreId, string genreCategory, string genreCulture, out string genreName) { genreName = null; try { string labelName = null; if (GenreCategory.Movie == genreCategory || GenreCategory.Series == genreCategory) { VideoGenre genre = (VideoGenre)genreId; labelName = $"Video.{genre.ToString()}"; } else if (GenreCategory.Music == genreCategory) { AudioGenre genre = (AudioGenre)genreId; labelName = $"Audio.{genre.ToString()}"; } else if (GenreCategory.Epg == genreCategory) { EpgGenre genre = (EpgGenre)genreId; labelName = $"Epg.{genre.ToString()}"; } else { return(false); } if (string.IsNullOrEmpty(genreCulture)) { genreCulture = DEFAULT_LANGUAGE; } else if (genreCulture.Contains("-")) { genreCulture = new CultureInfo(genreCulture).Parent.Name; } return(GenreStringManager.TryGetGenreString("Label", labelName, genreCulture, out genreName)); } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Warn("GenreProvider: Error getting genre name {0}", ex, genreId); return(false); } }
public ReadOnlyCollection<Audio> GetPopular(bool onlyEng = false, AudioGenre? genre = null, uint? count = null, uint? offset = null) { var parameters = new VkParameters { {"only_eng", onlyEng}, {"genre_id", genre}, {"offset", offset} }; if (count <= 1000) { parameters.Add("count", count); } VkResponseArray response = _vk.Call("audio.getPopular", parameters); return response.ToReadOnlyCollectionOf<Audio>(x => x); }
/// <summary> /// Редактирует данные аудиозаписи на странице пользователя или группы. /// </summary> /// <param name="audioId">id аудиозаписи</param> /// <param name="ownerId">id владельца аудиозаписи. Если редактируемая аудиозапись находится на странице группы, в этом параметре должно стоять значение, равное -id группы.</param> /// <param name="artist">Название исполнителя аудиозаписи.</param> /// <param name="title">Название аудиозаписи.</param> /// <param name="text">Текст аудиозаписи, если введен.</param> /// <param name="noSearch">true - скрывает аудиозапись из поиска по аудиозаписям, false (по умолчанию) - не скрывает.</param> /// <param name="genre_id">дентификатор жанра из списка аудио жанров.</param> /// <returns> /// id текста, введенного пользователем /// </returns> /// <exception cref="System.ArgumentNullException"> /// artist;Artist parameter can not be null. /// or /// title;Title parameter can not be null. /// or /// text;Text parameter can not be null. /// </exception> /// <remarks> /// Для вызова этого метода Ваше приложение должно иметь права с битовой маской, содержащей <see cref="Settings.Audio" />. /// Страница документации ВКонтакте <see href="http://vk.com/dev/audio.edit" />. /// </remarks> public ulong Edit(ulong audioId, long ownerId, string artist, string title, string text, bool noSearch = false, AudioGenre? genre_id = AudioGenre.Other) { if (artist == null) throw new ArgumentNullException("artist", "Artist parameter can not be null."); if (title == null) throw new ArgumentNullException("title", "Title parameter can not be null."); if (text == null) throw new ArgumentNullException("text", "Text parameter can not be null."); var parameters = new VkParameters { { "aid", audioId }, { "oid", ownerId }, { "artist", artist }, { "title", title }, { "text", text }, { "no_search", noSearch }, { "genre_id", genre_id } }; return _vk.Call("audio.edit", parameters); }
public ReadOnlyCollection<Audio> GetAllPopular(bool onlyEng = false, AudioGenre? genre = null) { const int count = 1000; var i = 0; var result = new List<Audio>(); do { var currentItems = _audio.GetPopular(onlyEng, genre, count, i * count); if (currentItems != null) result.AddRange(currentItems); } while (++i * count < (_vk.CountFromLastResponse ?? 0)); return result.ToReadOnlyCollection(); }
public AudioFile(string name, int id, AudioGenre genre, int duration) : this(name, id, genre, TimeSpan.FromSeconds(duration)) { }
public EntityList<Audio> GetRecommendationsSync( AudioGenre? genreId = null, bool? onlyEng = null, int? offset = null, int? count = 100 ) { var task = _parent.Executor.ExecAsync( _parent._reqapi.Audio.GetRecommendations( genreId,onlyEng,offset, count ) ); task.Wait(); return task.Result.Response; }
public async Task <EntityList<Audio>> GetRecommendations( AudioGenre? genreId = null, bool? onlyEng = null, int? offset = null, int? count = 100 ) { return ( await _parent.Executor.ExecAsync( _parent._reqapi.Audio.GetRecommendations( genreId,onlyEng,offset, count ) ).ConfigureAwait(false) ).Response; }
public Request<EntityList<Audio>> GetRecommendations( AudioGenre? genreId = null, bool? onlyEng = null, int? offset = null, int? count = 100 ) { var req = new Request<EntityList<Audio>>{ MethodName = "audio.getRecommendations", Parameters = new Dictionary<string, string> { { "genre_id", MiscTools.NullableString( (int?)genreId )}, { "only_eng", (onlyEng != null ? ( onlyEng.Value ? 1 : 0 ).ToNCString() : "")}, { "offset", offset.NullableString() }, { "count", count.NullableString() }, } }; if (_parent.IsLogged) req.Token = _parent.CurrentToken; return req; }
public Request<int> Edit( int ownerId , long audioId , string artist = "", string title = "", string text = "", AudioGenre? genreId = null, bool? noSearch = null ) { var req = new Request<int>{ MethodName = "audio.edit", Parameters = new Dictionary<string, string> { { "owner_id", ownerId.ToNCString()}, { "audio_id", audioId.ToNCString()}, { "artist", artist}, { "title", title}, { "text", text}, { "genre_id", MiscTools.NullableString( (int?)genreId )}, { "no_search", (noSearch != null ? ( noSearch.Value ? 1 : 0 ).ToNCString() : "")}, } }; req.Token = _parent.CurrentToken; return req; }
public async Task<string> GetRecommendations( AudioGenre? genreId = null, bool? onlyEng = null, int? offset = null, int? count = 100 ){ return await _parent.Executor.ExecRawAsync( _parent._reqapi.Audio.GetRecommendations( genreId,onlyEng,offset, count ) ).ConfigureAwait(false); }
public ReadOnlyCollection<Audio> GetPopular(bool onlyEng = false, AudioGenre? genre = null, int? count = null, int? offset = null) { VkErrors.ThrowIfNumberIsNegative(() => offset); VkErrors.ThrowIfNumberIsNegative(() => count); var parameters = new VkParameters { {"only_eng", onlyEng}, {"genre_id", genre}, {"offset", offset}, {"count", count} }; VkResponseArray response = _vk.Call("audio.getPopular", parameters); return response.ToReadOnlyCollectionOf<Audio>(x => x); }
public AudioItem(double duration, string title, string path, bool?like, Artist artist, Album album, AudioGenre genre) : base(duration, title, path, like) { Artist = artist; Album = album; Genre = genre; }
public async Task <int> Edit( int ownerId , long audioId , string artist = "", string title = "", string text = "", AudioGenre? genreId = null, bool? noSearch = null ) { return ( await _parent.Executor.ExecAsync( _parent._reqapi.Audio.Edit( ownerId,audioId,artist,title,text,genreId,noSearch ) ).ConfigureAwait(false) ).Response; }
private void OKBtn_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; _AudioApi.Edit(Convert.ToInt64(_Audio.Id), Convert.ToInt64(_Audio.OwnerId), this.ArtistTextBox.Text, this.TitleTextBox.Text, AudioGenre.GetByName(this.GenreComboBox.Text), this.LyricsTextBox.Text, this.HideSearchCheck.Checked); } finally { this.Cursor = Cursors.Default; } this.Close(); }
public int EditSync( int ownerId , long audioId , string artist = "", string title = "", string text = "", AudioGenre? genreId = null, bool? noSearch = null ) { var task = _parent.Executor.ExecAsync( _parent._reqapi.Audio.Edit( ownerId,audioId,artist,title,text,genreId,noSearch ) ); task.Wait(); return task.Result.Response; }