View previous topic :: View next topic |
Author |
Message |
payam Tux's lil' helper
Joined: 30 Jun 2003 Posts: 145
|
Posted: Sat Aug 09, 2003 4:59 pm Post subject: easy question about cd's |
|
|
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 |
|
|
spock_ Retired Dev
Joined: 13 Jun 2003 Posts: 84 Location: Poland, Earth
|
Posted: Sat Aug 09, 2003 6:11 pm Post subject: |
|
|
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 |
|
|
NiklasH Apprentice
Joined: 30 Aug 2002 Posts: 211 Location: On top of something
|
Posted: Sat Aug 09, 2003 10:09 pm Post subject: |
|
|
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...
There's got to be a simpler way? |
|
Back to top |
|
|
drakonite l33t
Joined: 02 Nov 2002 Posts: 768 Location: Lincoln, NE
|
Posted: Sat Aug 09, 2003 10:33 pm Post subject: |
|
|
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...
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:
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 |
|
|
NiklasH Apprentice
Joined: 30 Aug 2002 Posts: 211 Location: On top of something
|
Posted: Sat Aug 09, 2003 10:37 pm Post subject: |
|
|
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 |
|
|
drakonite l33t
Joined: 02 Nov 2002 Posts: 768 Location: Lincoln, NE
|
Posted: Sat Aug 09, 2003 10:53 pm Post subject: |
|
|
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 |
|
|
|