Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Apr 2020, 18:22
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Easily detect and launch what's in your CD|DVD tray(s)
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [19 Posts]   Goto page: 1, 2 Next
Author Message
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Fri 31 Jul 2015, 12:52    Post subject:  Easily detect and launch what's in your CD|DVD tray(s)
Subject description: whether an audio, video or data disc.
 

Hello, all.

This thread is an off-shoot from the discussion started here.
It was prompted by a remark by gcmartin.

BFN.

musher0

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Fri 31 Jul 2015, 12:57    Post subject:  

(Post transplanted from here)
~~~~~~~~
Edit: new version already. Please see next post.
~~~~~~~~
Many thanks for testing, gcmartin.

As I mentioned, that was an early draft. Which I tried to improve.

The following is still a draft. However, I believe that the audio disc
problem was solved by changing from mplayer to cdda-player.

For some reason, at least on this Puppy Precise-5.4.3, the CLI mplayer
never seemed to get enough cache space to play a song without hiccups.
Since ccda-player didn't complain like this, I used cdda-player.

I think that this 2nd draft also solves gcmartin's bootable disc problem.

Finally, I've introduced all kinds of checks for open and closed tray(s), if
the user has two CD/DVD devices or only one, whether one tray is open,
if there is a disc in each tray, etc. I tried to think of all the possibilities,
but I'm sure I missed a few. Test reports are welcome.

I know some of the apps used here are old, but they'll do for now. We
can change them once this script is debugged.

Although cddetect still plays a major role, I found it necessary to call
upon the cd-info, eject and yaf-splash utilities to round off the offering.

So please test to your heart's content! Thanks in advance.

BFN.

musher0

~~~~
(Please see new code in next post.)
~~~~

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Fri 31 Jul 2015, 13:09    Post subject:  

Hello all.

I think this is a round-up. It seems that all movie DVDs are UDF
formatted. Saved me a lot of time. If a CD or DVD is not audio, not
bootable, and not UDF, what is it? A generic data disc.

Yeah, there are originals who use UDF to store data, not movies. Oh
well, let's keep that "distinction" for the next version. BTW, if you know of
a ready-made, easy-to-understand list of CD | DVD data types, please
share it below? Thanks.


Note: I did find various of those lists on the web after writing the above.
But the discovery that cd-info has a setting to show the Table of Contents
helped more. Using that setting, you can see if there are any "video
object files" (*.vob) in the TOC. If there are, you can be sure the DVD is
a movie DVD.

Otherwise not much has changed in the script.

So here's v. 3. I think that'll do for a while!

Enjoy!

musher0

~~~~~~~~~~
Code:
#!/bin/ash
# ~/my-applications/bin/act-on-cddetect3.sh
# Wrapper/Launcher for cddetect
#
# Purpose: detect the CD/DVD disc type and launch accordingly.
# (Draft; please test. Certain disc types are still not covered.)
#
# Dependencies : cddetect, cdrecord, cd-info, yaf-splash, eject.
# AFAIK, all of those exist in all Puppies.
#
# V. 3: added detection of regular data CDs/DVDs.
#
# (c) Christian L'Écuyer (aka musher0 on the Puppy forum),
# Gatineau (Québec), Canada, 29-30 July 2015.
#### set -xe
# variables
MeSsAg=""
CDINF="cd-info --dvd --no-device-info --no-header --iso9660"

# functions
EjEcT () {
eject
[ $DVCS -gt 4 ] && eject /dev/sr1
exit
}
   
yaf () {
yaf-splash -placement top -bg SaddleBrown -fg cornsilk -fontsize large -text "$MeSsAg" -timeout 5
} # for message

# tests
TwoDiscS () {
if [ "`cddetect -d/dev/sr0`" != "no disc!" -a "`cddetect -d/dev/sr1`" != "no disc!" ];then
   MeSsAg="
 Your two devices each have a disc inserted
     or they are both open. Please insert
       only one disc and retry.
"
   yaf
   EjEcT
fi  # test for 2 media inserted.   
}

NoDiSc () {
if [ "`cddetect -d$DISC`" = "no disc!" ];then
   MeSsAg="
 Please insert a disc and retry.
"
   yaf
   EjEcT
fi
} # test for no media inserted.
# end of tests

