locked
Media Properties Title doenst Change / Update

    Question

  • Hi ,

    I'm trying to change the music properties but it doesn't change them. It doenst update title but all several properties os audio MP3 file but sometime it dienst change any of property.

    FOllowing is the code set properties gets and set the values in text box btn save updates the properties which causes problem.

     private async void SetProperties(){
                property = await selectedFile.Properties.GetMusicPropertiesAsync();
    
                txtAlbum.Text = property.Album;
                txtAlbumArtist.Text = property.AlbumArtist;
                txtArtist.Text = property.Artist;
                txtPublisher.Text = property.Publisher;
                txtRating.Text = property.Rating.ToString();
                txtSubtitle.Text = property.Subtitle;
                txtTitle.Text = property.Title;
                txtTrackNumber.Text = property.TrackNumber.ToString();
                txtYears.Text = property.Year.ToString();
                lblBitRate.Text = property.Bitrate.ToString();
                lblComposer.Text = string.Join(" , ", property.Composers.ToArray());
                lblConductors.Text = string.Join(" , ", property.Conductors.ToArray());
                lblDuration.Text = property.Duration.Minutes.ToString() + ":" + property.Duration.Seconds.ToString();
                lblGenre.Text = string.Join(" , ", property.Genre.ToArray());
                lblMediaTitle.Text = selectedFile.Name;
                txtFileName.Text = selectedFile.Name;
                lblFileType.Text = selectedFile.FileType;
                lblProducers.Text = string.Join(" , ", property.Producers.ToArray());
                lblWriters.Text = string.Join(" , ", property.Writers.ToArray());
            
            }
    
    private void btnSave_Click(object sender, RoutedEventArgs e)
            {
                //property = await selectedFile.Properties.GetMusicPropertiesAsync();
                property.Album = txtAlbum.Text;
                property.AlbumArtist = txtAlbumArtist.Text;
                property.Artist = txtArtist.Text;
                property.Publisher = txtPublisher.Text;
                property.Rating = uint.Parse(txtRating.Text);
                property.Subtitle = txtSubtitle.Text;
                property.Title = txtTitle.Text;
                property.TrackNumber = uint.Parse(txtTrackNumber.Text);
                property.Year = uint.Parse(txtYears.Text);
                SaveProperties(property,txtFileName.Text);   
            }
            private async void SaveProperties(Windows.Storage.FileProperties.MusicProperties prop , string Name) {
                await property.SavePropertiesAsync();
            }
            


    Thank You , Shan Ali Khan

    Friday, September 26, 2014 11:32 PM

Answers

  • Hi Shan Ali Khan,

    What do you mean by: It doenst update title but all several properties os audio MP3 file but sometime it dienst change any of property.

    And when you save the properties, is there any exception thrown, is there any invalid argument exception tell you which property is not correct set? Let's say here you show all the properties in the TextBox, if your user modify some of them to a unacceptable string or integer, your update/save action will definitely failed.

    For instance Rating, if your txtRating.Text is 10000 while in the documentation the range is from 0 - 99, you will not get this one saved. If one of your property is not a correct format, all of your properties will not get saved.

     property.Rating = uint.Parse(txtRating.Text);

    Please validate all your input value before saving them.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, September 29, 2014 6:24 AM
    Moderator

All replies

  • Hi Shan Ali Khan,

    What do you mean by: It doenst update title but all several properties os audio MP3 file but sometime it dienst change any of property.

    And when you save the properties, is there any exception thrown, is there any invalid argument exception tell you which property is not correct set? Let's say here you show all the properties in the TextBox, if your user modify some of them to a unacceptable string or integer, your update/save action will definitely failed.

    For instance Rating, if your txtRating.Text is 10000 while in the documentation the range is from 0 - 99, you will not get this one saved. If one of your property is not a correct format, all of your properties will not get saved.

     property.Rating = uint.Parse(txtRating.Text);

    Please validate all your input value before saving them.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, September 29, 2014 6:24 AM
    Moderator
  • when i debug there is no exception thrown. the problem simply runs these lines. also how i can save one by one property rather them saving them all at once it may help me to identity the problem

    can you please give me any link that shows the standard for music properties


    Thank You , Shan Ali Khan


    • Edited by Shan Khan Monday, September 29, 2014 11:39 AM
    Monday, September 29, 2014 11:30 AM