LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-30-2009, 06:22 AM   #1
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Rep: Reputation: 37
Need help with simple scripting


Hello all,

I am trying to launch Xine and then queue some files into Xine without using a conventional play list file.

So far, I have discovered that from a terminal I can:

1) I can launch Xine and specify a session ID using:

Code:
xine -S --session=0 &
2) Inject an mrl into the Xine session by using:

Code:
xine --enqueue -S session=0 /media/Video/v/a_file.mpg
3) Inject a second mrl into the Xine session by using:

Code:
xine --enqueue -S session=0 /media/Video/v/b_file.mpg
And get the desired result, file a plays to the end and then file b plays, all in the same Xine instance.

How would I get this to work in a script that I could execute once, without having to manually issue the three commands in the terminal?


Hope this is making some sense and someone is happy to help.

Regards,
Greenie
 
Old 05-30-2009, 07:34 AM   #2
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
Why don't you simply start xine as xine <first file> <second file>??
 
Old 05-30-2009, 10:11 PM   #3
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by Samotnik View Post
Why don't you simply start xine as xine <first file> <second file>??
Because there are a thousand files, and each one of them needs a different volume setting. Some files are MPG video and some are AVI, so I don't want to adjust the volume of each file because that is way too time consuming.

What I ultimately want to do is write a script that randomly chooses a filename from a list and chooses a volume setting from same list (text file list) and injects the filename and volume setting into a running instance of xine.

I can do this by command line, so surely a script can do it. I just not sure how. I've tried to write one but cannot get it to work (my script keeps launching multiple instances of xine, I have to close each instance one by one for the next instance to start).
 
Old 05-30-2009, 10:25 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Well, let's see your attempt.
 
Old 05-31-2009, 01:09 AM   #5
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by syg00 View Post
Well, let's see your attempt.
Code:
xine -S --session=0 &
xine --enqueue -S session=0 /media/Video/kelly_video.mpg
xine --enqueue -S session=0 /media/Video/changes_video.mpg
...It is identical to what I type at the command line. When I type at the command line, xine behaves the way I would expect and need. When I run the above as a script it does something completely different.

I suspect that my approach on the first line is way incorrect, but I don't know what would be correct way of doing this.

Last edited by greengrocer; 05-31-2009 at 01:11 AM.
 
Old 05-31-2009, 03:09 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
So you're issuing this as "sh whatever" ?.
Try adding "#!/bin/sh" as the first line, make it executable and run it.
 
Old 06-01-2009, 06:22 AM   #7
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by syg00 View Post
So you're issuing this as "sh whatever" ?.
Try adding "#!/bin/sh" as the first line, make it executable and run it.
Yep added #!/bin/sh as the first line and then ran it. Separate instances of xine occur, i.e. each instance finishes playing the mpg file and then you have to close that instance before the next new instance of xine appears.

Not really the xine behaviour I wanted, it does not behave the same way as it does if I issue those same commands manually in a terminal window.

Last edited by greengrocer; 06-01-2009 at 06:24 AM.
 
Old 06-01-2009, 07:02 AM   #8
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Original Poster
Rep: Reputation: 37
Since the exact same commands work if a slow old human enters them, I figured that the script is running too quickly and each command is not realising that Xine is already running.

And this seems to work:

Code:
#!/bin/sh
xine -S --session=0 &
sleep 2
xine --enqueue -S session=0,mrl=/media/Video/kelly_video.mpg#volume:100
sleep 2
xine --enqueue -S session=0,mrl=/media/Video/changes_video.mpg#volume:70

Last edited by greengrocer; 06-01-2009 at 07:11 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Scripting Help hopspitfire Linux - General 2 06-12-2007 05:46 PM
simple scripting help please kb100 Programming 7 08-23-2006 07:31 AM
simple scripting help please kb100 Programming 12 08-18-2006 09:34 AM
simple scripting help please kb100 Programming 3 08-18-2006 09:08 AM
simple scripting question wedgeworth Programming 6 02-04-2004 11:30 AM


All times are GMT -5. The time now is 12:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration