public form_id3_editor(Metadata pMetadata, string pUserPropertary, string pMode)
 {
     this._UserSongName = pUserPropertary;
     this._MetadataToEdit = pMetadata;
     this._UploadMode = pMode;
     InitializeComponent();
     this.paintActualMetadata();
 }
Exemplo n.º 2
0
 public void setID3(Metadata pMetadata)
 {
     var taglibFile = TagLib.File.Create(pMetadata._SongDirectory);
     taglibFile.Tag.Title = pMetadata._ID3Title;
     string[] artists = {pMetadata._ID3Artist};
     taglibFile.Tag.Performers = artists;
     string[] genres = { pMetadata._ID3Genre };
     taglibFile.Tag.Genres = genres;
     taglibFile.Tag.Album = pMetadata._ID3Album;
     taglibFile.Tag.Comment = pMetadata._ID3Comment;
     taglibFile.Tag.Lyrics = pMetadata._ID3Lyrics;
     uint pYearParse = 0;
     uint.TryParse(pMetadata._ID3Year, out pYearParse);
     taglibFile.Tag.Year = pYearParse;
     taglibFile.Save();
 }
Exemplo n.º 3
0
 public Metadata getID3ByDirectory(string pDirectory)
 {
     Metadata id3op = new Metadata();
     TagLib.File tagFile = TagLib.File.Create(pDirectory);
     List<string> p = new List<string>();
     id3op._SongDirectory = pDirectory;
     id3op._ID3Title = tagFile.Tag.Title;
     id3op._ID3Album = tagFile.Tag.Album;
     id3op._ID3Year = (tagFile.Tag.Year.ToString());
     id3op._ID3Comment = tagFile.Tag.Comment;
     id3op._ID3Lyrics = tagFile.Tag.Lyrics;
     if (tagFile.Tag.Genres.Length > 0)
     {
         id3op._ID3Genre = tagFile.Tag.Genres[0];
     }
     if (tagFile.Tag.Performers.Length > 0)
     {
         id3op._ID3Artist = tagFile.Tag.Performers[0];
     }
     return id3op;
 }
 //listo
 public async void createSong(Metadata pMetadataInitial)
 {
     RestTools rtop = new RestTools();
     Song songop = await rtop.createSong(pMetadataInitial._SongDirectory);
     if(songop == null)
     {
         Console.WriteLine("Canción No Fue Creada");
     }
     else
     {
         pMetadataInitial._SongID = songop.song_id.ToString();
         Song songtop = await rtop.createVersion(pMetadataInitial);
         if(songtop == null)
         {
             MessageBox.Show(("Primera Versión Creada"));
         }
         else
         {
             Console.WriteLine("Primera NO FUE Versión Creada");
         }
     }
 }
 //listo
 public async void createMetadataVersionCloud(Metadata pMetadataVersion)
 {
     RestTools rtop = new RestTools();
     Song songop = await rtop.createVersion(pMetadataVersion);
 }
 //listo
 public void createMetadataVersionLocal(Metadata pMetadataVersion)
 {
     TagManager tmop = new TagManager();
     tmop.setID3(pMetadataVersion);
 }
Exemplo n.º 7
0
        public Version(Metadata met)
        {
            song_id = Convert.ToInt32(met._SongID);

            id3v2_title = met._ID3Title;
            id3v2_author = met._ID3Artist;
            id3v2_album = met._ID3Album;
            id3v2_year = Convert.ToInt32(met._ID3Year);
            id3v2_genre = met._ID3Genre;
            id3v2_lyrics = met._ID3Lyrics;
            submission_date = met._SubmissionDate;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Obtiene todas las canciones de un usario y su metadata
        /// </summary>
        /// <param name="user_name">
        /// nombre del usuario
        /// </param>
        /// <returns>
        /// Lista de objetos metadata 
        /// </returns>
        public async Task<List<Metadata>> getMetadataSongByUser(string user_name)
        {
            List<Metadata> songs_metadata = new List<Metadata>();

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(server_url);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(format));

                HttpResponseMessage response = await client.GetAsync(songs_by_user_path + "/" + user_name);

                MetadataAndSong[] sngs_n_met = await response.Content.ReadAsAsync<MetadataAndSong[]>();

                for (int i = 0; i < sngs_n_met.Length; i++)
                {
                    Metadata song_met = new Metadata();

                    song_met._ID3Artist = (sngs_n_met[i].id3v2_author);

                    song_met._ID3Title = (sngs_n_met[i].id3v2_title);
                    song_met._ID3Album = (sngs_n_met[i].id3v2_album);
                    song_met._ID3Year = (sngs_n_met[i].year.ToString());
                    song_met._ID3Genre = (sngs_n_met[i].id3v2_genre);
                    song_met._ID3Lyrics = (sngs_n_met[i].id3v2_lyrics);
                    song_met._SongID = (sngs_n_met[i].song_id.ToString());
                    song_met._ID3Title = (sngs_n_met[i].song_name);
                    song_met._SongDirectory = (sngs_n_met[i].song_directory);
                    song_met._SubmissionDate = (sngs_n_met[i].submission_date);
                    songs_metadata.Add(song_met);
                }
            }
            return songs_metadata;

        }
Exemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="met"></param>
        /// <returns></returns>
        public async Task<Song> createVersion(Metadata met)
        {
            Song song;

            Version ver = new Version(met);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(server_url);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(format));

                HttpResponseMessage response = await client.PostAsJsonAsync(versions_path, ver);

                if (response.IsSuccessStatusCode)
                {
                    ver = await response.Content.ReadAsAsync<Version>();

                    song = await getSongById(Convert.ToInt32(met._SongID));

                    song.metadata_id = ver.version_id;

                    HttpResponseMessage updsng = await client.PutAsJsonAsync<Song>(songs_path + "/" + song.song_id, song);

                    if (updsng.IsSuccessStatusCode)
                    {
                        Console.WriteLine("\nSe creo correctamente, metadata_id {0}", song.metadata_id);
                    }
                    else
                    {
                        song = null;
                        Console.WriteLine("\nError {0}", updsng.StatusCode);
                    }
                }
                else
                {
                    song = null;
                }

                return song;
            }
        }