r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

shadwolf
2-Dec-2009
[19937x2]
i like this ... the processor is 64 bits but the memory  adressing 
is only  36 bits in fact only the data part is 64 bits .... so you 
jump fro 4Go of ram to 16 Go which is cool already
150 R2  products that's too much ....
Henrik
2-Dec-2009
[19939]
Why? That's for specific platforms and purposes and they are automatically 
built using Carl's secret build monster system. :-)
shadwolf
2-Dec-2009
[19940]
yeah and in the end you got things not working from OS to another 
while they are supposed to be working the same way
BrianH
2-Dec-2009
[19941]
And as long as R3 scripts work the same (which we have been more 
careful of) then it won't be a problem.
Henrik
2-Dec-2009
[19942]
I don't think the build system is responsible for that. That comes 
down to the implementations done for the individual systems.
BrianH
2-Dec-2009
[19943]
And this is why all of the platform wrapper code will be open source.
shadwolf
2-Dec-2009
[19944]
heanrik ofcourse the building system is just the concequence not 
the reason. Spread yourself toomuch only tends to make you the worst 
everywhere
BrianH
2-Dec-2009
[19945]
It's the bare minimum necessary to compete with other cross-platform 
development tools. This is why platform support will be open source. 
R3 is a community project - R2 was a commercial product. You can't 
really compare the two.
shadwolf
2-Dec-2009
[19946x8]
i have one problem for example  actually i made an irc bot to  ask 
and difuse the song name on the public channel when asked by users. 
When my bot match the command then it  opens a web connection read 
the radio welcome webpage and retrieve from it the song and artist 
information then it build a nice reply and reply
lately the radio's website have changed the why this inforation is 
updated and provided.
in result the new system is slow and messy some time the current 
song on air is not documented ... thru the radio's website
so as the shoutcast server provide that information my  thoughs are 
can we with rebol 2  retrieve from a shoutcast server the appropriate 
information  and how to do that using rebol?
ok never mind i found  a way  to do it   i will  copy and adapt the 
way php does it .... (shoutcast_class.php)
apparently the shoutcast datapart works like a regular webserver
fanally not so easy i don't  know why but with rebol i get no reply 
from the shoutcast server

http://ifb.impek.com:8000/  if i put that in my webbrowser i have 
the  full information
if someone can tell me what to do to get the reply that would be 
nice
Oldes
2-Dec-2009
[19954x3]
It's working fine with my cookies-daemon
without it I get some continuous stream
I think it's because of User-agent in the request
shadwolf
2-Dec-2009
[19957x2]
yeah the continous stream is the MP3 streaming part :P
shoutcast server goal are to broacast through internet MP3
(used for web radio and web TV ...)
Oldes
2-Dec-2009
[19959]
it's always good to use>> trace/net on
shadwolf
2-Dec-2009
[19960x4]
cookie demon ?
oldes i used it but i wasn't able to understand the result
oldes so how do you made it to get the information where can i get 
your cookie deamon ?
.... ooooooooooooooldeeeeeeeeeeeees comebaaaaaaaaaaaaaaack pleaaaaaaaaase 
T___T
Oldes
2-Dec-2009
[19964]
system/schemes/http/user-agent: "Mozilla/4.0 (compatible; MSIE 6.0; 
Windows NT 5.0)"
that's enough
shadwolf
2-Dec-2009
[19965x2]
then what you do ?
data: read http://ifb.impek.com:8000/
print data
Oldes
2-Dec-2009
[19967x3]
the cookies-daemon is not needed here. It's just the peace of code 
which makes REBOL to look like a browser.
yes.
but I don't know what exactly do you need, if the text info which 
you get in the browser or the mp3 data
shadwolf
2-Dec-2009
[19970]
want to know the worst oldes ?
Oldes
2-Dec-2009
[19971]
if you need the mp3, than just use for example:
system/schemes/http/user-agent: "Winamp"
shadwolf
2-Dec-2009
[19972x4]
i tryed with that  system/scheme/http/user-agent: "Mozilla/4.0"
and  got the stream mp3
in php that's what they do
they take a sample of the MP3 sent then they extract the metatag 
part to get the song and artists
Oldes
2-Dec-2009
[19976]
so you want the text? or what?
shadwolf
2-Dec-2009
[19977x3]
the HTML way is cool ... the MP3 way hangs  i don't know how to get 
only 1 sample to wor with it
in php they do it like that 

	function getHTML($page=False)
	{
		if (!$page)
			$page = $this->path;
		$contents = "";

  $domain = (substr($this->domain, 0, 7) == "http://") ? substr($this->domain, 
  7) : $this->domain;



  if (@$fp = fsockopen($domain, $this->port, $this->errno, $this->errstr, 
  2))
		{
			fputs($fp, "GET ".$page." HTTP/1.1\r\n".

    "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n".
				"Accept: */*\r\n".
				"Host: ".$domain."\r\n\r\n");

			$c = 0;
			while (!feof($fp) && $c <= 20)
			{
				$contents .= fgets($fp, 4096);
				$c++;
			}

			fclose ($fp);

			$this->encodeContent($contents);

			preg_match("/(Content-Type:)(.*)/i", $contents, $matches);
			if (count($matches) > 0)
			{
				$contentType = trim($matches[2]);


    preg_match("/(meta http-equiv=\"Content-Type\" content=\"(.*); charset=(.*)\")/iU", 
    $contents, $matches);
				if (isset($matches[3]))
				{
					$this->setStreamEncoding($matches[3]);
				}
				if ($contentType == "text/html")
				{
					$this->isShoutcast = True;
					return $contents;
				}
				else
				{
					$this->isShoutcast = False;


     $htmlContent = substr($contents, 0, strpos($contents, "\r\n\r\n"));


     $dataStr = str_replace("\r", "\n", str_replace("\r\n", "\n", $contents));
					$lines = explode("\n", $dataStr);
					foreach ($lines AS $line)
					{
						if ($dp = strpos($line, ":"))
						{
							$key = substr($line, 0, $dp);
							$value = trim(substr($line, ($dp+1)));
							if (preg_match("/genre/i", $key))
								$this->nonShoutcastData['Stream Genre'] = $value;
							if (preg_match("/name/i", $key))
								$this->nonShoutcastData['Stream Title'] = $value;
							if (preg_match("/url/i", $key))
								$this->nonShoutcastData['Stream URL'] = $value;
							if (preg_match("/content-type/i", $key))
								$this->nonShoutcastData['Content Type'] = $value;
							if (preg_match("/icy-br/i", $key))

        $this->nonShoutcastData['Stream Status'] = "Stream is up at ".$value."kbps";
							if (preg_match("/icy-notice2/i", $key))
							{

        $this->nonShoutcastData['Server Status'] = "This is <span style=\"color: 
        red;\">not</span> a Shoutcast server!";
								if (preg_match("/ultravox/i", $value))

         $this->nonShoutcastData['Server Status'] .= " But an <a href=\"http://ultravox.aol.com/\" 
         target=\"_blank\">Ultravox</a> Server";
								$this->altServer = $value;
							}
						}
					}
					return nl2br($htmlContent);
				}
			}
			else
				return $contents;
		}
		else
		{
			return False;
		}
	}
but as they you the Mozilla thing i think they are working on the 
HTML version and not the meta tag
Oldes
2-Dec-2009
[19980]
p: open/direct/no-wait/binary http://ifb.impek.com:8000/
buf: copy/part p 2048
probe as-string copy/part  buf find buf "^M^/^M^/"
close p
shadwolf
2-Dec-2009
[19981]
** Script Error: copy expected range argument of type: number series 
port pair
** Where: getHTML
** Near: probe as-string copy/part buf find
Oldes
2-Dec-2009
[19982x5]
after the ICY info there is MP3 stream which can contain ID3 tags
you can get the stream using something like:
while [not none? buf: copy/part p 2048][probe buf]
that means that there was not found the "^M^/^M^/"
so you want the HTML?
for MP3 use:
system/schemes/http/user-agent: "Winamp"