Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Linux] Need a direction from the 'In the know'

9 views
Skip to first unread message

Zak Hipp

unread,
May 21, 2012, 9:28:06 AM5/21/12
to
John Corliss posed a CD/DVD Toggle puzzle; Zo introduced the concept
of leaving the tray open (inadvertent breakage, lens dusting when
exposed to air flows over time, etc.).

Automating CD/DVD drives is far trickier than it seems.

One aspect of this self imposed puzzle is to play DVDs. Compiled and
integrated it works just fine as a bespoke solution for me.

I'm a find tools, stitch them together, make them look like a real
programmer did it, sort of guy.

My question is:

What direction should I be pointed in for this kind of thing in
general Linux?

----------------------

@echo off

set vlc=e:\test\vlc\vlclkl.exe
set playlist=e:\test\playlists\dvd-f.m3u
set counter=0

if exist f:\video_ts\video_ts.bup (
goto play
) else ( if exist f:\video_ts\video_ts.ifo (
goto play
) else (
nircmd cdrom open f:
)
)

:loop
if exist f:\video_ts\video_ts.bup (
goto play
) else ( if exist f:\video_ts\video_ts.ifo (
goto play
)
)
nircmd wait 1000
set /a counter=%counter% + 1
if %counter%==120 nircmd cdrom close f:
if %counter%==180 goto end
goto loop

:play
"%vlc%" "%playlist%"
nircmd wait 5000
nircmd waitprocess vlc.exe
nircmd cdrom open f:
nircmd wait 30000
nircmd cdrom close f:

:end
nircmd cdrom close f:

----------------------


Zak Hipp

Dave

unread,
May 21, 2012, 11:44:45 AM5/21/12
to
On Mon, 21 May 2012 14:28:06 +0100, Zak Hipp wrote:

> John Corliss posed a CD/DVD Toggle puzzle; Zo introduced the concept of
> leaving the tray open (inadvertent breakage, lens dusting when exposed
> to air flows over time, etc.).
>
> Automating CD/DVD drives is far trickier than it seems.
>
> One aspect of this self imposed puzzle is to play DVDs. Compiled and
> integrated it works just fine as a bespoke solution for me.
>
> I'm a find tools, stitch them together, make them look like a real
> programmer did it, sort of guy.
>
> My question is:
>
> What direction should I be pointed in for this kind of thing in general
> Linux?
>
To start a dvd player on insertion of disc should be part of the desktop
settings(device actions,default actions).On my Mint linux desktop(GNOME)
I have Handbrake start automatically when I insert a dvd.On this Fedora
laptop(KDE)I'm offered choices of rip with K3b,play with VLC,open with
file manager,etc. You make the settings however you prefer,all part of
the desktop settings.

Dave

--
Registered Linux User #444770
Fedora 15

Zak Hipp

unread,
May 21, 2012, 5:10:29 PM5/21/12
to
Thank you for your reply.

Unfortunately, I wasn't clear. I also use Mint, since 'Helena' and have
configured the heck out of the user interface. I use it for doing
anything serious on-line: I don't trust Windows. As time moves forward
the slow drift to Linux will dominate. I consider Windows a toy and
always have. Because I know Xp quite well and seem to want to do things
others don't. The posted script, though simple is surprisingly tricky
to write. here's one example of its failings; If you run it, put a
DVD in the tray and leave, the DVD may loop forever if the player is not
configured not to. Even so, if you want to use two DVDs and a memory
resident utility they will just play one after the other forever. There
are so many caveats, traps and dead ends. I don't like television and
Xp, to me, is like playing 'SimCity' where you can go into a building
and do some actual work. I have many such utilities.

Here's another one. Drive C: images to 1.3GB and is part of the back-up
schedule. If a new latest image has replaced the old latest, replaced by
another utility that manages images in its own directory and notifies
when the three oldest images have been sent to the write-DVD directory.
The sample below is cut out of a multi-thumb drive batch, so errors are
most lightly there. All I have to do is put whatever drives into
whatever slots and go to sleep. A scheduler does the night shift.

What I'm looking for is someone, like me, on the Linux side to point me
to a suitable general glue for Linux; as batch files are for Windows.

-----------------------

@echo off

set ffsync=e:\test\freefilesync\freefilesync.exe
set apps_dir=apps
set apps_batch=apps backup.ffs_batch

set drv=L:
if exist "%drv%\%apps_batch%" goto run_apps
set drv=M:
if exist "%drv%\%apps_batch%" goto run_apps

