Start, Shutdown, Reboot, & Control your PC from the XMB !

General discussion about PS3 Media Server (no support or requests)

Start, Shutdown, Reboot, & Control your PC from the XMB !

Postby mario595 » Mon Apr 09, 2012 3:56 am

Before I begin let me start with the genesis of this solution. My PC is located far away from my PS3. It is on another floor. My network is wired with long runs of Cat6 cable. I recently was working through problems running the PS3 media server as a service (it would disappear randomly) and some other transcoding crashes. Working through these issues required getting to the PC, waking up the monitor, bring up a services window, etc. I would need to restart the service and sometimes reboot the PC. It was getting annoying. After resolving all my problems I set out to find a way to control my PC from the PS3 without having to use a dataphone or tablet.

Besides those functions I also wanted to be able to easily stop my torrents from uploading and downloading when I was using the media server. I keep all my media server folders on the same RAID drive as where I do all my uploading/downloading so I want all IO to be dedicated to the PS3 when I am streaming or transcoding. I like to FF, REW, and GOTO frequently.

I am going to try to make this easy for those who are not programmers or web gurus but to put in every detail is too involved. You may need extra help to get it all working. For the experts, you will be able to customize this to fit your needs. I am splitting this solution up into 3 posts.

1) Turning on your PC from the XMB
2) Controlling your PC
3) Controlling uTorrent bit torrents

To accomplish these goals I am going to be utilizing the PS3 web browser but do everything with an infra-red (IR) remote. The PS3 remote control is blue-tooth. I have a universal RF master remote that controls several infra-red devices in my living room; one being the PS3. To add the PS3, I bought a PS3 infrared remote and programmed it into my universal. (It comes with a dongle that you leave in one of the USB ports). You don't get every button on the blue-tooth remote but you do get everything on the game controller. The circle, triangle, square, circle, up, down, left, right buttons are required for this solution. You can of course just use your game controller.

Here is a picture of the final product:

Image
mario595
 
Posts: 62
Joined: Mon Nov 09, 2009 7:12 pm

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby mario595 » Mon Apr 09, 2012 3:59 am

Turning on your PC from the XMB -


To turn on your PC you need a WOL (wake on lan) enabled PC network card, PC motherboard, and network router. There are many howto's that explain how to set up wake on lan on your PC. Here's one for Windows 7: http://windows7-issues.blogspot.com/201 ... -easy.html

The PS3 web browser is not a fully functional web browser. The ranking of browsers by capablities is: Dataphone -> PS3 -> Tablet -> PC.

In the PS3 browser go to and bookmark the URL: m.wakeonlan.me

On this page there are only 2 fields that you need to fill in- your PC's external IP and MAC address. The first time you do this is a pain using any remote or controller instead of a keyboard. HOWEVER, once you have typed in these two sequences of numbers the autofill will remember what you entered and make it really easy from there on out.

For example, if your external ip address is 33.444.555.66 then once you select 3 the autofill will pop up the full ip. Select it and <enter>. Same goes for mac address. If your mac address is 00:11:22:33:44 as soon as you type in the 0 autofill will take over. After the ip address and mac addresses are entered use the down button to get to "Wake Up my PC!" and hit the X button. You will be shocked how quickly your computer will start to boot. Make this the first bookmark so you can get to it quickly.
mario595
 
Posts: 62
Joined: Mon Nov 09, 2009 7:12 pm

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby mario595 » Mon Apr 09, 2012 4:09 am

Controlling your PC -


To control the PC in a nutshell, you are going to make your PC a web server. The web server will contain only one page. The page will only be accessed using your PC's internal 192.168.x.xxx address. In my case 192.168.1.100. This "index.html" page will be a simple list of links. Each link will fire off an action on your PC. This page will be made the homepage on the PS3 browser. So whenever you access the PS3 web browser your web page pops up then you select whichever link you want to execute on your PC using the arrow buttons and X. Following is a rundown of how to do that:

There is a free and small web server application that has very little overhead called Abyss Web Server x1. Install it (or something similar) on your PC and configure it to come up at automatically when the PC is booted. To lessen any negative impact, we will use a port other than 80. For my example I will configure it to port 12345. In order to access our webpage in the PS3 browser you will bookmark and make (in my case) http://192.168.1.100:12345 the homepage.

