first commit

This commit is contained in:
encrypt 2015-06-22 22:09:38 +02:00
commit c0e5944447
2 changed files with 53 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*~

52
prcdfs/prcd-fs.rb Normal file
View file

@ -0,0 +1,52 @@
require 'rfusefs'
require 'net/http'
require 'open-uri'
class PRCD
def initialize()
@prcd = { "cristo" => "cri",
"gesu" => "ges",
"madonna" => "mad",
"dio" => "dio",
"madre_teresa" => "mtc",
"papa" => "pap",
"varie" => "vsf"
}
@prcd.each do |key, value|
url = "http://www.papuasia.org/prcd/prcd_"+value+".txt"
puts url
@prcd[key] = []
open(url).each_line do |r|
@prcd[key].push(r.chomp)
end
end
end
def contents(path)
@prcd.keys.push("random")
end
def file?(path)
file, o = scan_path(path)
if !file.nil? && (@prcd.has_key?(file) || file == "random") && o == nil
return true
end
return false
end
def size(path)
10000
end
def read_file(path)
file, o = scan_path(path)
if file == "random"
@prcd[@prcd.keys.sample].sample
else
@prcd[file].sample
end
end
end
FuseFS.start(PRCD.new, ARGV.shift)