Skip to Content
It is currently February 21st, 2017, 3:47 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: March 9th, 2010, 1:49 am 
Offline
Alumni
Alumni

Joined: March 11th, 2003, 1:34 pm
Posts: 9959
Location: Maui, HI
dj001 wrote:
When I try the listen link, the preroll does not play; Winamp just goes right to the stream. Winamp shows File 2 (stream) playing. For File 1, it shows this error message: [HTTP/1.1 404] Not Found http://mysite.com/prerolls/userbar.mp3.

This means the pre-rolls aren't available on the webserver. The job of the PAL is to rotate the pre-roll, not to transfer it to a remote server. Consider looking into an FTP utility that can schedule periodic updates of the pre-roll.mp3; once an hour is a good target.

Since I run SAM, the database, and webserver all on one box after the PAL runs the changes are immediate. I do this because it is easy to maintain and easy to operate. Having a local co-location environment also helps (my hardware, their power + Internet). Although a scaled architecture is also nice (applications spread across multiple machines) it does have challenges when intra- and inter- networked machines need integrating.

dj001 wrote:
In my SAM PAL Scripts window, prerolls.pal shows: Waiting for time 6:46:17. SAM is running on a simple Dell desktop through an ordinary T-1 line in my office. I don't know my Apache situation. Does this involve the webhost where I uploaded the pls file?

I PM'd you a screenshot. I noticed that userbar.mp3 had changed from replacing 1.mp3 to 3.mp3, so I think the PAL is working. I still don't understand how userbar.mp3 on my PC running SAM gets to my webhost where I uploaded the pls file.

Sounds like and looks like the PAL is running. The PAL is configured to loop every 2 hours so the waiting time displayed in the PAL window is 2 hours from the last run.

At this point the PAL is doing the job. Well done. Hopefully I've passed on a few PAL tidbits to help with other things.

If the pre-roll transfer becomes a problem then the last thing I can suggest is to write a batch/shell script scheduled by Windows Scheduler or crontab (Windows or *nix respevtively) that does something very simple on the webserver side such as (assuming 4 pre-rolls):
* rename pre-roll.mp3 to temp.mp3
* rename 1.mp3 to pre-roll.mp3
* rename 2.mp3 to 1.mp3
* rename 3.mp3 to 2.mp3
* rename 4.mp3 to 3.mp3
* rename temp.mp3 to 4.mp3

This simple rotates without "randomness".

These mp3's would exist in a folder on the webserver served by http://mysite.com/prerolls/pre-roll.mp3.
If you're using Apache then "prerolls" is a folder off "htdocs".

_________________
- Steve Kunitzer
- SVS (Spacial Volunteer Support) / Forum Administrator

Image
Image


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 5:24 am 
Offline
Super User
Super User

Joined: August 18th, 2005, 10:25 am
Posts: 1231
Well, I was always a little unclear how the userbar.mp3 file got from the PAL script on my PC to the pls file my webserver. (Us civilians are mostly still running SAM on our PCs.)

Might you be able to recommend to me an FTP utility? Does something like CuteFTP have a feature where you can beam up a file once every two hours automatically?

Might you be able to share with me a batch/shell script for this? It sounds like it might be a pretty simple one.

Again, many thanks!


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 2:10 pm 
Offline
Alumni
Alumni

Joined: March 11th, 2003, 1:34 pm
Posts: 9959
Location: Maui, HI
Someone else may know about an FTP tool that has automation. Worse case is a batch file (SAM is Windows) scheduled by the Windows Scheduler. But this is yucky; if there is an app with point/click and a GUI that is probably the most fitting for you.

Is the webserver Windows (batch file) or *nix (shell script)?

_________________
- Steve Kunitzer
- SVS (Spacial Volunteer Support) / Forum Administrator

Image
Image


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 2:32 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7163
Location: Aachen (Germany)
Windows has got a nice tool for planned tasks.
And a commandline ftp client is also included with windows since at least 98SE (Don't know about 95 as I never looked that deep into the system at that time)

Here's an example that will upload itself to the ftp server.
The command for the planned task:
Code:
ftp -s:C:\Users\Benedikt\commands.txt


commands.txt where the ftp client gets its commands from
Code:
open xenzilla.de
benedikt@xenzilla.de
supersecretpassword
cd /htdocs
put C:\Users\Benedikt\commands.txt
quit


Don't even try loging into my server with that script as the userdata is not correct :P

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 2:35 pm 
Offline
Super User
Super User

Joined: August 18th, 2005, 10:25 am
Posts: 1231
FesterHead wrote:
Is the webserver Windows (batch file) or *nix (shell script)?
The answer I got is: "Unix/Linux".


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 2:40 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7163
Location: Aachen (Germany)
You have a file on your SAM windows host and want to upload it to your streaming server via ftp?
Then have a look at the (not really) batch I posted as that will do exactly what you want. (If scheduled to run at certain times by windows scheduler/task planner or however that thing is called in english)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 2:45 pm 
Offline
Super User
Super User

Joined: August 18th, 2005, 10:25 am
Posts: 1231
Mastacheata wrote:
Windows has got a nice tool for planned tasks.
And a commandline ftp client is also included with windows since at least 98SE (Don't know about 95 as I never looked that deep into the system at that time)

Here's an example that will upload itself to the ftp server.
The command for the planned task:
Code:
ftp -s:C:\Users\Benedikt\commands.txt


commands.txt where the ftp client gets its commands from
Code:
open xenzilla.de
benedikt@xenzilla.de
supersecretpassword
cd /htdocs
put C:\Users\Benedikt\commands.txt
quit


Don't even try loging into my server with that script as the userdata is not correct :P


I am no expert at these types of scripts. Would you please walk me through this slowly? Here are my assumptions:

server user ID: myid
password: password
location of .pls file: http://mysite.com/prerolls
file being uploaded from PC every two hours: C:\userbars\userbar.mp3

Please tell me how to write the script, where to put it on my pc, and how to launch it so it's running. Also, do I need to refer to the script somehow in the pls file?

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 2:56 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7163
Location: Aachen (Germany)
dj001 wrote:
I am no expert at these types of scripts. Would you please walk me through this slowly? Here are my assumptions:

server user ID: myid
password: password
<span>location of .pls file: <a href="http://mysite.com/prerolls">http://mysite.com/prerolls</a></span>
file being uploaded from PC every two hours: C:\userbars\userbar.mp3

Please tell me how to write the script, where to put it on my pc, and how to launch it so it's running. Also, do I need to refer to the script somehow in the pls file?

Thanks!


Best would be to store the commands.txt in the same directory as your userbar.mp3
I assume that when you open the ftp and put a file in the main directory that is available from the internet. (If you need to change into some kind of subdirectory like htdocs before uploading you need to change to that directory first by placing "cd thatdirectoryname" in front of the put command.
Code:
open mysite.com
myid
password
put C:\userbars\userbar.mp3
quit


Then you schedule a new task in windows and let it call the following command:
Code:
ftp -s:C.\userbars\commands.txt


Can't help you though on how to do the scheduling part since I'd need to guess the english translations for the menu items. (My windows is german language)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 3:38 pm 
Offline
Super User
Super User

Joined: August 18th, 2005, 10:25 am
Posts: 1231
Any task-scheduling experts out there? I'm running Vista.


Top
 Profile  
Reply with quote  
PostPosted: January 11th, 2017, 4:34 am 
Offline
Super User
Super User

Joined: August 18th, 2005, 10:25 am
Posts: 1231
Steve, I just upgraded to v2, and my multiple ID preroll PHP won't work. v2 is a little quirky with its authhash and sid; any help with this script would be appreciated:
Code:
<?php


$port=myport;  /*Just set the port for the stream
             */
$host="mystream";  /*If the location of the stream host/server
             is on another server on the internet
             set it here.
             e.g.: $host="www.myserver.tld"; or $host="";
         --->DO NOT INCLUDE THE http:// OR THE :8000 OR THE /listen96.aac PARTS!!!!<---     
         --->Otherwise just leave it empty.<---
             */
$path="/"; /*For a legacy DNAS or a DNAS2 in legacy mode or with
             only one endpoint leave this as is.  Otherwise set
             it to the appropriate endpoint path for this PLS.
             e.g.: $path="/listen96.aac";
*/




/* Don't mess with any of the stuff below...

...unless you REALLY like taking lots of
Excedrin migrain extra strength tablets!*/

header("Cache-Control: no-cache");
header("Content-type: audio/x-scpls");

error_reporting(0);
ini_set('display_errors', false);
function LoadFiles($dir)
{
 $Files = array();
 $It =  opendir($dir);
 if (! $It)
 return $Files;
 while ($Filename = readdir($It))
 {
  if ($Filename == '.' || $Filename == '..')
   continue;
        if(
        !preg_match("[.mp3$]",strtolower($Filename)) &&
        !preg_match("[.acc$]",strtolower($Filename)) &&
        !preg_match("[.ogg$]",strtolower($Filename)) &&
        !preg_match("[.wav$]",strtolower($Filename))
        ){continue;}
    $Files[] = $Filename;
 }

  return $Files;
}


$fhsn=$_SERVER['SERVER_NAME'];
$fhsp=$_SERVER['SERVER_PORT'];
if($host=="")
{
    $host=$fhsn;
}
if($fhsp=='80' || $fhsp==80)
{
    $fhsp="";
}
else
{
    $fhsp=":$fhsp";
}
$ptpf=$_SERVER['SCRIPT_NAME'];
$ptpf=explode('/',$ptpf);
array_pop($ptpf);
if($ptpf[0]==""){
    array_shift($ptpf);}
$ptpf=join("/",$ptpf);
$pre_rolls = LoadFiles('.');
$count=sizeof($pre_rolls);
echo "[playlist]\r\n";
if($count>0)
{
    $usefile = rawurlencode($pre_rolls[ (rand(0,$count-1)) ]);
    echo "File1=http://$fhsn$fhsp/$ptpf/$usefile\r\n";
    $count=2;
}
else
{
    $count=1;
}
echo "File$count=http://$host:$port$path\r\n";
echo "Length$count=-1\r\n";
echo "NumberOfEntries=$count\r\n";
echo "Version=2";
?>


Top
 Profile  
Reply with quote  
PostPosted: January 18th, 2017, 7:17 am 
Offline
Super User
Super User

Joined: August 18th, 2005, 10:25 am
Posts: 1231
I uploaded the revised PHP in the wrong subfolder. My bad!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group