utorrent-webapi-ruby 0.0.2.1 → 0.0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/u_torrent/file.rb +4 -0
- data/lib/u_torrent/torrent.rb +26 -5
- data/lib/u_torrent/version.rb +1 -1
- data/utorrent-webapi-ruby.gemspec +1 -0
- metadata +4 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 64bac2390c6016d08b37b91ea9173b0750a39d6e
         | 
| 4 | 
            +
              data.tar.gz: 0dbeafe21718f8ab7dfe7b2e324a9c11d8c564c5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c45bfd09a2a450c8621e5e7041396ad2a6e8fedded98ae22ea051cea2a1860c4af801fcce8c7f4d8ae003bf7f29ba9ecfdce5a1446f9a08548b4baed86265a0a
         | 
| 7 | 
            +
              data.tar.gz: c6d39fdcf8d191a8ef92cd5668c9ab760e9899d939eb54bafaf75ddb231843ccb3422d16250889a1fee57b58ee4c9c51d90a1afa3ec11635b56cf40e79f05993
         | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/u_torrent/file.rb
    CHANGED
    
    
    
        data/lib/u_torrent/torrent.rb
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            require 'timeout'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module UTorrent
         | 
| 2 4 | 
             
              class Torrent
         | 
| 3 5 | 
             
                STATUSES = {
         | 
| @@ -21,7 +23,7 @@ module UTorrent | |
| 21 23 | 
             
                  :id, nil, :name, :size, nil, :downloaded, :uploaded, :ratio,
         | 
| 22 24 | 
             
                  :upload_speed, :download_speed, :eta, :label, :peers_connected,
         | 
| 23 25 | 
             
                  :peers_in_swarm, :seeds_connected, :seeds_in_swarm, :availability,
         | 
| 24 | 
            -
                  :queue_order, :remaining,  | 
| 26 | 
            +
                  :queue_order, :remaining, :url, nil, :status, nil, nil, nil, nil,
         | 
| 25 27 | 
             
                  :current_directory, nil, nil, nil
         | 
| 26 28 | 
             
                ]
         | 
| 27 29 |  | 
| @@ -40,11 +42,20 @@ module UTorrent | |
| 40 42 | 
             
                def self.add(url)
         | 
| 41 43 | 
             
                  UTorrent::Http.get_with_authentication(
         | 
| 42 44 | 
             
                    action: 'add-url',
         | 
| 43 | 
            -
                    s:      url
         | 
| 45 | 
            +
                    s:      url,
         | 
| 46 | 
            +
                    label: 'foobar'
         | 
| 44 47 | 
             
                  )
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                   | 
| 47 | 
            -
             | 
| 48 | 
            +
             | 
| 49 | 
            +
                  Timeout.timeout(5) do
         | 
| 50 | 
            +
                    while(true) do
         | 
| 51 | 
            +
                      all_torrents = UTorrent::Torrent.all
         | 
| 52 | 
            +
                      matching_torrent = all_torrents.detect do |torrent|
         | 
| 53 | 
            +
                        torrent.url == url
         | 
| 54 | 
            +
                      end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                      return matching_torrent unless matching_torrent.nil?
         | 
| 57 | 
            +
                    end
         | 
| 58 | 
            +
                  end
         | 
| 48 59 | 
             
                end
         | 
| 49 60 |  | 
| 50 61 | 
             
                def statuses
         | 
| @@ -57,6 +68,16 @@ module UTorrent | |
| 57 68 | 
             
                  @raw_array[4].to_f / 10
         | 
| 58 69 | 
             
                end
         | 
| 59 70 |  | 
| 71 | 
            +
                def label=(label)
         | 
| 72 | 
            +
                  UTorrent::Http.get_with_authentication(
         | 
| 73 | 
            +
                    action: 'setprops',
         | 
| 74 | 
            +
                    hash:   id,
         | 
| 75 | 
            +
                    s:      'label',
         | 
| 76 | 
            +
                    v:      label
         | 
| 77 | 
            +
                  )
         | 
| 78 | 
            +
                  refresh!
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
             | 
| 60 81 | 
             
                def files
         | 
| 61 82 | 
             
                  response = UTorrent::Http.get_with_authentication(action: 'getfiles', hash: id)
         | 
| 62 83 | 
             
                  files_array = JSON.parse(response.body)['files'].last
         | 
    
        data/lib/u_torrent/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: utorrent-webapi-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Peter Wu
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-03- | 
| 11 | 
            +
            date: 2016-03-31 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: nokogiri
         | 
| @@ -53,9 +53,9 @@ require_paths: | |
| 53 53 | 
             
            - lib
         | 
| 54 54 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 55 55 | 
             
              requirements:
         | 
| 56 | 
            -
              - - " | 
| 56 | 
            +
              - - "~>"
         | 
| 57 57 | 
             
                - !ruby/object:Gem::Version
         | 
| 58 | 
            -
                  version: '0'
         | 
| 58 | 
            +
                  version: '2.0'
         | 
| 59 59 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 60 60 | 
             
              requirements:
         | 
| 61 61 | 
             
              - - ">="
         |