You are not logged in.

#1 2013-08-08 16:10:55

utdemir
Member
Registered: 2009-06-10
Posts: 23

QrPush - Send files to your smartphone in local network using WiFi

Hi.

I wrote a short Ruby script for sending files to your phone, which should be in the same network with your computer.

The script simply runs a simple web server, and generates a barcode pointing to the computer's IP and applications port. And you just point your phone to the barcode generated and your phone starts downloading using its web browser.

With this way, I could stream HD videos without any delay.

It's also my first Ruby code, I'll happily accept suggestions.

https://github.com/utdemir/qrpush

Offline

#2 2013-08-08 16:47:11

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: QrPush - Send files to your smartphone in local network using WiFi

doesnt work with escaped filenames:

./qrpush.rb:47:in `escape_filename': undefined local variable or method `fnamex' for main:Object (NameError)
	from ./qrpush.rb:90:in `<main>'

Also does not detect my IP:

1 carnager@caprica ~/qrpush (git)-[master] % ./qrpush.rb ~/20130730125833.webm
Url: http://:9090/20130730125833.webm

Last edited by Rasi (2013-08-08 16:48:26)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#3 2013-08-08 17:52:21

utdemir
Member
Registered: 2009-06-10
Posts: 23

Re: QrPush - Send files to your smartphone in local network using WiFi

Rasi wrote:

doesnt work with escaped filenames:

./qrpush.rb:47:in `escape_filename': undefined local variable or method `fnamex' for main:Object (NameError)
	from ./qrpush.rb:90:in `<main>'

Sorry, typo on my side, fixed.

Rasi wrote:

Also does not detect my IP:

1 carnager@caprica ~/qrpush (git)-[master] % ./qrpush.rb ~/20130730125833.webm
Url: http://:9090/20130730125833.webm

Don't know why, getting IP address was pretty simple:

def get_ip_addresses
  locals = %w(127.0.0.1 ::1)
  addresses = Socket.ip_address_list.select{|a| a.ipv4?}
  addresses.map!{|a| a.ip_address}
  addresses.select!{|a| not locals.include? a}
  addresses
end

Can you post the output of command

ruby -e "require 'socket'" -e "p Socket.ip_address_list"

Offline

#4 2013-08-08 20:43:46

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: QrPush - Send files to your smartphone in local network using WiFi

[#<Addrinfo: 127.0.0.1>, #<Addrinfo: 192.168.1.13>, #<Addrinfo: ::1>, #<Addrinfo: fe80::22cf:30ff:fe23:c132%eth0>]

have you pushed the fix? git says its up to date.

Last edited by Rasi (2013-08-08 20:44:20)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#5 2013-08-08 21:00:25

utdemir
Member
Registered: 2009-06-10
Posts: 23

Re: QrPush - Send files to your smartphone in local network using WiFi

Fixed both bugs, thank you for reporting smile. (And also pushed)

Last edited by utdemir (2013-08-08 21:01:02)

Offline

#6 2013-08-08 21:51:16

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: QrPush - Send files to your smartphone in local network using WiFi

working fine now. nice little tool


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#7 2013-08-09 00:02:54

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: QrPush - Send files to your smartphone in local network using WiFi

I've never used ruby before so I'm probably missing something obvious, but what does this mean

$ ./qrpush.rb ~/music/morrissey/morrissey_20130119_port-chester-ny/Moz\ 20130119\ 01\ That\ Joke\ Isn\'t\ Funny\ Anymore.flac 
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- rqrcode (LoadError)
	from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
	from ./qrpush.rb:3:in `<main>'

Offline

#8 2013-08-09 11:56:32

utdemir
Member
Registered: 2009-06-10
Posts: 23

Re: QrPush - Send files to your smartphone in local network using WiFi

Hi oliver, thanks for trying smile.

You can install all dependencies after installing bundler. First, install bundle with either with "gem install bundler" or ruby-bundler package from AUR. After that give,

bundle install 

command on projects directory(where Gemfile is). This should install all dependencies("rqrcode" and "ruby-filemagic").

Offline

#9 2013-08-09 13:10:45

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: QrPush - Send files to your smartphone in local network using WiFi

thanks!  I went the AUR way and it's all working well now.

Offline

#10 2013-08-09 16:21:28

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: QrPush - Send files to your smartphone in local network using WiFi

Works great! Thanks!

Offline

Board footer

Powered by FluxBB