# show torrent metafile details on screen require 'extras/rubytorrent' def viewtorrentfile if ! @a_viewtorrent.to_s.empty? torrentfile = $progdir + "/" + $rwdtorrentfilesdir + "/" + @a_viewtorrent.to_s + ".torrent" begin # exception trapped block @a_torrentdata = dump_metainfo(RubyTorrent::MetaInfo.from_location(torrentfile)) rescue SystemCallError, StandardError, RubyTorrent::MetaInfoFormatError, RubyTorrent::BEncodingError => e $stderr.print "system call error: " + $! @a_torrentdata = $! rescue Timeout::Error, Exception $stderr.print "error: " + $! @a_torrentdata = $! end # exception rescue end end def viewtorrentfilehttp require 'extras/rubytorrent' if ! @a_viewtorrenthttp.to_s.empty? torrentfile = @a_viewtorrenthttp.to_s + ".torrent" begin # exception trapped block @a_torrentdata = dump_metainfo(RubyTorrent::MetaInfo.from_location(torrentfile)) rescue SystemCallError, StandardError, RubyTorrent::MetaInfoFormatError, RubyTorrent::BEncodingError,OpenURI::HTTPError => e $stderr.print "system call error: " + $! @a_torrentdata = $! rescue Timeout::Error, Exception $stderr.print "error: " + $! @a_torrentdata = $! end # exception end end def dump_metainfoinfo(mii) if mii.single? <" : mi.announce_list.map { |x| x.join(', ') }.join('; '))} creation date: #{mi.creation_date || ""} created by: #{mi.created_by || ""} comment: #{mi.comment || ""} EOS end