List mp3/jpg files in a directory, read tag/exif and write to XML file

Discussion in 'PHP' started by suyoggupta, Jun 1, 2007.

  1. #1
    Hi,
    I am a new born in PHP arena. After 1-2 months of wandering around, I am able to write a script that does the following tasks:

    1. Scan a directory for mp3 and jpg files
    ( you may add filters to accomodate more file types)
    2. For each mp3 and jpg file found, extract the tag data
    3. Write that data in a xml file

    This script is useful for web developers or any personal website that involves keeping a track of files. Currently it can get metadata out of mp3 files (album, artist, year and title) and also jpg files (length, width, datetime, camera-make)

    Future:
    In future I plan to call a script to generate a thumbnail for every jpg found.. also get album art from the mp3's..
    Please let me know any suggestions/:eek:bugs by email... email is suyog/at/aol/dot/in ;)

    IMPORTANT:
    Before running the script, make following changes:
    1. Make an empty XML file called members.xml
    2. Search for string httpdocs, replace this with the directory you are trying to read
    3. Be sure to put a couple of mp3's and jpg's in the directory you are scanning..
    4. Make sure you have read/write rights where your script resides..
     

    Attached Files:

    suyoggupta, Jun 1, 2007 IP
    MrX likes this.
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    How about modifying tag data? I don't like modifying through audio players and haven't found a good program that does this so if it has to be through a web interface, then so be it. I even considered doing this myself and found the code to do this at phpclasses.org but stopped there.
     
    krt, Jun 1, 2007 IP
  3. MrX

    MrX Well-Known Member

    Messages:
    1,563
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    140
    #3
    very nice will test it out
     
    MrX, Jun 1, 2007 IP
  4. e_hippie

    e_hippie Guest

    Messages:
    32
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    e_hippie, Jun 2, 2007 IP
  5. suyoggupta

    suyoggupta Peon

    Messages:
    2
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hey krt,
    If I got u correctly, you are looking desperately to bring some sanity to the tag data. I will work on my script to see if I can add tag write functionality. Wont be difficult, if I can read something, I can definitely write too..!
    Meanwhile, I suggest, on ur windows box with wmp11/10 right click on any
    mp3 file, go to summary tab, click on Advanced button at bottom... and u will see all the tags for editing.. same can be done from within wmp11 library tab...
     
    suyoggupta, Jun 3, 2007 IP