To control the PC my links are executing Perl scripts and I configured my webserver to enable Perl script executions. You can set yours up to execute VB, Java, CGI, or any scripting language that you are familiar with then update the files that are executed when the links are selected. Installing Perl is like installing Java but not as easy. You can do an internet search to learn how to do that.

To make things simple I just put everything in Abyss's default directory. Here is what my index page looks like. I made it in Microsoft Frontpage:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso 8859-1">
<TITLE>PC Control Page</TITLE>
<STYLE type="text/css">
<!--
BODY {
   FONT-SIZE: small; COLOR: #000000; FONT-FAMILY: "trebuchet ms", Verdana, Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #FFFFFF
}

H1 {
   FONT-SIZE: large;
}

A:hover {
   COLOR: #ff9900; TEXT-DECORATION: underline;
}

.footer {
   TEXT-ALIGN: center; FONT-SIZE: smaller;
}

.footer IMG {
   BORDER: 1px solid #888;
}
-->
</STYLE>
</HEAD>
<BODY bgColor="#ffffff" text="#000000" background="ps3_wallpaper.jpg">
<p>&nbsp;</p>
<table cellpadding="0" cellspacing="0" width="1000" height="450">
   <!-- MSTableType="layout" -->
   <tr>
      <td align="center"><font face="Arial Narrow" size="6" color="#FFFFFF">
      <a style="color: #FFFFFF" href="MS_Stop.pl">STOP Media Server Service</a></font></td>
      <td align="center" height="150">
      <font face="Arial Narrow" size="6" color="#FFFFFF">
      <a style="color: #FFFFFF" href="MS_Start.pl">START Media Server Service</a></font></td>
   </tr>
   <tr>
      <td align="center"><font face="Arial Narrow" size="6" color="#FFFFFF">
      <a style="color: #FFFFFF" href="uTorrent_Pause.pl">PAUSE uTorrent Downloads</a></font></td>
      <td align="center" height="150">
      <font face="Arial Narrow" size="6" color="#FFFFFF">
      <a style="color: #FFFFFF" href="uTorrent_Start.pl">RESTART uTorrent
      Downloads</a></font></td>
   </tr>
   <tr>
      <td align="center" width="500">
      <font face="Arial Narrow" size="6" color="#FFFFFF">
      <a style="color: #FFFFFF" href="PC_Shutdown.pl">Shutdown PC</a></font></td>
      <td align="center" height="150" width="500">
      <font face="Arial Narrow" size="6" color="#FFFFFF">
      <a style="color: #FFFFFF" href="PC_Restart.pl">Restart&nbsp; PC</a></font></td>
   </tr>
</table>
</BODY></HTML>


Copy and paste this code to a notepad document and save it as index.html in the default directory. You can view it in notepad and see what the names of the links are and what perl file (*.pl) it executes. You can use any .jpg as the background. Name it ps3_wallpaper.jpg and put in the same default directory. Do a google search on "ps3" and "wallpaper" to find the one I used.

Here is the code for the .pl scripts. Save each as a separate files in your default directory but make sure you spell everything exactly as is in the index.html file:

Code: Select all
# MS_Start.pl
#
# Perl script to start the PS3 Media Server service from a webpage
#
use strict;
use warnings;
my $cmd = `net start "PS3 Media Server" `;
my $url = "http://192.168.1.100:12345/";
print "Location: $url\n\n";


# MS_Stop.pl
#
# Perl script to stop the PS3 Media Server service from a webpage
#
use strict;
use warnings;
my $cmd = `net stop "PS3 Media Server" `;
my $url = "http://192.168.1.100:12345/";
print "Location: $url\n\n";


# PC_Restart.pl
#
# Perl script to shutdown the PC from a webpage
#
use strict;
use warnings;
my $cmd = `shutdown -s -t 0`;
my $url = "http://192.168.1.100:12345/";
print "Location: $url\n\n";


# uTorrent_pause.pl
#
# Perl script to pause all uTorrent downloads...
#
use strict;
use warnings;
use Net::uTorrent;
my $utorrent = Net::uTorrent->new (
               hostname   =>   'localhost',
               port      =>   '26693',
               user      =>   'admin',
               pass      =>   'admin',
               );
