Robert
Robert

Reputation: 21

Python file metadata

I posted this earlier but it got put on hold as too vague. Hopefully this clears it up.

I'm looking to populate a table (size x*y, for x items and y properties) from the file metadata in a folder. Specifically I'm looking at music files, so the properties are: year, length, and genre.

I tried looking at questions related to file properties, but those just came back with file size, date last modified, etc.

It's just a for loop:

f = open("output.txt", "w")  
for files in folder:  
    year[] += file.year  
    genre[] += file.genre  
    length[] += file.length
    f.write(file.year + "\t" + file.genre + "\t" + file.length + "\n")

I just don't know what the python functions are for accessing the metadata, to replace 'file.year' and etc.

EDIT: I haven't been able to install anything via 'pip' on my computer - is there a trick to it or something? I'm on Windows 7.

Upvotes: 2

Views: 2538

Answers (1)

phd
phd

Reputation: 94417

You need libraries that parse audio files and extract metadata like eyeD3, Mutagen and such.

Upvotes: 1

Related Questions