View previous topic :: View next topic |
Author |
Message |
carambola5 Apprentice
Joined: 10 Jul 2002 Posts: 214
|
Posted: Sat Aug 16, 2003 10:37 pm Post subject: Determine the Volume label of a CD |
|
|
It was so simple in Windows, all you had to do was pop in the CD, go to My Computer and look at the label.
well, in Linux, it isn't too hard either. You just need to know which tools to use. First, you need to:
Code: | emerge app-cdr/cdrtools |
Next you can simply type (with the CD mounted or not):
Code: | isoinfo -d -i /dev/cdroms/cdrom0 | Make sure to change the path to suit your system
You'll get a lot of information returned. You can simplify this by writing a simple script and placing it in your user's bin folder:
Code: | nano -w ~/bin/cdinfo |
Code: | #!/bin/bash
isoinfo -d -i /dev/cdroms/cdrom0 | grep "Volume id" | awk '{print $3}' |
Sorry for all the code blocks! |
|
Back to top |
|
|
aequitas Apprentice
Joined: 28 Aug 2002 Posts: 190 Location: Ooy bij arnhem
|
Posted: Thu Aug 25, 2005 8:32 pm Post subject: |
|
|
Thank you. Thank you very much. You don't know how long i have been searching for this.
Now i can finaly catalog my cd's with label names.
If i could just find something for python to read the label _________________ I am not superstitious, that brings bad luck. |
|
Back to top |
|
|
randomaze Bodhisattva
Joined: 21 Oct 2003 Posts: 9985
|
Posted: Thu Aug 25, 2005 10:20 pm Post subject: |
|
|
Have you tried "volname" from sys-apps/eject? _________________ Ciao da me! |
|
Back to top |
|
|
aequitas Apprentice
Joined: 28 Aug 2002 Posts: 190 Location: Ooy bij arnhem
|
Posted: Thu Aug 25, 2005 10:29 pm Post subject: |
|
|
nope but i will give it a try.
I now found a somewhat brute methode.
I read the cdrom device file at offset 0x8028 for 32 bytes.
Seems to work fine for now and it doesn't require a system function _________________ I am not superstitious, that brings bad luck. |
|
Back to top |
|
|
phsdv Guru
Joined: 13 Mar 2005 Posts: 372 Location: Europe
|
Posted: Sat Aug 27, 2005 10:47 am Post subject: |
|
|
aequitas wrote: | If i could just find something for python to read the label |
aequitas wrote: | I read the cdrom device file at offset 0x8028 for 32 bytes. |
So you are doing something like this?
Code: | def getvolume(cd):
f = open(cd,'rb')
f.seek(0x8028,0) #0x8028 bytes from begin
print f.read(32)
f.close()
getvolume("/dev/cdroms/cdrom0") |
|
|
Back to top |
|
|
Headrush Watchman
Joined: 06 Nov 2003 Posts: 5597 Location: Bizarro World
|
Posted: Sat Aug 27, 2005 12:17 pm Post subject: Re: Determine the Volume label of a CD |
|
|
carambola5 wrote: | It was so simple in Windows, all you had to do was pop in the CD, go to My Computer and look at the label. |
Well in KDE with desktop icons the icons appear with the volume name on the desktop. (Gnome should be the same)
If you're gonna compare it to Windows, compare it with a DE with similar power and setup. |
|
Back to top |
|
|
phsdv Guru
Joined: 13 Mar 2005 Posts: 372 Location: Europe
|
Posted: Sat Aug 27, 2005 7:21 pm Post subject: |
|
|
For the python lovers, I made a function that reads all headers of a CD or DVD, including the Volume label. No dependencies.
http://pauldevries-photo.chez.tiscali.fr/iso9660/index.html [EDIT]changed link to working one
example code:
Code: | import iso9660
# to test it works: see test function for usage.
iso9660.test("/dev/hdc")
iso9660.test("/dev/cdroms/cdrom1")
#get all
header=iso9660.readHeader("/dev/hdc")
print header['VolumeId']
print header['PublisherId']
# get only the label
print iso9660.getLabel("/dev/cdroms/cdrom0")
|
Last edited by phsdv on Sun Aug 28, 2005 8:14 pm; edited 2 times in total |
|
Back to top |
|
|
aequitas Apprentice
Joined: 28 Aug 2002 Posts: 190 Location: Ooy bij arnhem
|
Posted: Sun Aug 28, 2005 6:40 pm Post subject: |
|
|
neat _________________ I am not superstitious, that brings bad luck. |
|
Back to top |
|
|
Hikaru79 Tux's lil' helper
Joined: 07 Apr 2005 Posts: 120 Location: Windsor, Ontario (Canada)
|
Posted: Sun Aug 28, 2005 6:43 pm Post subject: |
|
|
I'm getting a dead link Quote: | Le site demandé n'est pas accessible par cette url.
Le webmaster du site n'a pas nommé correctement sa page d'accueil. | I'd really like to see this script, could you post it again? _________________ "The simplest schoolboy is now familiar with facts for which Archimedes would have sacrificed his life."
--Ernest Renan |
|
Back to top |
|
|
phsdv Guru
Joined: 13 Mar 2005 Posts: 372 Location: Europe
|
Posted: Sun Aug 28, 2005 6:50 pm Post subject: |
|
|
strange, the file is there. Maybe the server does not like the file extension .py
Please try this:
Code: | wget http://pauldevries-photo.chez.tiscali.fr/iso9660/iso9660.py |
In the mean time I'll make a 'download page' |
|
Back to top |
|
|
Hikaru79 Tux's lil' helper
Joined: 07 Apr 2005 Posts: 120 Location: Windsor, Ontario (Canada)
|
Posted: Sun Aug 28, 2005 7:24 pm Post subject: |
|
|
Thank you! I don't know why I didn't think of wget myself ^_^;;
It works like a charm _________________ "The simplest schoolboy is now familiar with facts for which Archimedes would have sacrificed his life."
--Ernest Renan |
|
Back to top |
|
|
|