Size of hard drive and Mp3 tags functions

J

John Hicken

I'm creating a Python program to pick a random set of mp3s, to copy to
my mp3 player, so I can regularly get a new set to listen to.

Anyway, there are two sorts of functions that could be useful.
1) A function that gives the size of a hard drive (or other drive, in
this case the mp3 player itself), and/or the space remaining.
2)A function/functions to read the ID tags of an MP3 file.

Doesn't anyone here know if functions like that exist for Python?
Ideally these would be built-in functions, or in the modules that come
with Python. This is for Windows by the way.

John Hicken
 
D

Dennis Lee Bieber

Anyway, there are two sorts of functions that could be useful.
1) A function that gives the size of a hard drive (or other drive, in
this case the mp3 player itself), and/or the space remaining.

Presuming the device shows up as a disk device in Windows... From
the win32api (ActiveState) help file:

win32file.GetDiskFreeSpaceEx
long, long, long = GetDiskFreeSpaceEx(rootPathName)

Determines the free space on a device.


Parameters

rootPathName : PyUnicode

address of root path

Return Value
The result is a tuple of long integers:

Items

[0] long integer : freeBytes

The total number of free bytes on the disk that are available to the
user associated with the calling thread.

[1] long integer : totalBytes

The total number of bytes on the disk that are available to the user
associated with the calling thread. Windows 2000: If per-user quotas are
in use, this value may be less than the total number of bytes on the
disk.

[2] long integer : totalFreeBytes

The total number of free bytes on the disk.

2)A function/functions to read the ID tags of an MP3 file.
http://www.google.com/search?hl=en&q=python+mp3+ID+tag&btnG=Google+Search
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
J

John Hicken

Dennis said:
Anyway, there are two sorts of functions that could be useful.
1) A function that gives the size of a hard drive (or other drive, in
this case the mp3 player itself), and/or the space remaining.

Presuming the device shows up as a disk device in Windows... From
the win32api (ActiveState) help file:

win32file.GetDiskFreeSpaceEx
long, long, long = GetDiskFreeSpaceEx(rootPathName)

Determines the free space on a device.


Parameters

rootPathName : PyUnicode

address of root path

Return Value
The result is a tuple of long integers:

Items

[0] long integer : freeBytes

The total number of free bytes on the disk that are available to the
user associated with the calling thread.

[1] long integer : totalBytes

The total number of bytes on the disk that are available to the user
associated with the calling thread. Windows 2000: If per-user quotas are
in use, this value may be less than the total number of bytes on the
disk.

[2] long integer : totalFreeBytes

The total number of free bytes on the disk.

2)A function/functions to read the ID tags of an MP3 file.
http://www.google.com/search?hl=en&q=python+mp3+ID+tag&btnG=Google+Search
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/

Thanks for the help. As you gathered, the mp3 player just appears as a
hard drive, and the GetDiskFreeSpaceEx function does exactly what I
want. Also, the first id tag program for python from the google seach,
id3reader, seems to match what I want, as I won't need to alter the ID3
tags.

Thanks
John Hicken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top