Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Parse Filenames for extracting Tags

Parse Filenames for extracting Tags

Scheduled Pinned Locked Moved C / C++ / MFC
jsontutoriallounge
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Summi
    wrote on last edited by
    #1

    Hi everybody. I'm looking for a nice algo which I can use for parsing audio-files and extracting tags. The algo should have the possibility to define the structure of the filenames via a mask and wildcards. Several programmes make use of such a method, for example Tag&Rename: http://iserver.hta.fhz.ch/~iasummer/stuff/tagrename.gif I haven't found a good and free avaiable source code for parsing files like that, so any links or general information would be great!

    D 1 Reply Last reply
    0
    • S Summi

      Hi everybody. I'm looking for a nice algo which I can use for parsing audio-files and extracting tags. The algo should have the possibility to define the structure of the filenames via a mask and wildcards. Several programmes make use of such a method, for example Tag&Rename: http://iserver.hta.fhz.ch/~iasummer/stuff/tagrename.gif I haven't found a good and free avaiable source code for parsing files like that, so any links or general information would be great!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Are you wanting a masked edit control, or are you wanting to find files based on special characters (in addition to "*" and "?" which are already supported).


      "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

      M 1 Reply Last reply
      0
      • D David Crow

        Are you wanting a masked edit control, or are you wanting to find files based on special characters (in addition to "*" and "?" which are already supported).


        "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        me think he want to do the following : for a filename like "01-Pink Floyd-The Dark Side Of The Moog-Money.mp3" he wants to extract the song number, artist, album and track name. basically, a sscan.


        Maximilien Lincourt Your Head A Splode - Strong Bad

        D 1 Reply Last reply
        0
        • M Maximilien

          me think he want to do the following : for a filename like "01-Pink Floyd-The Dark Side Of The Moog-Money.mp3" he wants to extract the song number, artist, album and track name. basically, a sscan.


          Maximilien Lincourt Your Head A Splode - Strong Bad

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Maximilien wrote: basically, a sscan. I assume you mean sscanf(). If so, then something like the following would work:

          char *lp = "01-Pink Floyd-The Dark Side Of The Moog-Money.mp3",
          szNumber[8], szArtist[16], szAlbum[32], szTrack[16];
          sscanf(lp, "%[0-9]%*c%[^-]%*c%[^-]%*c%[^.]", szNumber, szArtist, szAlbum, szTrack);


          "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

          M S 2 Replies Last reply
          0
          • D David Crow

            Maximilien wrote: basically, a sscan. I assume you mean sscanf(). If so, then something like the following would work:

            char *lp = "01-Pink Floyd-The Dark Side Of The Moog-Money.mp3",
            szNumber[8], szArtist[16], szAlbum[32], szTrack[16];
            sscanf(lp, "%[0-9]%*c%[^-]%*c%[^-]%*c%[^.]", szNumber, szArtist, szAlbum, szTrack);


            "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #5

            yep, sscanf ... ;)


            Maximilien Lincourt Your Head A Splode - Strong Bad

            1 Reply Last reply
            0
            • D David Crow

              Maximilien wrote: basically, a sscan. I assume you mean sscanf(). If so, then something like the following would work:

              char *lp = "01-Pink Floyd-The Dark Side Of The Moog-Money.mp3",
              szNumber[8], szArtist[16], szAlbum[32], szTrack[16];
              sscanf(lp, "%[0-9]%*c%[^-]%*c%[^-]%*c%[^.]", szNumber, szArtist, szAlbum, szTrack);


              "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

              S Offline
              S Offline
              Summi
              wrote on last edited by
              #6

              Yeah, sscanf looks like the thing I need. I have to write a programme where the user can specify the structure of a file to get the tags from the filename. E.g. if you have an MP3 Files with the structure like this: "01-Pink Floyd-Dark Side Of The Moon_SPEAK TO ME.mp3" "02-Pink Floyd-Dark Side Of The Moon_breathe in the air.mp3" The user should have the possibility to enter the mask like this %t-%a_%s (or -_) the programme should now parse the filename and set the params for track album and song. I've seen a mask editor in several programmes (e.g. Tag&Rename). If you could provide me with some more codesamples, that would be great (I'm a newbie to C++). BTW, In a next step, our programme should analyze the filenames and suggest a mask by itself.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups