title
Products            Buy            Support Forum            Professional            About            Codec Central
 

Adding new tag deletes all existing tags & values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JFS
    • May 2012
    • 17

    Adding new tag deletes all existing tags & values

    I have a vb2010 project that allows user to enter new value for a tag - - e.g., "BACH" for Composer. convex.WriteIDTag(FileLocation, TagName, UserEnteredValue) If the tag already exists (e.g., "MOZART"), then the new value ("BACH") is written and everything works as it should. But if the tag Composer does not exist, this command not only fails to add the new tag and value, it wipes out all of the other existing tags and values (e.g., Artist, Length, etc.).

    The tags for the files were originally written with DMC. I can edit the tags manually and add a new tag manually. Any explanation/fix for this behavior? I would like to be able to add new tags, not just edit existing ones through my vb2010 project.
  • Spoon
    Administrator
    • Apr 2002
    • 43891

    #2
    Re: Adding new tag deletes all existing tags & values

    Which audio format and which tag type?

    dBpoweramp does not intentionally do this, it appends tags only overwriting exact matches.
    Spoon
    www.dbpoweramp.com

    Comment

    • JFS
      • May 2012
      • 17

      #3
      Re: Adding new tag deletes all existing tags & values

      The audio format is .m4a. I am not sure how to figure out what tag type (I am reading the data with AudioProperties and writing it to a DB). In Windows, I have access both to "Audio Properties" (which has a dropdown saying "dBpoweramp" then "Copy to Clipboard") and to "ID-Tag" (which begins with "dBpoweramp:" ). After trying to add a new tag, as described above, data in both Audio Properties and ID-Tag is wiped out. I can add a new tag and value through "ID-Tag" in Windows; it is just WriteIDTag that fails when trying to add a new tag and value programmatically.

      Comment

      • dbfan
        dBpoweramp Guru
        • Jan 2011
        • 937

        #4
        Re: Adding new tag deletes all existing tags & values

        If audio properties is being wiped out it suggests the file is then corrupted, can you play the file?

        Comment

        • JFS
          • May 2012
          • 17

          #5
          Re: Adding new tag deletes all existing tags & values

          I can play the file before trying to add the new tag programatically; after trying to add the new tag (and there is never an error message), I cannot play the file. So writeIDtag corrupts the file if the tag does not already exist? Any idea why that would be, if I can add the new tag manually?

          Comment

          • Spoon
            Administrator
            • Apr 2002
            • 43891

            #6
            Re: Adding new tag deletes all existing tags & values

            Please post some simple code showing your tag writing.
            Spoon
            www.dbpoweramp.com

            Comment

            • JFS
              • May 2012
              • 17

              #7
              Re: Adding new tag deletes all existing tags & values

              This reads data (UserEnteredInfo) from a db column, then assigns the appropriate tag (dicto(CI) = , e.g., "Composer") based on the db view displayed and column edited (CI). FixiItSelectedLoco is the filename whose tag is being edited. This works correctly when the tag exists; when the tag does not exist, no error is caught, but all the existing tags are wiped out and the file will not play.

              Private Sub Changex(dictctr As Int16, CI As Int16)
              Dim dicto As New Dictionary(Of Integer, String)
              Select Case dictctr
              Case 0
              dicto = TotalDictionary
              Case 1
              dicto = StandardDictionary
              Case 2
              dicto = TechDictionary
              End Select


              Try
              convex.WriteIDTag(FixItSelectedLoco, dicto(CI), UserEnteredInfo)
              Catch eprob as exception
              msgbox("Could not change " + dicto(CI) + " in " + FixItSelectedLoco + ".")
              End Try
              Last edited by JFS; 02-22-2013, 10:07 PM.

              Comment

              • JFS
                • May 2012
                • 17

                #8
                Re: Adding new tag deletes all existing tags & values

                Anything to investigate on this? Seems wrong that I can programmatically edit, but not add tags.

                Comment

                • Spoon
                  Administrator
                  • Apr 2002
                  • 43891

                  #9
                  Re: Adding new tag deletes all existing tags & values

                  Just ran a test, created an Apple Lossless m4a file (z:\a.m4a), the file had ID Tags but no composer, then created a write.vbs file and added:

                  ' create shell object
                  Set WshShell = CreateObject("WScript.Shell")

                  ' Create dMC Object
                  Set dMC = CreateObject("dMCScripting.Converter")


                  'Write an ID Tag
                  Call dMC.WriteIDTag("z:\a.m4a", "Composer", "BACH")


                  The final file was not corrupted. Please try the above code to test on your files.
                  Spoon
                  www.dbpoweramp.com

                  Comment

                  • JFS
                    • May 2012
                    • 17

                    #10
                    Re: Adding new tag deletes all existing tags & values

                    Yes, that works correctly for me in shell too. It adds the tag/value pair when the tag was not previously present. Does that mean that the problem has something to do with the DMCScriptingLib.dll used in the VB2010 project? I will try calling the script from vb2010, bypassing the referenced dll.

                    Comment

                    • Spoon
                      Administrator
                      • Apr 2002
                      • 43891

                      #11
                      Re: Adding new tag deletes all existing tags & values

                      They both use a com object, the same DLL...
                      Spoon
                      www.dbpoweramp.com

                      Comment

                      • JFS
                        • May 2012
                        • 17

                        #12
                        Re: Adding new tag deletes all existing tags & values

                        The shell script you wrote worked for me in shell; but when I call it from within vb2010, the file is again corrupted/unreadable. This is the script I call, passing the filename of the file to which a tag is being added from VB2010 to script as nomen.

                        ' create shell object
                        Set WshShell = CreateObject("WScript.Shell")
                        dim nomen
                        nomen = WScript.Arguments(0)

                        msgbox("Filename = " & nomen)

                        ' Create dMC Object
                        Set dMC = CreateObject("dMCScripting.Converter")

                        'Write an ID Tag
                        Call dMC.WriteIDTag(nomen, "Composer", "Beet1")

                        In VB2010, I am calling the script through: Process.Start("c:\test.vbs", CFN)

                        The script works correctly from the command line; how can the fact that the name is being passed from the VB2010 program prevent the script from working correctly? Is there something simple I am missing here?

                        UPDATE: I COPIED BACK THE CORRUPTED FILES, THEN RE-RAN THE VB2010 PROGRAM; THIS TIME IT PROPERLY ADDED THE TAG/VALUE PAIR.
                        Last edited by JFS; 02-25-2013, 07:32 PM.

                        Comment

                        • dbfan
                          dBpoweramp Guru
                          • Jan 2011
                          • 937

                          #13
                          Re: Adding new tag deletes all existing tags & values

                          Running the script from the command line, explorer, or in VB should make no difference, I have no clue what is happening

                          Comment

                          • JFS
                            • May 2012
                            • 17

                            #14
                            Re: Adding new tag deletes all existing tags & values

                            As a further test, I deleted files with the added tag, then copied them back without the tag, then ran the VB2010 program that calls the Shell VBScript 3 separate times. The first time, the VB2010 program added the tag/value pair to all 4 test files. The second time, it added the tag/value pair to 2 files and corrupted 2 files, then added to 3 files and corrupted 1. So calling the VB Script sometimes works, calling WriteIDTag from within VB2010 never works, when tag is not already present (can edit, but not create).

                            I cannot figure this out either, including why calling the Script only sometimes works.

                            Thank you for the help to date.

                            Comment

                            Working...

                            ]]>