# action
DaTaDiSc () {
[ -d /mnt/${DISC##*/} ] || mkdir -p /mnt/${DISC##*/}
mount -t iso9660 $DISC /mnt/${DISC##*/}
rox /mnt/${DISC##*/}
} # to view contents of bootable and generic data discs

ActOnType () {
# We double-check that all device trays are closed.
eject -t # default ok for /dev/sr0.
if [ "`cddetect -d$DISC | grep -o open`" = "open" ];then
   MeSsAg="
 Please close the tray of your
    2nd device and retry.
"
   yaf
   exit
fi # Reason: eject won't close a tray open at dev/sr1.

# Then we query the disc type.
   MeSsAg="
 Please wait while we
  query the disc type.
"
   yaf-splash -placement top-left -bg SaddleBrown -fg cornsilk -fontsize large -text "$MeSsAg" -timeout 4 &
TYP="`$CDINF $DISC | egrep -o -m 1 'bootable|audio|vob'`"

case $TYP in
   bootable)MeSsAg="
 This is a bootable data disc.
   Loading... Please wait...
"
     yaf &
     DaTaDiSc ;;
   
   audio)
   if [ "${DISC##*/}" = "sr1" ];then
      MeSsAg="
  Sorry... This player can only read
 audio from the 'cdrom' (1st) device.
   Please change device and retry.
"
      yaf
      EjEcT
      exit
   fi
   MeSsAg="
 This is an audio disc.
Loading... Please wait...
"
      yaf &
      cdda-player $DISC ;;
# Choice of player prompted by the fact that some
# mplayer's have a cache problem playing a CD,
# even with an enormous cache.

   vob)MeSsAg="
  This is a video disc.
 Loading... Please wait...
"
      yaf
      mplayer dvd://1 $DISC ;;
   
   *)MeSsAg="
 This is a generic data disc.
  Loading... Please wait...
"
     yaf &
     DaTaDiSc
# For those of us who create and use non-bootable data discs
# (especially DVDs and BRs) for storage.
#
# I think this rounds it up, but we check again, just in case.
     if [ $? -gt 0 ];then
      MeSsAg="
 Sorry... This script cannot
   process this media yet.
"
      yaf
     fi ;;
esac
}
# End of action
## End of functions

# main
DVCS="`cdrecord -devices | wc -l`"
case $DVCS in
   4)DISC="/dev/sr0"
   NoDiSc ;; # test if disc is inserted in only device.
   
   5)TwoDiscS # test for 2 media inserted.
   
     if [ "`cddetect -d/dev/sr0`" = "no disc!" ];then
      DISC="/dev/sr1"
      NoDiSc # test if there is a disc in the 2nd device.
      else
      DISC="/dev/sr0"
      fi ;; # For people with two CD/DVD devices. If the two are
# different, be careful not to insert a DVD disc in a CD device.
esac

ActOnType

### 30 ### set +xe
act-on-cddetect3.sh.gz
Description  Un-gz in /root/my-applications/bin and make executable. To run, type
< act-on-cddetect3.sh > (without the chevrons).
gz

 Download 
Filename  act-on-cddetect3.sh.gz 
Filesize  1.63 KB 
Downloaded  165 Time(s) 

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 6076
Location: King's Lynn, UK.

PostPosted: Sun 02 Aug 2015, 14:09    Post subject:  

Hi, musher0.

I don't know if this is of any use to you; it may not have the type of info that you're looking for...

http://www.libraries.psu.edu/tas/jca/ccda/docs/olac2012-1.pdf

Edit: This might be more along the lines of what you want:-

http://www.quepublishing.com/articles/article.aspx?p=1746162&seqNum=6

It's an article about various books on the subject, but if you scroll down, I think you'll find some quite useful information for your project. Hope that helps, anyway.



Regards,

Mike. Wink

_________________
MY 'PUPPY' PACKAGES

Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Sun 02 Aug 2015, 15:47    Post subject:  

Hello @Musher0. This tests were done on the same laptop as before. Not sure if the distro is important, but as before, it is a TahrPUP derivative, currently.
Code:
root# which act-on-cddetect3.sh
/root/my-applications/bin/act-on-cddetect3.sh
root# act-on-cddetect3.sh
eject: CD-ROM tray close command failed: Input/output error
EXIT="Exit on timeout"
^C

root#
root# act-on-cddetect3.sh
eject: CD-ROM tray close command failed: Input/output error
EXIT="Exit on timeout"
mount: block device /dev/sr0 is write-protected, mounting read-only
root# EXIT="Exit on timeout"
I get various "toast" messages on the audio disc (first use) and the video disc (2nd use).

On the video disc, a ROX was opened showing the 2 video files which makes up the video on that disc. (unlike the original script I tested on the other thread where the video disc did open a window and began playing).

On a subsequent launch of the command without removing the disc or opening its tray, I get 2 toast messages

and then this occurs:
Code:
root# act-on-cddetect3.sh
wodim: No such file or directory.
Cannot open SCSI driver!
For possible targets try 'wodim --devices' or 'wodim -scanbus'.
For possible transport specifiers try 'wodim dev=help'.
For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from
the wodim documentation.
eject: CD-ROM tray close command failed: Input/output error
cddetect: option requires an argument -- 'd'
usage: cddetect -q|-v [-dDEVICE]
       cddetect -h|-V
   h get help
   V show version
   q quiet operation
   v verbose operation
   d use device DEVICE, defaults to /dev/cdrom

   sets exit value according to detected cd type:
   - audio        1
   - data        2
   - ISO        3
   - dvd        4
   - VideoDVD     5
   - VCD        6
   - SVCD        7
   - UVCD        8
   - mixed       50