die unless $utorrent->login_success;
my $aref = $utorrent->torrents ;         # Returns a hashref containing all the torrents
my @infohashes;
my $args;
foreach my $line (@{$aref}) {
    $args = (values %$line)[14];
    $utorrent->pause($args);
   }
my $url = "http://192.168.1.100:12345/";
print "Location: $url\n\n";


# uTorrent_start.pl
#
# Perl script to start all uTorrent downloads...
#
use strict;
use warnings;
use Net::uTorrent;
my $utorrent = Net::uTorrent->new (
               hostname   =>   'localhost',
               port      =>   '26693',
               user      =>   'admin',
               pass      =>   'admin',
               );
die unless $utorrent->login_success;
my $aref = $utorrent->torrents ;         # Returns a hashref containing all the torrents
my @infohashes;
my $args;
foreach my $line (@{$aref}) {
    $args = (values %$line)[14];
    $utorrent->start($args);
   }
my $url = "http://192.168.1.100:12345/";
print "Location: $url\n\n";


When you select a link you will see the URL change. It will have the name of the perl file that is being executed. When the processing is complete the index page will reload signaling that processing is complete. It isn't difficult to update index.html to other functions. The .pl files can be modified to do anything that you can do from a Windows command prompt. Just change the "my $cmd =" line as desired
mario595
 
Posts: 62
Joined: Mon Nov 09, 2009 7:12 pm

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby mario595 » Mon Apr 09, 2012 4:13 am

Controlling uTorrent bit torrents -


This is a bit technical and more complicated. Perl knowledge is needed to get this working. In order to control uTorrent in a perl script there are a series of modules that need to be installed. These modules are not installed with the base Perl product. The primary module needed is net::uTorrent. You need to install that module and all its dependecies. The uTorrent the webUI interface needs to be enabled. Also, I am using the default port of 26993 for uTorrent downloads. You may be using a different one. The perl scripts provided above would need to be updated with the correct uTorrent port.

When I was working on the uTorrent control scripts I found a bug in net::uTorrent module. To fix it net::uTorrent acutally needs updated. This thread explains what you have to do:

http://forum.utorrent.com/viewtopic.php?id=114224
mario595
 
Posts: 62
Joined: Mon Nov 09, 2009 7:12 pm

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby meskibob » Mon Apr 09, 2012 4:52 am

Thread moved.
I provide NO application support via PM or email, so please post your question to the forum per the Forum Rules.
meskibob
Moderator
 
Posts: 4787
Joined: Mon Jan 19, 2009 4:11 pm

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby brandont » Sun May 20, 2012 8:42 pm

Anyone know where this was moved to? Anyone get shutting down from PS3 browser to work? If so, could someone maybe help me out? I almost got it but not 100%. PM if you would, thanks.

Never mind, found it.
brandont
 
Posts: 1
Joined: Sat May 19, 2012 2:32 am

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby Mesca » Fri Aug 24, 2012 3:28 pm

This serves a solution to a problem I was having perfectly. PMS should pick this up and run with it adding support/functionality to it, like putting a wake on LAN icon directly in the XMB.

I suscribed to this forum just to say thank you. ;)
Mesca
 
Posts: 2
Joined: Fri Aug 24, 2012 3:25 pm

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby taconaut » Fri Aug 24, 2012 3:36 pm

Mesca wrote:PMS should pick this up and run with it adding support/functionality to it, like putting a wake on LAN icon directly in the XMB.

I don't understand what you want to do with the wake on lan functionality. If you want to wake up the server through PMS in the XMB, it won't be possible as PMS won't show up in the XMB if the PC is sleeping.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1099
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Start, Shutdown, Reboot, & Control your PC from the XMB

Postby Mesca » Sat Aug 25, 2012 2:40 am

taconaut wrote:
Mesca wrote:PMS should pick this up and run with it adding support/functionality to it, like putting a wake on LAN icon directly in the XMB.

I don't understand what you want to do with the wake on lan functionality. If you want to wake up the server through PMS in the XMB, it won't be possible as PMS won't show up in the XMB if the PC is sleeping.

In my case, as long as the PMS was connected once the icon stays there even if the computer is asleep. As for how it would work while the computer is sleeping, I haven't the slightest clue.
Mesca
 
Posts: 2
Joined: Fri Aug 24, 2012 3:25 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests