Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
easy question about cd's
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
payam
Tux's lil' helper
Tux's lil' helper


Joined: 30 Jun 2003
Posts: 145

PostPosted: Sat Aug 09, 2003 4:59 pm    Post subject: easy question about cd's Reply with quote

if i stick a cd into my system and mount it at /mnt/cdrom, how can i know what the "cd label" is?
_________________
Athlon XP 2800+ 2.08GHz 333FSB 512KB, Biostar M7NCD Pro nForce2, 1GB Crucial DDR 333, EVGA Geforce FX 5600 256MB, Hitachi 180GB 180GXP
Back to top
View user's profile Send private message
spock_
Retired Dev
Retired Dev


Joined: 13 Jun 2003
Posts: 84
Location: Poland, Earth

PostPosted: Sat Aug 09, 2003 6:11 pm    Post subject: Reply with quote

You could use this:
Code:
data="`dd if=/dev/cdroms/cdrom0 ibs=1024 skip=32 count=1 2>/dev/null`"
echo "Label:" ${data:39:32}
Back to top
View user's profile Send private message
NiklasH
Apprentice
Apprentice


Joined: 30 Aug 2002
Posts: 211
Location: On top of something

PostPosted: Sat Aug 09, 2003 10:09 pm    Post subject: Reply with quote

spock_ wrote:
You could use this:
Code:
data="`dd if=/dev/cdroms/cdrom0 ibs=1024 skip=32 count=1 2>/dev/null`"
echo "Label:" ${data:39:32}


Wow, that was easy... :wink:
There's got to be a simpler way?
Back to top
View user's profile Send private message
drakonite
l33t
l33t


Joined: 02 Nov 2002
Posts: 768
Location: Lincoln, NE

PostPosted: Sat Aug 09, 2003 10:33 pm    Post subject: Reply with quote

NiklasH wrote:
spock_ wrote:
You could use this:
Code:
data="`dd if=/dev/cdroms/cdrom0 ibs=1024 skip=32 count=1 2>/dev/null`"
echo "Label:" ${data:39:32}


Wow, that was easy... :wink:
There's got to be a simpler way?


Put this in a file called getcdlabel (or something similar)
Code:

#!/bin/bash
data="`dd if=/dev/cdroms/cdrom0 ibs=1024 skip=32 count=1 2>/dev/null`"
echo "Label:" ${data:39:32}


The chmod +x it and put a copy of it in /usr/bin

Then to get the label from a CD just do:
Code:

getcdlabel


You can even add it to your WM's menu or something ;)

Or there is a program in portage that grabs cd labels that you could just emerge, but I'm not sure what it's called.
_________________
Shoot Pixels Not People

My GPG/PGP Public key
Back to top
View user's profile Send private message
NiklasH
Apprentice
Apprentice


Joined: 30 Aug 2002
Posts: 211
Location: On top of something

PostPosted: Sat Aug 09, 2003 10:37 pm    Post subject: Reply with quote

Yeah, of course you can put it in a script, but I thought that there has to be some program that already does this? Maybe a switch to mount or something, but I couldn't find any.

But if I put that in a script, then i won't have to worry about it again, so you're right about that :)
Back to top
View user's profile Send private message
drakonite
l33t
l33t


Joined: 02 Nov 2002
Posts: 768
Location: Lincoln, NE

PostPosted: Sat Aug 09, 2003 10:53 pm    Post subject: Reply with quote

NiklasH wrote:
Yeah, of course you can put it in a script, but I thought that there has to be some program that already does this?


There is. I'm sure I've seen one in portage that does this... I just can't remember what it's called... You can try looking through /usr/portage/media-sound it might be in there.
_________________
Shoot Pixels Not People

My GPG/PGP Public key
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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