title
Products            Buy            Support Forum            Professional            About            Codec Central
 

DMC scripting '.AudioProperties()' gives unexpected results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ForSerious
    dBpoweramp Enthusiast

    • Aug 2017
    • 96

    DMC scripting '.AudioProperties()' gives unexpected results

    I've got my script running in Python. I've auto-generated and translation layer between the dll and Python.
    Tagging functions work as expected.
    I need to sort all the files to be converted by duration. That should be contained in the string that AudioProperties(file) returns. All that function returns is a string of "dBpoweramp" though.


    Maybe if there's a way to do it with the CLI, I'll do that instead.
  • Spoon
    Administrator
    • Apr 2002
    • 44408

    #2
    Try the .vbs example, rem out the upper stuff

    Spoon
    www.dbpoweramp.com

    Comment

    • ForSerious
      dBpoweramp Enthusiast

      • Aug 2017
      • 96

      #3
      That does work. dBpoweramp is the last word in the pop-up it makes. I'm guessing my script print-out is removing everything before the last newline character.

      The text in the pop-up is highly formatted. I cannot select it to copy it. The Length is listed in a not-so-useful-for-sorting "3 minutes 1 second" format.
      Last edited by ForSerious; August 14, 2024, 03:20 AM.

      Comment

      • Spoon
        Administrator
        • Apr 2002
        • 44408

        #4
        dBpoweramp Control Centre >> Advanced

        there is the option of fixing the time presentation
        Spoon
        www.dbpoweramp.com

        Comment

        • ForSerious
          dBpoweramp Enthusiast

          • Aug 2017
          • 96

          #5
          Oh interesting. In the Pop-up Advanced settings, I checked "Hide 'dBpoweramp'" and now I get the message "Contains no audio, is zero bytes in size." when I run my script.

          I did find the option to fix the duration format. And it's fixed in that VBS example—but it's still not select-able to be able to copy it. Well, that's not the most important. I would rather my script be able to read the results.

          Maybe I can bridge the two, but I suspect that the result of .AudioProperties() is not a simple string even in that situation.

          Comment

          • ForSerious
            dBpoweramp Enthusiast

            • Aug 2017
            • 96

            #6
            Sorry but that's not an option:
            "Required:
            -infile="filename" // specifies input file to convert from, can be '-' for standard input
            -outfile="filename" // specifies output file
            -convert_to="Wave" // Codec converting to"

            There is no option to not convert the file with the CLI. And even if I used the test conversion codec (or whatever it is) I don't think the output was meant to be parsed. So it might be possible, but a lot of work.
            Last edited by ForSerious; August 16, 2024, 02:06 PM.

            Comment

            • Spoon
              Administrator
              • Apr 2002
              • 44408

              #7
              It was AI Spam and removed
              Spoon
              www.dbpoweramp.com

              Comment

              • ForSerious
                dBpoweramp Enthusiast

                • Aug 2017
                • 96

                #8
                I have figured out how to get VBS to write to the console. It only writes the last line to the console:
                Code:
                Contains :              Album Art, ID Tag [ID3v2.3]1670]   Bits: (none)   Free-Format
                Switching the same script back to using the pop-up window, it displays the full set of data.
                Can you rework this behavior?
                (I realize this whole scripting functionality might not have been touched in like twenty years, but it could be useful if it was actually compatible with any other program.)
                If not, my last and final attempt will be to write a new text file with the full info in VBS and read it with Python.

                Comment

                • ForSerious
                  dBpoweramp Enthusiast

                  • Aug 2017
                  • 96

                  #9
                  Ah-ha! The .AudioProperties() function is returning with mac style newline markers. If I run Replace(AudioProps, chr(13), vbNewLine) on it, I can get the full string in the command line.
                  I had to learn how to write it to a file and then notice that that's what it says in notepad, before I could figure this out. And it still stinks that my Python script can't get the same result. So I'm still calling a VB script form Python, and piping the result back in, to get the info I need.

                  Comment

                  • ForSerious
                    dBpoweramp Enthusiast

                    • Aug 2017
                    • 96

                    #10
                    Egad!
                    Two things: I was a fool to use the 'terminal' provided in Intellij—That's why I was only getting the last line of the full text. Running it with the provided Python Shell printed correctly.
                    And, I must have been defining the path wrong in my first python script. I made another one, and it can read the audio properties just fine. No need for any VBS. So all of this thread was basically me not seeing my own bad syntax. Sorry about that. I did have a journey learning though. If anyone else finds this thread looking to do something similar, the one thing I didn't mention, that might be needed, is you may have to run cscript.exe //H:CScript in an admin level command prompt before it will use the cscript interpreter by default.

                    Comment

                    Working...

                    ]]>