lastgroov 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README +20 -0
- data/lastgroov +12 -0
- data/lib/lastgroov.rb +45 -0
- metadata +58 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
last.yml
|
data/README
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Scrobble recently played tracks from Grooveshark to last.fm
|
2
|
+
|
3
|
+
|
4
|
+
Setup
|
5
|
+
-----
|
6
|
+
Create last.yaml containing your last.fm login credentials
|
7
|
+
|
8
|
+
Sample 'last.yaml' --->
|
9
|
+
username : lastfm_username
|
10
|
+
password : lastfm_password
|
11
|
+
|
12
|
+
|
13
|
+
Executing
|
14
|
+
-------
|
15
|
+
./lastgroov
|
16
|
+
|
17
|
+
|
18
|
+
Author
|
19
|
+
------
|
20
|
+
Himanshu Chhetri : http://nepcoder.com
|
data/lastgroov
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'lib/lastgroov'
|
4
|
+
require 'rubygems'
|
5
|
+
|
6
|
+
print "Enter grooveshark username: "
|
7
|
+
username = gets.strip
|
8
|
+
|
9
|
+
print "Number of recently played tracks to scrobble(upto 100): "
|
10
|
+
scrobbles = gets.to_i
|
11
|
+
|
12
|
+
Lastgroov.new(username, scrobbles).scrobble!
|
data/lib/lastgroov.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Scrobble recently played tracks from Grooveshark
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'scrobbler'
|
5
|
+
require 'feedzirra'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
class Lastgroov
|
9
|
+
|
10
|
+
def initialize(groov_user, scrobbles = 100 )
|
11
|
+
@scrobbles = scrobbles - 1
|
12
|
+
$stderr.puts "Invalid number of scrobbles!" if @scrobbles < 0
|
13
|
+
groov_url = "http://api.grooveshark.com/feeds/1.0/users/"
|
14
|
+
groov_url << groov_user
|
15
|
+
groov_url << "/recent_listens.rss"
|
16
|
+
|
17
|
+
@feed = Feedzirra::Feed.fetch_and_parse(groov_url)
|
18
|
+
|
19
|
+
config = YAML::load(File.read("last.yml"))
|
20
|
+
@auth = Scrobbler::SimpleAuth.new(:user => config['username'],
|
21
|
+
:password => config['password'])
|
22
|
+
end
|
23
|
+
|
24
|
+
def scrobble!
|
25
|
+
@auth.handshake!
|
26
|
+
0.upto(@scrobbles) do |n|
|
27
|
+
track, artist = @feed.entries[n].title.split(" - ")
|
28
|
+
time = @feed.entries[n].published
|
29
|
+
scrobble = Scrobbler::Scrobble.new(
|
30
|
+
:session_id => @auth.session_id,
|
31
|
+
:submission_url => @auth.submission_url,
|
32
|
+
:artist => artist,
|
33
|
+
:track => track,
|
34
|
+
:album => "Unknown",
|
35
|
+
:time => time,
|
36
|
+
:length=> 300,
|
37
|
+
:track_number => n + 1
|
38
|
+
)
|
39
|
+
scrobble.submit!
|
40
|
+
puts "#{@feed.entries[n].title}"
|
41
|
+
puts "Scrobbler Submission Status: #{scrobble.status}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lastgroov
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Himanshu Chhetri
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-06 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Now you can scrobble Grooveshark music!
|
17
|
+
email: himanshuchhetri@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- README
|
27
|
+
- lastgroov
|
28
|
+
- lib/lastgroov.rb
|
29
|
+
has_rdoc: true
|
30
|
+
homepage: http://github.com/himanshuc/lastgroov
|
31
|
+
licenses: []
|
32
|
+
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options:
|
35
|
+
- --charset=UTF-8
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: "0"
|
43
|
+
version:
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
requirements: []
|
51
|
+
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.3.5
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: Scrobble recently played tracks from Grooveshark to last.fm
|
57
|
+
test_files: []
|
58
|
+
|