Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Determine the Volume label of a CD
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
carambola5
Apprentice
Apprentice


Joined: 10 Jul 2002
Posts: 214
Location: Madtown, WI

PostPosted: Sat Aug 16, 2003 10:37 pm    Post subject: Determine the Volume label of a CD Reply with quote

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!
_________________
Get Firefox!

Proper Web Development

I'm done at 999.
Back to top
View user's profile Send private message
aequitas
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 190
Location: Ooy bij arnhem

PostPosted: Thu Aug 25, 2005 8:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Thu Aug 25, 2005 10:20 pm    Post subject: Reply with quote

Have you tried "volname" from sys-apps/eject?
_________________
Ciao da me!
Back to top
View user's profile Send private message
aequitas
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 190
Location: Ooy bij arnhem

PostPosted: Thu Aug 25, 2005 10:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
phsdv
Guru
Guru


Joined: 13 Mar 2005
Posts: 372
Location: Europe

PostPosted: Sat Aug 27, 2005 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Headrush
Watchman
Watchman


Joined: 06 Nov 2003
Posts: 5597
Location: Bizarro World

PostPosted: Sat Aug 27, 2005 12:17 pm    Post subject: Re: Determine the Volume label of a CD Reply with quote

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. :P
Back to top
View user's profile Send private message
phsdv
Guru
Guru


Joined: 13 Mar 2005
Posts: 372
Location: Europe

PostPosted: Sat Aug 27, 2005 7:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
aequitas
Apprentice
Apprentice


Joined: 28 Aug 2002
Posts: 190
Location: Ooy bij arnhem

PostPosted: Sun Aug 28, 2005 6:40 pm    Post subject: Reply with quote

neat :)
_________________
I am not superstitious, that brings bad luck.
Back to top
View user's profile Send private message
Hikaru79
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2005
Posts: 120
Location: Windsor, Ontario (Canada)

PostPosted: Sun Aug 28, 2005 6:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
phsdv
Guru
Guru


Joined: 13 Mar 2005
Posts: 372
Location: Europe

PostPosted: Sun Aug 28, 2005 6:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hikaru79
Tux's lil' helper
Tux's lil' helper


Joined: 07 Apr 2005
Posts: 120
Location: Windsor, Ontario (Canada)

PostPosted: Sun Aug 28, 2005 7:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum