Your Digital Media Has Never Looked So Good

  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
 
Goemon
Posts: 38
Joined: Sat Oct 20, 2007 6:58 am
Location: Germany
Contact:

Sun Jan 13, 2008 11:58 am

Thanks for the information on the display size. So I am a lucky guy with high resolution :D

I appolgize for elimination of the "local" file from the initial script. It was a good idea and makes use for different languages and locations easier.

Haggis, when you press home 3 times the wget tries to get the actual RSS weather data sometimes it takes some seconds. There are two mesages to the display (please wait, get weather data from Yahoo) maybe thats out of the display to? otherwise you can write a new line into the script, something like "print "checkppoit"; and use this as debug info on your console.

Last thing, look for an other weather service for your location. It must not be RSS. Also most WAP sitesare fine (small files and easy structured HTML) to sqeeze the wheather info from it.

Goemon
Last edited by Goemon on Tue Aug 19, 2008 12:05 pm, edited 1 time in total.
Soundbridge M1001 / uNSLUng / mt-daapd / [url=http://billiatjapan.netfirms.com/Tools4Roku] Tools4Roku
Image
[/url]
 
elnjensen
Posts: 2
Joined: Sat Jan 12, 2008 10:34 pm

One change for Mac OS X

Sun Jan 13, 2008 12:09 pm

Thanks, Haggis!

One additional change, if anyone is trying to run this on Mac OS X:

OS X doesn't come with the "wget" command installed (at least not in 10.4), but it does have "curl", which has similar functionality. So replace "wget -q -O -" with "curl --silent" and it works fine; no need to install wget.

Also, I changed the line:
       $to1date = substr($1, 0, 2).".".$monname{substr($1, 3, 3)}; # the date reformated: "dd mmm" to "dd.mm"   

to
        $to1date = $monname{substr($1, 3, 3)}."/".substr($1, 0, 2); # the date reformatted: "dd mmm" to "mm/dd"  

to put the date displayed into the US style month/day; likewise for $to2date.
 
Haggis
Posts: 11
Joined: Thu Dec 27, 2007 7:32 pm

Sun Jan 13, 2008 1:25 pm

Goemon wrote:
Haggis, when you press home 3 times the wget tries to get the actual RSS weather data sometimes it takes some seconds. There are two mesages to the display (please wait, get weather data from Yahoo) maybe thats out of the display to?
Goemon

When I press home 3 times, the display does not change. I know what messages you are talking about, I see them when T4ROKU first gets the weather info. I moved the Y offset so I can see them on my screen, but I don't see these messages (or even a screen clear) when pressing home 3 times.

First time I press home takes me to the menu as normal. Second time locks up the soundbridge for approx 20 seconds. The screen does not clear and no messages appear. After 20 seconds, I can control the menu for a second or two with the remote, then it locks up for another 20 seconds again. This repeats several times, and then the soundbridge works normally. Maybe wget is retrying. I haven't had time to look into it.
 
Haggis
Posts: 11
Joined: Thu Dec 27, 2007 7:32 pm

Sun Jan 13, 2008 3:54 pm

I think there's an error in this line to calculate the wind direction:
$winddirection = $direction[ int($1/(360/($#direction + 1))+.50) ]; # the wind direction

If the direction is 350, this is int(350/(360/8)+.50) = 8. The array only has indexes from 0 to 7. I think there needs to be a modulo on this line.
$winddirection = $direction[ int($1/(360/($#direction + 1))+.50) % ($#direction + 1) ]; # the wind direction
 
danme
Posts: 55
Joined: Wed Feb 28, 2007 8:01 am
Location: Sweden

Mon Jan 14, 2008 12:54 pm

A tip that you might find useful. I have made a script my own previously that have the same functionality as "pressing home button three times", but instead uses the on/off button ("double click"). When this is done a menu will be shown. And one of the options is "shutdown music server" which will do "shutdown -h now".
 
racingMarco
Posts: 4
Joined: Mon Jan 14, 2008 12:36 pm
Location: Germany

Mon Jan 14, 2008 12:55 pm

Hi,
first of all thanks for your efforts!!!

I tested Goemon and Haggis .pl files on my two SB M-1000.
Haggis one works perfect.
With Goemon's one i've the problem that i only see half of the information.

I think Goemon's soundbridge has already the new display from the sb Radio (280x32). I think they now produce at roku only one display for the soundbridge m-1001 and the sb-radio, to reduce the production costs.

M-1000 (280x16) all versions
M-1001 (280x16) older versions
M-1001 (280x32) newer versions ???
Radio (280x32) all versions

When i press 3 Times Menu, it works most of the time with both scripts, but not everytime. I'll check that tomorrow.
 
bobinchicago
Posts: 136
Joined: Fri Feb 17, 2006 5:15 pm

Mon Jan 14, 2008 9:02 pm

I've managed to get the script running but not working (the m1001 version of the script) -- let me describe what I'm doing:

I went to http://www.weather.com and gave my location as Chicago, IL. The URL of the page it returned was http://weather.yahoo.com/forecast/USIL0228.html ; I assume the USIL0228 is what I need to enter as the $locationid value in the script.

Everything else is pretty straightforward and noted in earlier posts in this thread:

I set $display to the Soundbridge's IP address.

unitsID is f, direction has the English direction abbreviations.

Because I'm using OS X, I followed the warning (much appreciated!) to change the wget to curl:

$weatherdata = `curl -s -"http://weather.yahooapis.com/forecastrss?p=$locationid&u=$unitsid"`;

And I changed the to1date and to2date lines:
$to1date = $monname{substr($1, 3, 3)}."/".substr($1, 0, 2); # the date reformatted: "dd mmm" to "mm/dd"
(and similarly).

When I run the script, I get:
Image

Is this merely the particular server that the script uses is down, even though Yahoo's weather Web page server is running? Or maybe I made an incorrect assumption about the location ID? (On the off chance the US wasn't necessary, I tried just IL0228, but it didn't work either.) Or can you folks who know your way around scripting spot something else I might've done?

Many thanks not only for any advice anyone might have but to all who've worked on the scripts. It's very cool and I have a feeling I'm not very far at all from getting it running.
 
Goemon
Posts: 38
Joined: Sat Oct 20, 2007 6:58 am
Location: Germany
Contact:

Mon Jan 14, 2008 11:46 pm

Hello,

I get immideate response for the rss feed, but I noticed that there are differnet URL for the feed - the retruned data is the same.

If I go via www.yahoo.com it is:
http://xml.weather.yahoo.com/forecastrss?p=USIL0225&u=f

And via http://developer.yahoo.com/weather/ it is:
http://weather.yahooapis.com/forecastrss?p=USIL0225&u=f

maybe you can try to replace the server name...

Goemon
Soundbridge M1001 / uNSLUng / mt-daapd / [url=http://billiatjapan.netfirms.com/Tools4Roku] Tools4Roku

Image

[/url]
 
Goemon
Posts: 38
Joined: Sat Oct 20, 2007 6:58 am
Location: Germany
Contact:

Mon Jan 14, 2008 11:54 pm

Hello again,

I changed the icon drawing procedure a little to improve the speed. it now draws successive white pixel as a line now. this improved speed on my roku by over 50% (I drew all icons one after another and measured the time):
# perl fixicon.pl
start old
Old: 627sec
start new
New: 258sec

I will copy it into the t4roku script at next release. Change is at the botton:
sub drawIcon {
    my $filename = shift;
    my $u = shift;
    my $v = shift;
    my $bits = "";
    my $x;
    my $y;
    my $i;
    my $j;
    my $s;
    my $t;

    open(iconfile, "<$filename") || die "Icon file ".$filename." not found!";
       my @icon = <iconfile>;
       my $cnt = 0;
       my $s2;
       my $help;
    close(iconfile);
    if ($icon[0] eq "P1\n" ) { # continue because its a PBM file
       # read the pbm dimensions
       $icon[2] =~ /^([0-9]+) ([0-9]+)/;
       $x = $1 ;
       $y = $2 ;
       # make a black box before drawing
       $display->cmd("sketch -c color 0");
       $display->cmd("sketch -c rect $u $v $x $y");
       $display->cmd("sketch -c color 1");

       foreach (@icon) {
         $bits = $bits.$_ ;
       };
       $bits =~ s/\n//;
       $bits =~ s/^.* $x $y//;
       for ($j = 0; $j < $y; $j++) {
           for ($i = 0; $i < $x; $i++) {
           $cnt = 1;
           $bits =~ s/([0|1]) //;
           if ($1 eq 1) {
             $s = $u+$i;
                $t = $v+$j;
                while ( ($1 == 1) and ($i < $x-1) ) {
                 $bits =~ s/([0|1]) //;
                $i++;
                 if ($1 == 1) {
                    $cnt++;
                 };
                }
                $s2 = $s + $cnt;
                $display->cmd("sketch -c line $s $t $s2 $t"); # line x1 y1 x2 y2       
           }
         }
       }
    }
}


regards Goemon
Soundbridge M1001 / uNSLUng / mt-daapd / [url=http://billiatjapan.netfirms.com/Tools4Roku] Tools4Roku

Image

[/url]
 
racingMarco
Posts: 4
Joined: Mon Jan 14, 2008 12:36 pm
Location: Germany

Tue Jan 15, 2008 1:52 pm

I posted my version at http://www.file-upload.net/download-612794/t4roku-m1000.pl.html


For the M1000/M1001 with 280x16 display

Changes:

- Changed fonts and Y offsets for 280x16 display
- new drawing procedure from Goemon (awesome!!!)

Work to do:

- Convert/Create 16x16 icons

Thanks to Goemon and Haggis Image
 
Goemon
Posts: 38
Joined: Sat Oct 20, 2007 6:58 am
Location: Germany
Contact:

Wed Jan 16, 2008 3:44 pm

Thanks danme, the idea for server shutdown is great. On my uNSLUng it does not work with "shutdown -h now" but with "/usr/sbin/DO_Shutdown". I will set this on the to do list :wink:

Goemon
Soundbridge M1001 / uNSLUng / mt-daapd / [url=http://billiatjapan.netfirms.com/Tools4Roku] Tools4Roku

Image

[/url]
 
bobinchicago
Posts: 136
Joined: Fri Feb 17, 2006 5:15 pm

Thu Jan 17, 2008 11:26 pm

Goemon wrote:
Hello,

I get immideate response for the rss feed, but I noticed that there are differnet URL for the feed - the retruned data is the same.

If I go via www.yahoo.com it is:
http://xml.weather.yahoo.com/forecastrss?p=USIL0225&u=f

And via http://developer.yahoo.com/weather/ it is:
http://weather.yahooapis.com/forecastrss?p=USIL0225&u=f

maybe you can try to replace the server name...

Goemon

Hi, Goemon, thanks very much for helping -- I got some time to read up on curl over the last couple of days, and the syntax was wrong (at least for the version of curl installed with my Mac); the - before the URL shouldn't have been there, and once I took it out, the script worked fine. My next project is to put this into cron so it will run just before I get up in the morning (I use my SB Radio in the morning, so the M1001 this is running on isn't used otherwise) and then switch back to the regular display once I've left. Thanks again!
 
Goemon
Posts: 38
Joined: Sat Oct 20, 2007 6:58 am
Location: Germany
Contact:

Fri Jan 18, 2008 3:07 pm

Hello,

The next level :lol: . Today I have got the last missing part for my project. The USB2Serial adapter (PL2303 chip based) arrived and my digitemp setup on the server works:

# pwd
/opt/bin

# digitemp_DS9097 -v -s /dev/ttyUSB0 -i
DigiTemp v3.4.0 Copyright 1996-2005 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Turning off all DS2409 Couplers
.
Searching the 1-Wire LAN
10874A37010800D3 : DS1820/DS18S20/DS1920 Temperature Sensor
ROM #0 : 10874A37010800D3
Wrote .digitemprc

# digitemp_DS9097 -a
DigiTemp v3.4.0 Copyright 1996-2005 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Jan 18 22:52:22 Sensor 0 C: 20.62 F: 69.12


A problem is that the adapter is USB 1.1 and does not work on my USB 2.0 hub :evil: . Simply putting the Hub together with the UNSLUNG dist did not work. Anyway I can play and write some more lines in perl to show my local temperature in addition to the RSS data. I will post this here too.

This link is the Instruction for the hardware and software setup.
This link is the Homepage for DigiTemp.

Good night
Soundbridge M1001 / uNSLUng / mt-daapd / [url=http://billiatjapan.netfirms.com/Tools4Roku] Tools4Roku

Image

[/url]
 
Goemon
Posts: 38
Joined: Sat Oct 20, 2007 6:58 am
Location: Germany
Contact:

Clean killing ...

Sat Jan 19, 2008 7:48 am

I had a problem that the Roku become a unresponsive Brick, when I shut down the server which runs t4roku. So here is the solution for a clean killing (based un my uNSLUng server)

Write a new file in /opt/etc/init.d starting with "K" so that ist will be called at shutdown. My file "K80t4roku" contains:
kill `pidof perl t4roku.pl`
cd /public/t4roku
perl cleanroku.pl

If the t4roku is killed only, it will leave your Roku unresponsible...
Make both files accessible with
chmod 711 K80t4roku

The script rokuclean.pl contains the following code
#!/usr/bin/perl
use strict;
use RokuUI;
my $display = RokuUI->new(host => '192.168.123.123', port => 4444);
for my $int ('INT','QUIT','HUP','TRAP','ABRT','STOP') {
      $SIG{$int} = 'interrupt';
}
$display->open || die("Could not connect to Roku Soundbridge"); 
$display->close;
sub interrupt {exit(@_)};
END {
  undef $display; 
}

That works fine for me.
Soundbridge M1001 / uNSLUng / mt-daapd / [url=http://billiatjapan.netfirms.com/Tools4Roku] Tools4Roku

Image

[/url]
 
racingMarco
Posts: 4
Joined: Mon Jan 14, 2008 12:36 pm
Location: Germany

Sat Jan 19, 2008 9:28 am

I posted a new version at

http://www.file-upload.net/download-619400/t4roku_m1000.zip.html


For the M1000/M1001 with 280x16 display

Changes:

- Made and Added 16x16 Icon's


If someone has better 16x16 Icon's please Contact me, thanks.

Thanks to Goemon for the awesone script!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 7

Who is online

Users browsing this forum: No registered users and 2 guests