tinyscrobbler 0.3.1 → 0.3.2
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/Changelog +167 -1
- data/README.md +3 -4
- data/lib/parser.rb +6 -5
- data/lib/tinyscrobbler.rb +15 -16
- metadata +4 -4
data/Changelog
CHANGED
|
@@ -1 +1,167 @@
|
|
|
1
|
-
|
|
1
|
+
commit 20e419aca78fce1d95b185e0da77965e61ea2746
|
|
2
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
3
|
+
Date: Mon Feb 15 16:30:29 2010 +0000
|
|
4
|
+
|
|
5
|
+
Changed client identifier provided by last.fm
|
|
6
|
+
|
|
7
|
+
commit 1f51ac4a62e73c118b8cfc408a6693ccf16020e8
|
|
8
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
9
|
+
Date: Sun Feb 14 23:00:28 2010 +0000
|
|
10
|
+
|
|
11
|
+
Removed error in main test. Removed require parser in Tinyscrobbler.rb
|
|
12
|
+
|
|
13
|
+
commit a9d7ab6aedf5510b81b5d8f5609d70399805c5af
|
|
14
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
15
|
+
Date: Sun Jan 31 01:55:04 2010 +0000
|
|
16
|
+
|
|
17
|
+
Solved 2 code smells from reek tests.
|
|
18
|
+
|
|
19
|
+
commit d54019d3fc4f3b5b5e92b7c230a6a5ef13ea7cc4
|
|
20
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
21
|
+
Date: Wed Jan 27 02:08:07 2010 +0000
|
|
22
|
+
|
|
23
|
+
README updated
|
|
24
|
+
|
|
25
|
+
commit 4013a106590bdbfeb3886c31dce461c093e8f370
|
|
26
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
27
|
+
Date: Wed Jan 27 02:04:12 2010 +0000
|
|
28
|
+
|
|
29
|
+
Changelog updated
|
|
30
|
+
|
|
31
|
+
commit 790304455522363342e1440a880928106effb61b
|
|
32
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
33
|
+
Date: Wed Jan 27 01:14:58 2010 +0000
|
|
34
|
+
|
|
35
|
+
Fixed stupid timestamp error left by mistake from 0.2.
|
|
36
|
+
|
|
37
|
+
commit b0df962a7d2d464a18465652d65684a12aa010d1
|
|
38
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
39
|
+
Date: Wed Jan 27 00:39:37 2010 +0000
|
|
40
|
+
|
|
41
|
+
Removed forgotten debug line.
|
|
42
|
+
|
|
43
|
+
commit c1c8d8feb09eeb312fa9c6ae9bd677b4780caf61
|
|
44
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
45
|
+
Date: Wed Jan 27 00:38:43 2010 +0000
|
|
46
|
+
|
|
47
|
+
Removed metadata accessor. Created method that updates the current time and returns metadata. This fixed a bug in the parser that was setting the time to when the music first played, making lastfm return error on track submission.
|
|
48
|
+
|
|
49
|
+
commit 9ea96cb109e6366da923b8b51aeed1d41354febe
|
|
50
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
51
|
+
Date: Thu Jan 14 00:09:04 2010 +0000
|
|
52
|
+
|
|
53
|
+
changed attribute accessor to reader.
|
|
54
|
+
|
|
55
|
+
commit 21d3178abc3fb4547214aaba1483cde7e8e823d8
|
|
56
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
57
|
+
Date: Wed Jan 13 00:30:34 2010 +0000
|
|
58
|
+
|
|
59
|
+
Changed example to reflect recent changes.
|
|
60
|
+
|
|
61
|
+
commit d2c82bfd6e50a92ff23d53cbc744ca56ee59cfce
|
|
62
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
63
|
+
Date: Tue Jan 12 01:58:36 2010 +0000
|
|
64
|
+
|
|
65
|
+
Changed audiometa to module tinyscrobbler and renamed to parser. Fixed parser bug.
|
|
66
|
+
|
|
67
|
+
commit 889d4b19832d598113c7b9cc966560a4c8fb191e
|
|
68
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
69
|
+
Date: Mon Jan 11 17:35:42 2010 +0000
|
|
70
|
+
|
|
71
|
+
Added require rubygems for compatibility issues
|
|
72
|
+
|
|
73
|
+
commit b04ffda1557bd91dee558313799c43d1865d3d87
|
|
74
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
75
|
+
Date: Mon Jan 11 00:29:57 2010 +0000
|
|
76
|
+
|
|
77
|
+
Added gem packaging format.
|
|
78
|
+
|
|
79
|
+
commit d25a9d4e9418c7fb547fee3202e1574a94623c35
|
|
80
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
81
|
+
Date: Sun Jan 10 23:10:48 2010 +0000
|
|
82
|
+
|
|
83
|
+
Added a code example to README using audiometa.rb
|
|
84
|
+
|
|
85
|
+
commit e7160219e5ac7a905fbd1c14e0c61c6ec9816fe1
|
|
86
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
87
|
+
Date: Sun Jan 10 22:33:48 2010 +0000
|
|
88
|
+
|
|
89
|
+
Optimized the initialize method.
|
|
90
|
+
|
|
91
|
+
commit 5505eb7f59bd064d7f73add7df80416ea9b5e8c1
|
|
92
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
93
|
+
Date: Sun Jan 10 22:32:34 2010 +0000
|
|
94
|
+
|
|
95
|
+
Added rubygems require for better compatibility with other systems
|
|
96
|
+
|
|
97
|
+
commit 5e44f5e101776f29a9da63fc3e420ccbfc313593
|
|
98
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
99
|
+
Date: Sun Jan 10 22:30:10 2010 +0000
|
|
100
|
+
|
|
101
|
+
This class now uses mp3info gem to read id3 tags. Mp3 only support for now.
|
|
102
|
+
|
|
103
|
+
commit a9e24c670871c013e10a53883ad60bc79203bb3d
|
|
104
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
105
|
+
Date: Mon Jan 4 23:59:55 2010 +0000
|
|
106
|
+
|
|
107
|
+
Changed track hash to be equal in now_playing and played. THe only difference now is that played expects 3 more params. Added some more comments.
|
|
108
|
+
|
|
109
|
+
commit acc4f5efca41922c17ee680c597a962c30861bdc
|
|
110
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
111
|
+
Date: Sun Jan 3 01:27:03 2010 +0000
|
|
112
|
+
|
|
113
|
+
Removed old README. Added comments to Audiometa.
|
|
114
|
+
|
|
115
|
+
commit 6cac244c0f31acf5f9e586d52208e018ec73673a
|
|
116
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
117
|
+
Date: Sun Jan 3 01:23:37 2010 +0000
|
|
118
|
+
|
|
119
|
+
Changed README to Markdown. Added comments in Audiometa.
|
|
120
|
+
|
|
121
|
+
commit 60f5148e404115dcc4085bb4ff291e8a73c52e37
|
|
122
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
123
|
+
Date: Sat Jan 2 01:43:46 2010 +0000
|
|
124
|
+
|
|
125
|
+
Added a module for reading audio files metadata so the correct track info can be submited to tinyscrobbler.
|
|
126
|
+
|
|
127
|
+
commit 49ef4123b58ba9c0f8367c7b71644589f25cf463
|
|
128
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
129
|
+
Date: Thu Dec 31 00:45:22 2009 +0000
|
|
130
|
+
|
|
131
|
+
wrapped code in module
|
|
132
|
+
|
|
133
|
+
commit 3d393e7868e298a11f7b5b1d99aad8e82fc7252a
|
|
134
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
135
|
+
Date: Wed Dec 30 15:18:50 2009 +0000
|
|
136
|
+
|
|
137
|
+
track submission is working. Passes basic test. Test code added for multiple track submission
|
|
138
|
+
|
|
139
|
+
commit 300769166c2261591342be47fa5973371e6185d8
|
|
140
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
141
|
+
Date: Wed Dec 30 14:17:38 2009 +0000
|
|
142
|
+
|
|
143
|
+
now playing submission is working and passed the basic test.
|
|
144
|
+
|
|
145
|
+
commit 942f8613c72af967c95f3fb24099b680303f7457
|
|
146
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
147
|
+
Date: Wed Dec 30 01:42:19 2009 +0000
|
|
148
|
+
|
|
149
|
+
class code restructured. added lots of comments. More test code also added.
|
|
150
|
+
|
|
151
|
+
commit 9a6d3d07850f1eaae9c8b6b63715ab4fc8a9ca00
|
|
152
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
153
|
+
Date: Tue Dec 29 19:29:24 2009 +0000
|
|
154
|
+
|
|
155
|
+
added tests folder with dummy test.
|
|
156
|
+
|
|
157
|
+
commit 7b304b50975d96bd7113455df40abde980649c5c
|
|
158
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
159
|
+
Date: Tue Dec 29 17:49:59 2009 +0000
|
|
160
|
+
|
|
161
|
+
Added info to README
|
|
162
|
+
|
|
163
|
+
commit 943e868d3aeaa86c7a68eea2854b3a9b574c9a59
|
|
164
|
+
Author: Rogerio Vicente <rogerpvl@gmail.com>
|
|
165
|
+
Date: Tue Dec 29 17:43:41 2009 +0000
|
|
166
|
+
|
|
167
|
+
first commit. Partially working class.
|
data/README.md
CHANGED
|
@@ -58,10 +58,9 @@ Please notice that currently on mp3 files are supported (other formats are under
|
|
|
58
58
|
|
|
59
59
|
# Currently listening to...
|
|
60
60
|
file_path = '/Users/rogeriopvl/Music/Moonspell/Wolfheart/08_Alma_Mater.mp3'
|
|
61
|
-
|
|
62
|
-
current_track = parser.metadata
|
|
61
|
+
current_track = Tinyscrobbler::Parser.new(file_path)
|
|
63
62
|
|
|
64
|
-
ls.now_playing(current_track)
|
|
63
|
+
ls.now_playing(current_track.metadata)
|
|
65
64
|
|
|
66
65
|
# after track played
|
|
67
66
|
|
|
@@ -69,7 +68,7 @@ Please notice that currently on mp3 files are supported (other formats are under
|
|
|
69
68
|
# half of the track length has passed
|
|
70
69
|
# or lastfm may ignore the submission
|
|
71
70
|
|
|
72
|
-
ls.played(current_track)
|
|
71
|
+
ls.played(current_track.metadata)
|
|
73
72
|
|
|
74
73
|
|
|
75
74
|
More info soon...
|
data/lib/parser.rb
CHANGED
|
@@ -34,13 +34,14 @@ module Tinyscrobbler
|
|
|
34
34
|
|
|
35
35
|
def parse_metadata
|
|
36
36
|
track = Mp3Info.new(@path)
|
|
37
|
-
|
|
37
|
+
tag_type = track.hastag1?
|
|
38
|
+
tag = tag_type ? track.tag1 : track.tag2
|
|
38
39
|
|
|
39
40
|
track_meta = {}
|
|
40
|
-
track_meta['track'] =
|
|
41
|
-
track_meta['artistname'] =
|
|
42
|
-
track_meta['album'] =
|
|
43
|
-
track_meta['tracknumber'] =
|
|
41
|
+
track_meta['track'] = tag_type ? tag.title : tag.TIT2
|
|
42
|
+
track_meta['artistname'] = tag_type ? tag.artist : tag.TPE1
|
|
43
|
+
track_meta['album'] = tag_type ? tag.album : tag.TALB
|
|
44
|
+
track_meta['tracknumber'] = tag_type ? tag.tracknum.to_s : tag.TRCK.to_s
|
|
44
45
|
track_meta['secs'] = track.length.round.to_s
|
|
45
46
|
track_meta['time'] = Time.now.to_i.to_s
|
|
46
47
|
track_meta['source'] = 'P'
|
data/lib/tinyscrobbler.rb
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
require 'net/http'
|
|
11
11
|
require 'Digest/md5'
|
|
12
|
-
require 'parser.rb'
|
|
13
12
|
|
|
14
13
|
module Tinyscrobbler
|
|
15
14
|
|
|
@@ -28,8 +27,8 @@ module Tinyscrobbler
|
|
|
28
27
|
|
|
29
28
|
class Client
|
|
30
29
|
|
|
31
|
-
CLIENT_ID = '
|
|
32
|
-
CLIENT_VERSION = '
|
|
30
|
+
CLIENT_ID = 'tny'
|
|
31
|
+
CLIENT_VERSION = '0.3.2'
|
|
33
32
|
|
|
34
33
|
HANDSHAKE_BASE_URL = "http://post.audioscrobbler.com/?hs=true&p=1.2.1&c=#{CLIENT_ID}&v=#{CLIENT_VERSION}"
|
|
35
34
|
|
|
@@ -83,7 +82,7 @@ module Tinyscrobbler
|
|
|
83
82
|
params << "&l=#{URI.escape(track['secs'])}"
|
|
84
83
|
params << "&n=#{URI.escape(track['tracknumber'])}"
|
|
85
84
|
params << "&m=#{URI.escape(track['mbtrackid'])}"
|
|
86
|
-
|
|
85
|
+
|
|
87
86
|
send_submission(@now_playing_url, params)
|
|
88
87
|
end
|
|
89
88
|
|
|
@@ -133,18 +132,18 @@ module Tinyscrobbler
|
|
|
133
132
|
|
|
134
133
|
def submit_queue
|
|
135
134
|
params = "s=#{@session_id}"
|
|
136
|
-
|
|
135
|
+
counter = 0
|
|
137
136
|
@queue.each do |item|
|
|
138
|
-
params << "&a[#{
|
|
139
|
-
params << "&t[#{
|
|
140
|
-
params << "&i[#{
|
|
141
|
-
params << "&o[#{
|
|
142
|
-
params << "&r[#{
|
|
143
|
-
params << "&l[#{
|
|
144
|
-
params << "&b[#{
|
|
145
|
-
params << "&n[#{
|
|
146
|
-
params << "&m[#{
|
|
147
|
-
|
|
137
|
+
params << "&a[#{counter}]=#{URI.escape(item['artistname'])}"
|
|
138
|
+
params << "&t[#{counter}]=#{URI.escape(item['track'])}"
|
|
139
|
+
params << "&i[#{counter}]=#{URI.escape(item['time'])}"
|
|
140
|
+
params << "&o[#{counter}]=#{URI.escape(item['source'])}"
|
|
141
|
+
params << "&r[#{counter}]=#{URI.escape(item['rating'])}"
|
|
142
|
+
params << "&l[#{counter}]=#{URI.escape(item['secs'])}"
|
|
143
|
+
params << "&b[#{counter}]=#{URI.escape(item['album'])}"
|
|
144
|
+
params << "&n[#{counter}]=#{URI.escape(item['tracknumber'])}"
|
|
145
|
+
params << "&m[#{counter}]=#{URI.escape(item['mbtrackid'])}"
|
|
146
|
+
counter+=1
|
|
148
147
|
end
|
|
149
148
|
|
|
150
149
|
send_submission(@submission_url, params)
|
|
@@ -172,4 +171,4 @@ module Tinyscrobbler
|
|
|
172
171
|
end
|
|
173
172
|
|
|
174
173
|
end
|
|
175
|
-
end
|
|
174
|
+
end
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tinyscrobbler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- "Rog\xC3\xA9rio Vicente"
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2010-
|
|
12
|
+
date: 2010-02-15 00:00:00 +00:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -23,7 +23,7 @@ dependencies:
|
|
|
23
23
|
version: 0.6.13
|
|
24
24
|
version:
|
|
25
25
|
description:
|
|
26
|
-
email:
|
|
26
|
+
email: rogeriopvl@gmail.com
|
|
27
27
|
executables: []
|
|
28
28
|
|
|
29
29
|
extensions: []
|