Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Final commits for initial release

  • Loading branch information...
commit 59ca91cbe85634fc91f16a07cf219a1ccdbe518f 1 parent 294a9b3
Jacob Harris authored
Showing with 27 additions and 4 deletions.
  1. +11 −1 README.rdoc
  2. +16 −3 lib/tweetftp.rb
View
12 README.rdoc
@@ -57,6 +57,15 @@ is hope though! Heavy users of twitter may apply for an elevated rate limit of
shared via tweetftp, and the journey is more important than reaching the destination,
isn't it?
+Search also has its limitation. Currently the Twitter search API returns no
+more than 30 pages of 50 results, meaning that it currently constrains
+uploaded files to a theoretical maximum of 1498 tweets of 77 Base-64 bits,
+meaning a maximum file size of 901K if you wanted to retrieve all of the
+fragments in a single go. That said, there are now multiple competing twitter
+search engines, and the tweetftp should support a streaming mode for download
+where fragments can be retrieved before the entire file is uploaded (not currently
+supported in this code).
+
Since it would take only 60,000 or so tweets to transmit an MP3, there would
exist the natural temptation to use this mechanism for illegal file sharing.
This problem is best addressable through legal and social solutions however,
@@ -66,8 +75,9 @@ NEVER use tweetftp to illegally share copyrighted material.
== Roadmap
* Actual tests
+* "Streaming" file downloads
* Checksum verifications of downloads
-* TworrentTracker for tracking public file uploads to twitter
+* Create a new standard named BitTworrent that allows files to be spread across multiple accounts.
* Get purchased by Google, Facebook, or a desperate media company.
== Copyright
View
19 lib/tweetftp.rb
@@ -69,9 +69,19 @@ def download(hash, sender, options={})
sorted_fragments = fragments.reject {|f| f =~ /^==/}.sort_by {|a| a.to_i }
- puts sorted_fragments.inspect
+ #puts fragments.inspect
+
+ header = fragments.detect {|f| f =~ /^==BEGIN/}
+
+ raise "No header found!" if header.nil?
+
+ if header =~ /^==BEGIN ([^\s]+) (\d+) /
+ filename = $1
+ mode = $2
+ else
+ raise "Unable to parse the header"
+ end
- mode = 644 # FIXME
tf.write "begin-base64 #{mode} tweetftp.tmp\n"
sorted_fragments.each do |f|
@@ -82,8 +92,11 @@ def download(hash, sender, options={})
tf.write "====\n"
tf.close
+
+ final_path = "#{options[:save_to].gsub(/\/$/, '')}/#{filename}"
- system("uudecode -o /tweetftp.dat #{tf.path}")
+ system("uudecode -o #{final_path} #{tf.path}")
+ final_path
end
private

0 comments on commit 59ca91c

Please sign in to comment.
Something went wrong with that request. Please try again.