LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-11-2011, 06:37 PM   #1
Dan_1983
LQ Newbie
 
Registered: Feb 2007
Posts: 11

Rep: Reputation: 0
How run shell scripts from a website


I am trying to create a shell script (CGI) which will create a website with an embedded flash mp3 player. At the same time I want this script to overwrite the file currently in the playlist with another file which will allow me to change the song currently playing on the flash player. The reason I am doing this is so that I can copy the song I want to play to this file at a low bitrate reducing its size. The code I am using in my script is:

#!/bin/sh

echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<object type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" data=\"OriginalMusicPlayer.swf\" width=\"225\" height=\"90\"> "
echo "<param name=\"movie\" value=\"OriginalMusicPlayer.swf\" />"
echo "<param name=\"FlashVars\" value=\"firstColor=0072bc&secondColor=0076a4&playlistXmlPath=playlist.xml&autoPlay=true\" />"
echo "</object>"
echo "<a href=\"Files.cgi\">Files.cgi</a>"
echo "</html>"

tmpSong=`cat Song.txt`
if [ "$tmpSong" = "1" ]
then
echo "2" > Song.txt
cp -f 2.mp3 test.mp3
elif [ "$tmpSong" = "2" ]
then
echo "1" > Song.txt
cp -f 1.mp3 test.mp3
fi


When I run the script the new page does not have the flash player and the song did not change.

Last edited by Dan_1983; 04-11-2011 at 06:43 PM.
 
Old 04-11-2011, 09:28 PM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Is the path to the song file the full path or the correct relative path?
 
Old 04-12-2011, 06:36 AM   #3
Dan_1983
LQ Newbie
 
Registered: Feb 2007
Posts: 11

Original Poster
Rep: Reputation: 0
I have done that and it still did not work. The other thing is that the flash player doesn't show up. I know the code works because I use the same code for the home page and it loads up no problem.
 
Old 04-15-2011, 12:16 PM   #4
amsweitzer
LQ Newbie
 
Registered: Nov 2008
Location: Stotts City ,Mo USA
Distribution: ubuntu|mint|puppy
Posts: 25

Rep: Reputation: 0
is the flash player/media files in your index file tier or under another tier if its own in main tier yes it will work on the index page if in its own file then copying the code from the index should work on any subsequent pages reading the code you have everything appearing as if its in the same folder as the code that wont work that way unless you installed all the files to the folder of each page. Heres how I do it not that i know cgi but my flash page is set up with the media player in its own folder and all media are in all their own folders and each page in its own folder with xml config files to recognize where everything is located

Last edited by amsweitzer; 04-15-2011 at 12:18 PM. Reason: missed a word
 
Old 04-15-2011, 12:24 PM   #5
amsweitzer
LQ Newbie
 
Registered: Nov 2008
Location: Stotts City ,Mo USA
Distribution: ubuntu|mint|puppy
Posts: 25

Rep: Reputation: 0
let me know if you get it working I have a large flash site that i would like to get to cgi install with variable graphics views config the mp3 to lower bit rate would be great i could build on home server then transfer the converterd media files to host
 
Old 04-16-2011, 12:20 AM   #6
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Is the SWF file in the same directory?
 
Old 04-16-2011, 10:22 AM   #7
Dan_1983
LQ Newbie
 
Registered: Feb 2007
Posts: 11

Original Poster
Rep: Reputation: 0
I found out that the reason it wouldn't change the song is because of the permissions of the Song.txt file. It was setup for only the owner to have write access. I changed its permissions to read/write all and the cgi would switch the song. I then switched the way to load the flash player to java script instead of object and the player showed up.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<div id="media-player"></div>

<script type="text/javascript">
var options = {};
options.firstColor = "438ccb";
options.secondColor = "0072bc";
options.mediaPath = "http://dansfiles.myftp.org:8090/test.mp3";

options.autoLoad = "false";
options.autoPlay = "true";

var params = {};
params.allowScriptAccess = "always";

swfobject.embedSWF("/OriginalMusicPlayer.swf", "media-player", "225", "90", "9.0.0","/expressInstall.swf", options, params);
</script>
 
  


Reply

Tags
cgi



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
Shell scripts won't run under root otie Fedora 3 03-12-2007 01:16 PM
How do you run shell scripts? shadowdrums Slackware 5 05-15-2006 11:02 AM
Can't run shell scripts even as root nitrousoxide82 Linux - Newbie 2 04-24-2005 04:47 PM
Can't run shell scripts I write? JustinCoyan Slackware 2 08-06-2004 12:50 PM
How to? Run Shell scripts jmr0311 Mandriva 2 07-14-2004 09:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:43 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
Open Source Consulting | Domain Registration