Can't find a CD-ROM drive with a CD-DA in it
root# EXIT="Exit on timeout"
EXIT="Exit on timeout"
^C
root#
Here is the script which is executed:
Code:
#!/bin/ash
# ~/my-applications/bin/act-on-cddetect3.sh
# Wrapper/Launcher for cddetect
#
# Purpose: detect the CD/DVD disc type and launch accordingly.
# (Draft; please test. Certain disc types are still not covered.)
#
# Dependencies : cddetect, cdrecord, cd-info, yaf-splash, eject.
# AFAIK, all of those exist in all Puppies.
#
# V. 3: added detection of regular data CDs/DVDs.
#
# (c) Christian L'Écuyer (aka musher0 on the Puppy forum),
# Gatineau (Québec), Canada, 29-30 July 2015.
#### set -xe
# variables
MeSsAg=""
CDINF="cd-info --dvd --no-device-info --no-header --iso9660"

# functions
EjEcT () {
eject
[ $DVCS -gt 4 ] && eject /dev/sr1
exit
}
   
yaf () {
yaf-splash -placement top -bg SaddleBrown -fg cornsilk -fontsize large -text "$MeSsAg" -timeout 5
} # for message

# tests
TwoDiscS () {
if [ "`cddetect -d/dev/sr0`" != "no disc!" -a "`cddetect -d/dev/sr1`" != "no disc!" ];then
   MeSsAg="
 Your two devices each have a disc inserted
     or they are both open. Please insert
       only one disc and retry.
"
   yaf
   EjEcT
fi  # test for 2 media inserted.   
}

NoDiSc () {
if [ "`cddetect -d$DISC`" = "no disc!" ];then
   MeSsAg="
 Please insert a disc and retry.
"
   yaf
   EjEcT
fi
} # test for no media inserted.
# end of tests

# action
DaTaDiSc () {
[ -d /mnt/${DISC##*/} ] || mkdir -p /mnt/${DISC##*/}
mount -t iso9660 $DISC /mnt/${DISC##*/}
rox /mnt/${DISC##*/}
} # to view contents of bootable and generic data discs

ActOnType () {
# We double-check that all device trays are closed.
eject -t # default ok for /dev/sr0.
if [ "`cddetect -d$DISC | grep -o open`" = "open" ];then
   MeSsAg="
 Please close the tray of your
    2nd device and retry.
"
   yaf
   exit
fi # Reason: eject won't close a tray open at dev/sr1.

# Then we query the disc type.
   MeSsAg="
 Please wait while we
  query the disc type.
"
   yaf-splash -placement top-left -bg SaddleBrown -fg cornsilk -fontsize large -text "$MeSsAg" -timeout 4 &
TYP="`$CDINF $DISC | egrep -o -m 1 'bootable|audio|vob'`"

case $TYP in
   bootable)MeSsAg="
 This is a bootable data disc.
   Loading... Please wait...
"
     yaf &
     DaTaDiSc ;;
   
   audio)
   if [ "${DISC##*/}" = "sr1" ];then
      MeSsAg="
  Sorry... This player can only read
 audio from the 'cdrom' (1st) device.
   Please change device and retry.
"
      yaf
      EjEcT
      exit
   fi
   MeSsAg="
 This is an audio disc.
Loading... Please wait...
"
      yaf &
      cdda-player $DISC ;;
# Choice of player prompted by the fact that some
# mplayer's have a cache problem playing a CD,
# even with an enormous cache.

   vob)MeSsAg="
  This is a video disc.
 Loading... Please wait...
"
      yaf
      mplayer dvd://1 $DISC ;;
   
   *)MeSsAg="
 This is a generic data disc.
  Loading... Please wait...
"
     yaf &
     DaTaDiSc
# For those of us who create and use non-bootable data discs
# (especially DVDs and BRs) for storage.
#
# I think this rounds it up, but we check again, just in case.
     if [ $? -gt 0 ];then
      MeSsAg="
 Sorry... This script cannot
   process this media yet.
"
      yaf
     fi ;;
esac
}
# End of action
## End of functions

# main
DVCS="`cdrecord -devices | wc -l`"
case $DVCS in
   4)DISC="/dev/sr0"
   NoDiSc ;; # test if disc is inserted in only device.
   
   5)TwoDiscS # test for 2 media inserted.
   
     if [ "`cddetect -d/dev/sr0`" = "no disc!" ];then
      DISC="/dev/sr1"
      NoDiSc # test if there is a disc in the 2nd device.
      else
      DISC="/dev/sr0"
      fi ;; # For people with two CD/DVD devices. If the two are
# different, be careful not to insert a DVD disc in a CD device.
esac

ActOnType

### 30 ### set +xe



Hope this is helpful.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Sun 02 Aug 2015, 22:46    Post subject:  

Mike Walsh wrote:
Hi, musher0.

I don't know if this is of any use to you; it may not have the type of info that you're looking for...

http://www.libraries.psu.edu/tas/jca/ccda/docs/olac2012-1.pdf

Edit: This might be more along the lines of what you want:-

http://www.quepublishing.com/articles/article.aspx?p=1746162&seqNum=6

It's an article about various books on the subject, but if you scroll down, I think you'll find some quite useful information for your project. Hope that helps, anyway.


Regards,

Mike. Wink


Many thanks, Mike. This will certainly be helpful. BFN.

