tinyscrobbler 0.2 → 0.3

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.
data/example.rb CHANGED
@@ -1,18 +1,22 @@
1
1
  require 'rubygems'
2
- require 'tinyscrobbler.rb'
2
+ require 'tinyscrobbler'
3
3
 
4
4
  ls = Tinyscrobbler::Client.new(lastfm_username, lastfm_password)
5
5
 
6
6
  # Currently listening to...
7
7
 
8
8
  current_track = {'artistname' => 'Moonspell', 'track' => 'Alma Mater',
9
- 'time' => '1262185646', 'source' => 'P', 'rating' => '',
9
+ 'time' => Time.now.to_s, 'source' => 'P', 'rating' => '',
10
10
  'secs' => '337', 'album' => 'Wolfheart', 'tracknumber' => '8', 'mbtrackid' => ''}
11
11
 
12
+ # now playing notification
12
13
  ls.now_playing(current_track)
13
14
 
14
- # after track played
15
+ # lastfm does not submit the track if
16
+ # half track length has not passed
17
+ sleep 170
15
18
 
19
+ # after track played, lets submit
16
20
  ls.played(current_track)
17
21
 
18
22
 
data/lib/parser.rb CHANGED
@@ -7,8 +7,6 @@ module Tinyscrobbler
7
7
  # It currently supports only mp3 files.
8
8
 
9
9
  class Parser
10
-
11
- attr_accessor :metadata
12
10
 
13
11
  # Checks if given file exists and if is supported,
14
12
  # and calls the parser method, if not
@@ -23,6 +21,13 @@ module Tinyscrobbler
23
21
  @metadata = parse_metadata
24
22
  end
25
23
 
24
+ # Returns the metadata but updates the time param
25
+
26
+ def metadata
27
+ @metadata['time'] = Time.now.to_s
28
+ @metadata
29
+ end
30
+
26
31
  private
27
32
 
28
33
  # Returns the file metadata in a hash
data/lib/tinyscrobbler.rb CHANGED
@@ -166,7 +166,6 @@ module Tinyscrobbler
166
166
  when /BADSESSION/
167
167
  raise BadSessionError
168
168
  else
169
- puts response.inspect
170
169
  raise RequestFailedError, response
171
170
  end
172
171
  response
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinyscrobbler
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: "0.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rogerio Vicente