/the other drive letters go here/

set drv=Y:
if exist "%drv%\%apps_batch%" goto run_apps
set drv=Z:
if exist "%drv%\%apps_batch%" goto run_apps

:run_apps
%drv%
if not exist "%drv%\%apps_dir%\" mkdir "%drv%\%apps_dir%"
"%ffsync%" "%drv%\%apps_batch%"

:end

-----------------------


Zak Hipp

Dave

unread,
May 21, 2012, 9:50:39 PM5/21/12
to
On Mon, 21 May 2012 22:10:29 +0100, Zak Hipp wrote:

> What I'm looking for is someone, like me, on the Linux side to point me
> to a suitable general glue for Linux; as batch files are for Windows.
>
> ----------------------->
>
> Zak Hipp

Are you looking for something like shell scripting,bash command line?
Linux Shell Scripting Tutorial
http://freeos.com/guides/lsst/

Zak Hipp

unread,
May 22, 2012, 2:50:48 AM5/22/12
to
On 22/05/2012 02:50, Dave wrote:
> On Mon, 21 May 2012 22:10:29 +0100, Zak Hipp wrote:
>
>> What I'm looking for is someone, like me, on the Linux side to point me
>> to a suitable general glue for Linux; as batch files are for Windows.
>>
>> ----------------------->
>>
>> Zak Hipp
>
> Are you looking for something like shell scripting,bash command line?
> Linux Shell Scripting Tutorial
> http://freeos.com/guides/lsst/

It looks as unpromising as 'Beginners Guide to Windows Batch Filing' did,
only way more powerful. :)

I'll have to start learning what utilities I have at my disposal, how to
evoke them, pass parameters to them, Linux programme switches etc.

I'll definitely take a more serious look at it.

Thank you.


Zak Hipp

p-0^0-h the cat

unread,
May 22, 2012, 5:05:59 AM5/22/12
to
http://tldp.org/guides.html

Bash Guide for Beginners

Advanced Bash-Scripting Guide

I hope you like reading...

--
p-0^0-h the cat
Internet Terrorist, Mass sock puppeteer, Agent provocateur, Gutter rat,
Devil incarnate, Linux user#666, BaStarD hacker

Rockinghorse Winner

unread,
May 22, 2012, 10:18:59 AM5/22/12
to
* It may have been the liquor talking, but
Yes, do read up on all the tools at your disposal. The list is endless in
Linux. It is well worth the hours you put in learning the cli, as it will
pay you back with an ability to finely tune and automate your system.

Bash scripts are pretty much like batch files, one command per line. Of
course it's a lot more powerful. Some programs are written entirely in bash
scripting language.

Terry
--
"For I would ride with you upon the wind, |/
Run on the top of the dishevelled tide, |/ Gentoo Linux
And dance upon the mountains like a flame." |/
-Yeats |/

Zak Hipp

unread,
May 22, 2012, 2:40:13 PM5/22/12
to
On 22/05/2012 10:05, p-0^0-h the cat wrote:
> On Tue, 22 May 2012 07:50:48 +0100, Zak Hipp<Z...@invalid.invalid> wrote:
>
>> On 22/05/2012 02:50, Dave wrote:
>>> On Mon, 21 May 2012 22:10:29 +0100, Zak Hipp wrote:
>>>
>>>> What I'm looking for is someone, like me, on the Linux side to point me
>>>> to a suitable general glue for Linux; as batch files are for Windows.

>>> Are you looking for something like shell scripting,bash command line?
>>> Linux Shell Scripting Tutorial
>>> http://freeos.com/guides/lsst/
>>
>> It looks as unpromising as 'Beginners Guide to Windows Batch Filing' did,
>> only way more powerful. :)
>>
>> I'll have to start learning what utilities I have at my disposal, how to
>> evoke them, pass parameters to them, Linux programme switches etc.
>>
>> I'll definitely take a more serious look at it.
>>
>> Thank you.
>
> http://tldp.org/guides.html
>
> Bash Guide for Beginners
>
> Advanced Bash-Scripting Guide
>
> I hope you like reading...

Top of the page 'Advanced Bash-Scripting Guide'. This is the one for me!

Several formats... Promising!

Title, Dedication, TOC ... It's a chunky tome; good!

Chapter 1) Kind of a neat intro', but let's get on with it.

Chapter 2) Example 1) 1 + 1 = 2 - Come on, let's pick up the pace.

Chapter 2) Example 2) The square root of -1 at <90 degrees. Steady on lad!

Chapter 2) Example 3) I'm sure he said something about beginners guide.


Nice one!


Zak Hipp

Zak Hipp

unread,
May 22, 2012, 2:58:20 PM5/22/12
to
On 22/05/2012 15:18, Rockinghorse Winner wrote:
> * It may have been the liquor talking, but
> Zak Hipp<Z...@invalid.invalid> wrote:
>
>> On 22/05/2012 02:50, Dave wrote:
>>> On Mon, 21 May 2012 22:10:29 +0100, Zak Hipp wrote:
>>>
>>>> What I'm looking for is someone, like me, on the Linux side to point me
>>>> to a suitable general glue for Linux; as batch files are for Windows.

>>> Are you looking for something like shell scripting,bash command line?
>>> Linux Shell Scripting Tutorial
>>> http://freeos.com/guides/lsst/
>>
>> It looks as unpromising as 'Beginners Guide to Windows Batch Filing' did,
>> only way more powerful. :)
>>
>> I'll have to start learning what utilities I have at my disposal, how to
>> evoke them, pass parameters to them, Linux programme switches etc.
>>
>> I'll definitely take a more serious look at it.
>>
>> Thank you.

> Yes, do read up on all the tools at your disposal. The list is endless in
> Linux. It is well worth the hours you put in learning the cli, as it will
> pay you back with an ability to finely tune and automate your system.
>
> Bash scripts are pretty much like batch files, one command per line. Of
> course it's a lot more powerful. Some programs are written entirely in bash
> scripting language.

Thank you for the overview perspective.

Years ago, as a precision grinder, I got a job by walking up to a machine.
Sometime later I asked him why he hired me. His answer: When you have been
in this game as long as I have; you only need to see the approach.


Zak Hipp

rich

unread,
May 26, 2012, 6:00:37 AM5/26/12
to
On Mon, 21 May 2012 14:28:06 +0100, Zak Hipp wrote:

> John Corliss posed a CD/DVD Toggle puzzle; Zo introduced the concept of
> leaving the tray open (inadvertent breakage, lens dusting when exposed
> to air flows over time, etc.).
>
> Automating CD/DVD drives is far trickier than it seems.
>
It is possible to run a linux bash file on shutdown.
There is a utility in linux for ejecting removable media including CD/
DVD. Have a look in your repo for 'eject'
Depends if the drive supports the command but I think most drives do
these days.

the bash file might be

#!/bin/bash
#
eject -T
#-T toggles the tray open or closed.
# if open, it closes, if closed it opens.
#
sleep 5
# next wait 5 seconds
# time to get that disk out
#
eject -t
#this closes the tray if it is open
#or is irrelevant if the tray is already closed.

--
rich

rich

unread,
May 26, 2012, 6:06:39 AM5/26/12
to
That got really scrambled, I will copy and reformat.

> #!/bin/bash
> eject -T
> # -T toggles the tray open or closed.
> # if open, it closes, if closed it opens.
> #
> sleep 5
> # next wait 5 seconds
> # time to get that disk out
> eject -t
> # this closes the tray if it is open
> # or is irrelevant if the tray is already closed.


--
rich

rich

unread,
May 26, 2012, 6:09:05 AM5/26/12
to
On Sat, 26 May 2012 10:06:39 +0000, rich wrote:

> On Sat, 26 May 2012 10:00:37 +0000, rich wrote:
>
>> On Mon, 21 May 2012 14:28:06 +0100, Zak Hipp wrote:
>>
>>> John Corliss posed a CD/DVD Toggle puzzle; Zo introduced the concept
>>> of leaving the tray open (inadvertent breakage, lens dusting when
>>> exposed to air flows over time, etc.).
>>>
>>> Automating CD/DVD drives is far trickier than it seems.
>>>
>> It is possible to run a linux bash file on shutdown.
>> There is a utility in linux for ejecting removable media including CD/
>> DVD. Have a look in your repo for 'eject'
>> Depends if the drive supports the command but I think most drives do
>> these days.
>>
>> the bash file might be

>
> That got really scrambled, I will copy and reformat.
>
>> #!/bin/bash eject -T # -T toggles the tray open or closed.
>> # if open, it closes, if closed it opens.
>> #
>> sleep 5 # next wait 5 seconds # time to get that disk out eject -t #
>> this closes the tray if it is open # or is irrelevant if the tray is
>> already closed.

damn those hash signs - without the comments - all you need are 4 lines.

#!/bin/bash

eject -T

sleep 5

eject -t


--
rich
0 new messages