musher0

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Sun 02 Aug 2015, 23:28    Post subject:  

gcmartin wrote:
Hello @Musher0. This tests were done on the same laptop as before. Not sure if the distro is important, but as before, it is a TahrPUP derivative, currently.
Code:
root# which act-on-cddetect3.sh
/root/my-applications/bin/act-on-cddetect3.sh
root# act-on-cddetect3.sh
eject: CD-ROM tray close command failed: Input/output error
EXIT="Exit on timeout"
^C

root#
root# act-on-cddetect3.sh
eject: CD-ROM tray close command failed: Input/output error
EXIT="Exit on timeout"
mount: block device /dev/sr0 is write-protected, mounting read-only
root# EXIT="Exit on timeout"
I get various "toast" messages on the audio disc (first use) and the video disc (2nd use).

On the video disc, a ROX was opened showing the 2 video files which makes up the video on that disc. (unlike the original script I tested on the other thread where the video disc did open a window and began playing).
(...)
On a subsequent launch of the command without removing the disc or opening its tray, I get 2 toast messages
(...)
and then this occurs:
Code:
root# act-on-cddetect3.sh
wodim: No such file or directory.
Cannot open SCSI driver!
For possible targets try 'wodim --devices' or 'wodim -scanbus'.
For possible transport specifiers try 'wodim dev=help'.
For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from
the wodim documentation.
eject: CD-ROM tray close command failed: Input/output error
cddetect: option requires an argument -- 'd'
usage: cddetect -q|-v [-dDEVICE]
       cddetect -h|-V
   h get help
   V show version
(...)
   - mixed       50
Can't find a CD-ROM drive with a CD-DA in it
root# EXIT="Exit on timeout"
EXIT="Exit on timeout"
^C
root#
Here is the script which is executed: (...)


Hi, gcmartin.

Many thanks for the testing. Feedback such as yours is very useful, since
a developer is one man only, and only a man.

I'll try to extract the problems you mention. Please correct me if I missed
anything.

* No, the distro is not important.

* wodim ? aka cdrecord ? Phew, I'll have to screw my head back on
properly... I'm not aware of using cdrecord in the script, but I'll recheck.

* Could you tell me the file-type of your movie, please? I mean the last
three letters of the filename. Thanks. (I don't need the full title actually.)

___ This new version is based on recognition of *.vob files rather than on
recognition of the udf disc format, as was the case in the previous
version. Your movie is probably of another file-type. (Which is where Mike
Walsh's suggested docs may come in handy.)

____ I changed the tag for fear that all movie industries may not use
udf-type discs. But I can change it back to udf, that's easy.

* The exit messages in console are normal for the new yaf-splash (aka
gtkdialog-splash). But this minor problem doesn't affect any action of the
script. I'll see if I can silence these exit messages by adding a
&>/dev/null at the end of the line.

* "Toast" messages? Euh, the script only reads a CD or DVD. There is no
danger whatsoever of it toasting a disc or making "coasters".

____ I have built in a couple of checks in the sub-scripts noDisc and
TwoDiscs respectively. The script will tell you to insert a disc if there is
none in the tray; also, if you have two CD/DVD devices on your desktop
computer, and you have a disc in each tray, the script will ask you to
remove one disc.

____ Maybe you encountered one of those messages, and you found it
confusing?

____ In any case, I would be grateful if your explained a little more what
you mean by "toast"? (Other that a continental breakfast with coffee,
toast, jam and butter, of course!) Wink Again, thanks.

Speaking of coffee... bye for now!

musher0

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Mon 03 Aug 2015, 03:23    Post subject:  

Hello again.

Please find attached version 5, which I believe should solve the problems
reported by gcmartin.

Not much has changed, so I won't display the code this time. Basically, line
72 needed to be made more precise. I added the -w parameter to egrep,
as well as "video_ts" to what it should look for in the cd-info report. (The
-w parameter in grep/egrep means "come up with exactly that word, not
an expression or longer word containing it".) That's it for "substance".

I added a "sleep 5 seconds" command at the very beginning of the main
routine for all the impatient people including myself who push a disc in the
tray and just can't wait for the little green light to stop blinking on the
device before starting the script or program. Result: the disc is half loaded
and we get half a response. Ha-ha! With this sleep command, patience is
built into the script, and we get proper results.

Finally I added an eject command at the very end to make life a little
lazier. Smile

~~~~~~~~~~
I tested about 20 videos and discovered 2-3 secondary problems, which I
believe to be linked to the mplayer settings rather than to the "detect"
script itself:
* no lip sync
* video menu at the beginning doesn't respond to mouse or keyboard
* lousy image on a couple of videos (like looking through a prism)

Which means that strictly as a detector of CD/DVD types, this script is
approaching a 100 % sucess rate. But of course, don't hesitate to report
any weirdness or other problems with it below.

Work is still needed to make this script into a "Disc Central" from where
one could do a variety of things with CDs / DVDs. Not only viewing and
listening, but also creating and burning iso's semi-automatically, or
transferring data from composite discs to HDs, perhaps.

DVDs can't compete with USB sticks as to portability and speed, but if we
consider that a good quality DVD can retain the data on it for 50 years, I
think they still have a role as short-term to long-term back-up media.

Anyway, we'll see if this path yields more convenient solutions than some
already out there. No use duplicating efforts, eh?

I am soliciting your thoughts on the subject!
~~~~~~~~

Enjoy!

musher0
act-on-cddetect5.sh.gz
Description  Un-gz in /root/my-applications/bin and make executable.
gz

 Download 
Filename  act-on-cddetect5.sh.gz 
Filesize  1.96 KB 
Downloaded  143 Time(s) 

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Mon 03 Aug 2015, 08:33    Post subject:  

Hello @Musher0. This is a response to your V3 questions. I will be testing current version soon.

"toast" is a programming expression common in Android development where a informational message is posted for some period of time, then it disappears.

Video
I am going to imagine that this movie is a udf format as it worked before the V3 to launch and play, while it does not now. I'll check to see if the other DVD movies I have are similar. Also, I'll check to see if its distro environmentals by changing to a different PUP (BTW, should this work as well in a 64bit system?).

The following OOTB defaults exist, currently


Music is a CD industry CD disc. In terminal, Running using a disc, I
  1. start the command, it takes a while to load (that what I think is occurring) and progresses to where I think I should be hearing sound because a timer appears to be running and the bottom right says "Exit on timeout"; but, there is NO sound.
  2. In the progressing message area of the terminal, I click and the script seems to be attempting to exit as it ejects the CD, then goes into what appears to be a loop which only returns control to the prompt if I hit Ctrl-C.
Code:
root# act-on-cddetect3.sh
wodim: No such file or directory.
Cannot open SCSI driver!
For possible targets try 'wodim --devices' or 'wodim -scanbus'.
For possible transport specifiers try 'wodim dev=help'.
For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from
the wodim documentation.
eject: CD-ROM tray close command failed: Input/output error
cddetect: option requires an argument -- 'd'
usage: cddetect -q|-v [-dDEVICE]
       cddetect -h|-V
   h get help
   V show version
   q quiet operation
   v verbose operation
   d use device DEVICE, defaults to /dev/cdrom

   sets exit value according to detected cd type:
status : no CD in drive (/dev/sr0)
CD info: -
   - audio        1
   - data        2
   - ISO        3
   - dvd        4
   - VideoDVD     5
status : track  1 - 00:02 of 04:12 (00:04 abs) playing volume: 100
CD inf*: 10 tracks  (1:320 min)      1:34









action : play track 1 to track 10.EXIT="Exit on timeout"
eject...
++ WARN: Problems resolving device rootfs: No such file or directory
++ WARN: Problems resolving device tmpfs: No such file or directory       
++ WARN: Problems resolving device tmpfs: No such file or directory
++ WARN: Problems resolving device tmpfs: No such file or directory
++ WARN: Problems resolving device no CD in drive (/dev/sr0)
++ WARN: Problems resolving device unionfs: No such file or directory
++ WARN: Problems resolving device devtmpfs: No such file or directory
++ WARN: Problems resolving device none: No such file or directory             
++ WARN: Problems resolving device none: No such file or directory
++ WARN: Problems resolving device none: No such file or directory
++ WARN: Problems resolving device shmfs: No such file or directory
++ WARN: Problems resolving device //192.168.1.3/PUBLIC: No such file or directory
Hope this is helpful to those following to assist.
_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Mon 03 Aug 2015, 09:21    Post subject:  

V5 testing.
This post is showing results of accessing Video disc, Audio disc, or Data disc.

Video launches in player window: Terminal messages are:
Code:
root# act-on-cddetect5.sh
cdromreadraw: Input/output error
eject: CD-ROM tray close command failed: Input/output error
cdromreadraw: Input/output error
EXIT="Exit on timeout"
EXIT="Exit on timeout"
MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team
Cannot open file '/root/.mplayer/input.conf': No such file or directory
Failed to open /root/.mplayer/input.conf.
Cannot open file '/etc/mplayer/input.conf': No such file or directory
Failed to open /etc/mplayer/input.conf.

Playing dvd://0.
The hostname option must be >= 1: 0
Struct dvd, field hostname parsing error: 0
There are 3 titles on this DVD.
There are 1 angles in this DVD title.

libdvdread: Attempting to retrieve all CSS keys
libdvdread: This can take a _long_ time, please be patient

libdvdread: Get key for /VIDEO_TS/VIDEO_TS.VOB at 0x0000011e
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_0.VOB at 0x0000015e
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_1.VOB at 0x000001ab
libdvdread: Elapsed time 0
libdvdread: Found 1 VTS's
libdvdread: Elapsed time 0
audio stream: 0 format: ac3 (stereo) language: en aid: 128.
number of audio channels on disk: 1.
number of subtitles on disk: 0

No matching DVD subtitle language found!
Cache size set to 8192 KiB
Cache fill: 16.04% (1345536 bytes)   

Detected file format: MPEG-PS
VIDEO:  MPEG2  720x480  (aspect 2)  29.970 fps  4900.0 kbps (612.5 kbyte/s)
Cache not responding!
Failed to open VDPAU backend libvdpau_i915.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
Cache not responding!
[ass] auto-open
Selected video codec: MPEG-2 video [libavcodec]
[ac3 @ 0xb6b8cd00]frame sync error
Selected audio codec: ATSC A/52A (AC-3) [libavcodec]
AUDIO: 48000 Hz, 2 ch, floatle, 192.0 kbit/6.25% (ratio: 24000->384000)
AO: [pulse] Init failed: Connection refused
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
[mpeg2video @ 0xb6b8cd00]ac-tex damaged at 6 2
[mpeg2video @ 0xb6b8cd00]Warning MVs not available
[mpeg2video @ 0xb6b8cd00]concealing 1260 DC, 1260 AC, 1260 MV errors
VIDEO:  720x480  29.970 fps  4900.0 kbps (612.5 kB/s)
Aspect ratio is 1.33:1 - scaling to correct movie aspect.
VO: [xv] 720x480 => 720x539 Planar YV12
A:   7.5 V:   7.5 A-V: -0.000 ct:  0.032 220/220 12%  3%  1.2% 0 0 48%

Exiting... (Quit)
root#
And, when the player window is closed, the script progress to eject, exit and return to a terminal prompt.

Music, not so good. It appears to be attempting to start as the disc is spinning, but it quits with an eject. Messages:
Code:
root# act-on-cddetect5.sh
eject: CD-ROM tray close command failed: Input/output error
EXIT="Exit on timeout"
/root/my-applications/bin/act-on-cddetect5.sh: line 144: /root/my-applications/bin/xfreecd-launcher.sh: not found
root# EXIT="Exit on timeout"

Data opens a ROX terminal showing contents of the CDRW. Messages:
Code:
root# act-on-cddetect5.sh
eject: CD-ROM tray close command failed: Input/output error
EXIT="Exit on timeout"
mount: block device /dev/sr0 is write-protected, mounting read-only
umount: can't umount /mnt/sr0: Device or resource busy
eject: unmount of `/mnt/sr0' failed
root# EXIT="Exit on timeout"

ALL
In each case, I see a toast indicating, properly, what type of media it finds in the drive. In fact, it goes as far as to alert the user that the disc is a bootable disc found. Nice Idea


Hope this is helpful

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Mon 03 Aug 2015, 14:18    Post subject:  

Hi, gc.

Thanks again for testing. Much appreciated.

This version "5a" plays a cd with Puppy's native "pcd" utility.
The rest of the code has remained unchanged.

BFN.

musher0
act-on-cddetect5a.sh.gz
Description  Un-gz in /root/my-applications/bin and make executable.
gz

 Download 
Filename  act-on-cddetect5a.sh.gz 
Filesize  1.82 KB 
Downloaded  160 Time(s) 

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Tue 04 Aug 2015, 03:03    Post subject:  

Hello, all.

This is a major reworking: v. 5b. In particular, I
# refined the mplayer lines for video play; we should now have perfect
sync'ing and better sound for nearly all movies

# tested and added a choice of players (can be un-commented) for
audio CD's. Added a sub-script (or function) for the cdda-player.

# tested the old yaf-splash for nothing; the new one stays. We'll deal with
the console msgs some other way.

# replaced the controversial < wodim -devices > command (that created
a problem on gcmartin's Puppy) with a generic /proc/scsi/scsi query.

Please read the comments in the script explaining the other changes.
Thanks. BFN.

musher0

~~~~~~~~~
In the spirit of open source, here's my code. Suggestions for
improvements are welcome.
Code:
#!/bin/ash
# ~/my-applications/bin/act-on-cddetect5b.sh
# Wrapper|Launcher for cddetect & Co.
#
# Purpose: detect the CD/DVD disc type and launch accordingly.
# (Draft; please test and suggest improvements.)
#
# Dependencies:
# AFAIK, all of the following exist in all newer Puppies:
# cddetect, cd-info, yaf-splash, eject, cdda-player, mplayer.
# (xine and gXine were used instead of mplayer in older Puppies.)
#
# History:
# V. 3: added detection of regular data CDs/DVDs.
# V. 5b. In short:
# refined the mplayer lines for video play;
# added choice of players (can be un-commented) for audio play;
# tested the old yaf-splash for nothing;
# replaced controversial < wodim -devices > command with a
# /proc/scsi/scsi query.
#
# You can see the step-by-step on the Puppy forum at thread:
# http://murga-linux.com/puppy/viewtopic.php?t=100475
#
# (c) Christian L'Écuyer (aka musher0 on the Puppy forum),
# Gatineau (Québec), Canada, 29 July-August 4 2015.
#### set -xe
# variables
MeSsAg=""
CDINF="cd-info --dvd --no-device-info --no-header --iso9660"

# functions
EjEcT () {
eject;[ $DVCS -gt 1 ] && eject /dev/sr1;exit # was 4 with wodim
}
   
yaf () {
yaf-splash -placement top -bg SaddleBrown -fg cornsilk -fontsize large -text "$MeSsAg" -timeout 5 &>/dev/null
} # for message

# tests
TwoDiscS () {
if [ "`cddetect -d/dev/sr0`" != "no disc!" -a "`cddetect -d/dev/sr1`" != "no disc!" ];then
   MeSsAg="
 Your two devices each have a disc inserted
     or they are both open. Please insert
       only one disc and retry.
";yaf;EjEcT
fi  # test for 2 media inserted.   
}

NoDiSc () {
if [ "`cddetect -d$DISC`" = "no disc!" ];then
   MeSsAg="
 Please insert a disc and retry.
";yaf;EjEcT
fi
} # test for no media inserted.

ClosedTrays () {
# We double-check that all device trays are closed.
eject -t # default ok for /dev/sr0.
if [ "`cddetect -d$DISC | grep -o open`" = "open" ];then
   MeSsAg="
 Please close the tray of your
    2nd device and retry.
";yaf;exit
fi # Reason: eject won't close a tray that's open at dev/sr1.
} # end of tests

# actions
DaTaDiSc () {
[ -d /mnt/${DISC##*/} ] || mkdir -p /mnt/${DISC##*/}
mount -t iso9660 $DISC /mnt/${DISC##*/}
rox /mnt/${DISC##*/}
} # to view contents of bootable and generic data discs

CdDaPlAyEr () {
FNT="fn xft:Proc2:pixelsize=13:hinting=true:antialias=true"
COLR="cr lightblue -tr -tint snow -sh 59"
GEOM="g 34x28-12+270";CADR="b 25 +sb"
urxvt -$CADR -$FNT -$GEOM -$COLR -e cdda-player $DISC &>/dev/null
}

ActOnType () {
   MeSsAg="
 Please wait while we
 query the disc type.
" # As the message says.
   yaf-splash -placement top-left -bg SaddleBrown -fg cornsilk -fontsize large -text "$MeSsAg" -timeout 4 &
TYP="`$CDINF $DISC | egrep -w -o -m 1 'bootable|audio|video_ts|vob'`"

case $TYP in
   bootable)MeSsAg="
 This is a bootable data disc.
   Loading... Please wait...
";yaf &
     DaTaDiSc ;;
    
   audio)if [ "${DISC##*/}" = "sr1" ];then
      MeSsAg="
  Sorry... cdda-player can only read
 audio from the 'cdrom' (1st) device.
   Please change device and retry.
";yaf;EjEcT;exit
      fi
      MeSsAg="
  This is an audio disc. 
 Loading... Please wait...
";yaf & 
       # pcd ;; # Puppy's native cd player.
       ##
       ## Alternatively, you can comment out pcd above, and uncomment
       ## one of the following in order to use it:
       ##
       # cdda-player ;; # (CLI cd player, also in Puppy by default)
       CdDaPlAyEr ;; # included sub-script for above
       # xfreecd ;; # (only one with CDDB support)
       # ~/my-applications/bin/xfreecd-launcher.sh ;; # external script for xfreecd
       # tcd ;; # (very nice layout, keyboard based) # or
       # mplayer -cdrom-device cdda:// /dev/sr0 ;; # So-so, IMO...
       ##
       ## if they are installed on your system.

   video_ts|vob)MeSsAg="
   This is a video disc.
 Loading... Please wait...
";yaf
      if [ -e /usr/bin/mplayer ];then # 1st choice
         mplayer dvd://"${DISC##*r}" -vo xv -channels 6 -dvd-device -autosync 30 -mc 2.0 -slang "${LANG:0:2}",en -cache 8192 -cache-min 10 $DISC
         # Reason for choosing mplayer: gnome-mplayer, already
         # a layer over mplayer, can't be controlled as easily
         # in a script such as this.
         #
      elif   [ -e /usr/bin/ffplay ];then # 2nd choice
         ffplay $DISC
         # May be an alternative for certain movies.
      else # Just in case.
         MeSsAg="
 Unsure if the device can play
     this disc. Exiting...
";yaf
         exit
      fi
      ;;
      
   *)MeSsAg="
 This is a generic data disc.
  Loading... Please wait...
";yaf &
     DaTaDiSc
# For those of us who create and use non-bootable data discs
# (especially DVDs and BRs) for storage.
# I think this rounds it up, but we check again, just in case.
     if [ $? -gt 0 ];then MeSsAg="
 Sorry... This script cannot
   process this media yet.
";yaf
     fi ;;
esac
}
# End of action # End of functions

# main
DVCS="`cat /proc/scsi/scsi | awk '$2=="CD-ROM"' | wc -l`"
# "`wodim -devices | wc -l`" # Removed because of quarrel between
# cdrtools and cdrkit... Browse the web, you'll see! (Some Puppies
# don't have wodim, e.g. slacko-6.0b.)
case $DVCS in
   1)DISC="/dev/sr0";NoDiSc ;; # test if disc is inserted.
   # Was 4) with wodim.
   2)TwoDiscS # test for 2 media inserted.
   # Was 5) with wodim.
     if [ "`cddetect -d/dev/sr0`" = "no disc!" ];then
      DISC="/dev/sr1";NoDiSc # To test if 2nd device has a disc.
     else
      DISC="/dev/sr0"
     fi ;; # For people with two CD/DVD devices. If the two are
# different, be careful not to insert a DVD disc in a CD device.
esac

ClosedTrays # we close all trays, except on USB devices.
sleep 5s # Some hasty people do not wait for the little green light to go
# off on the device before launching this script! E.g.: moi... :-)

ActOnType # main operative section.

eject $DISC # when finished.
### 30 ### set +xe
act-on-cddetect5b.sh.gz
Description  Un-gz in /root/my-applications/bin and make executable before testing it.
gz

 Download 
Filename  act-on-cddetect5b.sh.gz 
Filesize  2.67 KB 
Downloaded  163 Time(s) 

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5713
Location: Republic of Novo Zelande

PostPosted: Tue 04 Aug 2015, 06:13    Post subject:  

Hi Musher0
Here are the results of my testing (on my Slacko 5.6 derivative on a laptop with slimline DVD/CDRW drive):

cdda player:
- no sound even though it appeared to be playing and I could see the time counter incrementing.
- transparent window showed the desktop image through and made it hard to see the text
- ejected the CD successfully when player window closed manually

Bootable iso CDR (not CDRW):
- Displayed contents correctly
- Did not eject CD when Rox window closed
- Would not allow drive to eject CD when eject button pressed on drive door. Had to manually run pmount

DVD (home burnt)
- Played successfully via Mplayer
- Ejected correctly when Mplayer window closed

DVD (shop bought)
- Opened Mplayer window successfully but after the opening credit no further image displayed. Only black screen.
- Ejected ok when Mplayer window closed manually


and here is the splash notification that popped up:
Notifications_size_issue.jpg
 Description   
 Filesize   11.47 KB
 Viewed   192 Time(s)

Notifications_size_issue.jpg

Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14859
Location: Gatineau (Qc), Canada

PostPosted: Tue 04 Aug 2015, 10:14    Post subject:  

Many thanks, greengeek. Very useful.

I'll be taking it easy today, no new version (unless I'm inspired) Laughing
but here are some random thoughts in reaction to your post.

* I'll try to increase darkness/contrast on the background of cdda-player.

Since this script is still all so experimental, you could also un-comment
the pcd line in the script and comment out the cdda-player line. That way
the default cd player would be pcd.

About the sound level: cdda-player reacts to pressing + and - either on
keypad or keyboard. Sound level can also be controlled using the retrovol
icon slider in your tray bar. If you have no sound at all on any app, you
may need to (re)use Puppy's sound wizard routine.

* I'm taking good note of your remark on data discs. However I'd like to
wait till later to extend that section of the script. I'd like to get the audio
and video parts of the script under good control first.

* About your commercial DVD: I think that's because of an oversight on
my part... The mplayer line should be: < mplayer dvd://1 >. A real
number "1", not dvd://string-$DISC-blabla. Sorry about that.

I also have ffplay installed on this PuppyPrecise, and as far as console
apps go, for some dvd's it plays the movie better than mplayer does. The
ideal thing would be to launch the movie on the disc directly in gnome-
mplayer. But there is no indication on how to do it in its console help.
Anyone has an idea how it can be done?

* Seeing your screen capture, I'll have to remove what I thought was a
nice "typographic" space on top of every message!

Bye for now. And again, many thanks for testing.

musher0

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5713
Location: Republic of Novo Zelande

PostPosted: Tue 04 Aug 2015, 14:24    Post subject:  

musher0 wrote:
I'll be taking it easy today, no new version (unless I'm inspired) Laughing
Bonjour! Enjoy your day off! There is one other thing I should mention - sometimes the video DVD detection did not work correctly - eg: if I run your script too soon after closing the drive door when I insert a DVD the script would open a blank rox window and post a message saying "This is a generic data disc."

Only if I waited a few seconds longer after closing the drive door did the script correctly detect that it was a video DVD.

PS: dont worry too much about the formatting of the advisory messages - I think there is some peculiarity in the yaf version on my system. I just can't remember the details I found when I last looked into that problem.

EDIT : I tried your suggestion of enabling pcd but it is not present on my system. I also tried uncommenting the line:
Code:
 mplayer -cdrom-device cdda:// /dev/sr0 ;;
but it ejected the CD and said:

Code:
# mplayer -cdrom-device cdda:// /dev/sr0
MPlayer SVN-r36362-snapshot-4.7.1 (C) 2000-2013 MPlayer Team
Playing /dev/sr0.
File not found: '/dev/sr0'
Failed to open /dev/sr0.
Exiting... (End of file)
#


Don't know why it can't see sr0:

EDIT 2 : Seems that the syntax is wrong. It should be:
Code:
mplayer -cdrom-device /dev/sr0 cdda://
Then it works fine - but does not give me a gui or terminal so there is no way to terminate the player.

EDIT 3 : Pushing the eject button on the drive kills the mplayer nicely. Easy Smile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [19 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1169s ][ Queries: 13 (0.0114s) ][ GZIP on ]