Active Topics

 



Notices


Reply
Thread Tools
qwazix's Avatar
Moderator | Posts: 2,622 | Thanked: 5,447 times | Joined on Jan 2010
#1
My pc serves as my music player and is hooked up to a competent pair of speakers. Most of the times I want to listen to a song though I'm not near the computer, but I have my phone in my hand. I wanted to be able to take advantage of the big speakers instead of listening to the tinny sound of the phone speakers, without having to move an inch.

As I mostly use YouTube and such to listen to individual songs, I wanted to be able to redirect the current url to firefox on my desktop.

The solution I found is to install nanoweb on the desktop (apache works fine too), change it to run as my desktop user, not www-data (you have to edit /etc/nanoweb.conf for that) and have it run the following index.php

PHP Code:
<?php
$u 
$_GET['url'];
if (isset(
$u)&&trim($u!="")){
   
exec('DISPLAY=:0 firefox "'.$u.'"');

?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<form action=index.php>
   <input name=url autofocus>
   <button>go</button>
</form>
Now when I visit http://192.168.1.XX from my phone, an input box shows up where I can paste a url which opens in a tab in firefox on the pc.

You can also enter the url directly as such

Code:
http://192.168.1.xx/?url=maemo.org
Next step is to install sharetus on my N9 and configure it to be able to share to my little service with a click.
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jollacontactlaunchtimenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob

Last edited by qwazix; 2013-05-15 at 21:00. Reason: Added double quotes around firefox parameter so that it handles url with spaces
 

The Following 3 Users Say Thank You to qwazix For This Useful Post:
qwazix's Avatar
Moderator | Posts: 2,622 | Thanked: 5,447 times | Joined on Jan 2010
#2
I installed latest sharetus from here https://github.com/jaywink/sharetus/....8.1_armel.deb (dependencies needed, use the package manager for easy install)

(big thanks goes to jaywink here)

and despite the warning I had to edit both /opt/sharetus/sharetus.json and ~/.sharetus/preferences.json

To the first I added
Code:
"playTo" : {
                "name" : "playTo my pc",
                "url" : "http://192.168.1.XXX/?url={{url}}" 
                }
after the clipboard entry and to the other I added

Code:
            "playTo" : {
                "name" : "playTo my pc",
                "url" : "http://192.168.1.XXX/?url={{url}}",
                "order" : 1,
                "visible" : 1
                }
after the clipboard entry. In the user preferences file I believe name and url are not needed, but as the system file is in danger to be overwritten I kept them there too for backup. Adding them only in the user preferences as per the documentation didn't work. I also changed the order of the diaspora entry to avoid any conflicts.
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jollacontactlaunchtimenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob

Last edited by qwazix; 2013-05-15 at 22:20. Reason: wrong sharetus version
 

The Following User Says Thank You to qwazix For This Useful Post:
Posts: 882 | Thanked: 1,310 times | Joined on Mar 2007
#3
My favorite site didn't work, does it work for you?

Code:
http://%22%3bsudo%20reboot%3becho%22
 
qwazix's Avatar
Moderator | Posts: 2,622 | Thanked: 5,447 times | Joined on Jan 2010
#4
My internal network does have a firewall. And sudo has a password. So no, it doesn't.

If you'd like the previous song to stop when you play another one here's a more elaborate script

index.php
Code:
<?php
$u = $_GET['url'];
echo $u;
$u = rawurlencode($u);
if (isset($u)&&trim($u!="")){
   exec('DISPLAY=:0 firefox "http://localhost/openInPopup.php?url='.$u.'"');
} 
?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<form action=index.php>
   <input name=url autofocus>
   <button>go</button>
</form>
<form action=index.php>
   <input type=hidden name=url value=about:blank>
   <button>stop</stop>
</form>
openInPopup.php
Code:
<input id=url value="<?=rawurldecode($_GET['url'])?>" />
<script>
  window.open(document.getElementById('url').value,"playToPopup",'height=500,width=1000');
</script>
you still get a bunch of new tabs however. If somebody knows how to open a new named window from the command line for firefox, or how to run javascript from the terminal let me know.

the obvious
Code:
firefox javascript:window.open( ... )
doesn't work
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jollacontactlaunchtimenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob

Last edited by qwazix; 2013-05-15 at 22:32.
 
nokiabot's Avatar
Posts: 1,974 | Thanked: 1,834 times | Joined on Mar 2013 @ india
#5
How do u gyus get such ideas
good job
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:10.