Songsoftheday 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ gem "nokogiri", ">= 1.5.10"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.0"
12
+ gem "jeweler", "~> 1.8.7"
13
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Jonas Haskins
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ = Songsoftheday
2
+
3
+ Downloads the songs of the day podcast archive from KEXP.
4
+ You want to run downloadsongsoftheday.rb from the
5
+ gem's bin directory.
6
+
7
+ == Contributing to Songsoftheday
8
+
9
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
10
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
11
+ * Fork the project.
12
+ * Start a feature/bugfix branch.
13
+ * Commit and push until you are happy with your contribution.
14
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
15
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
16
+
17
+ == Copyright
18
+
19
+ Copyright (c) 2013 Jonas Haskins. See LICENSE.txt for
20
+ further details.
21
+
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "Songsoftheday"
18
+ gem.homepage = "http://github.com/sanojsniksah/Songsoftheday"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{TODO: one-line summary of your gem}
21
+ gem.description = %Q{TODO: longer description of your gem}
22
+ gem.email = "h20melonman@gmail.com"
23
+ gem.authors = ["Jonas Haskins"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ task :default => :test
36
+
37
+ require 'rdoc/task'
38
+ Rake::RDocTask.new do |rdoc|
39
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = "Songsoftheday #{version}"
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.5
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+ require 'open-uri'
3
+ require 'nokogiri'
4
+
5
+ puts "The dreams of the 2000's are alive in Seattle??"
6
+ puts "Ok, bad joke.. portlandia? .. this is so 2000.. "
7
+ sleep 2
8
+ puts "Hey there, you like MUSIC ?"
9
+ puts "KEXP from Seattle ? "
10
+ puts "Cool..... ok, So they have this podcast called 'song of the day'"
11
+ puts "http://kexp.org/podcasts "
12
+ puts "Where every day, they feature a new artist and a song"
13
+ print "Wanna catch up on the last year or so of songs ? (y/n) : "
14
+ answer = STDIN.gets.chomp()
15
+
16
+ if (answer == 'y')
17
+ print "Ok, is it ok I write /tmp/kexp_songs_of_the_day_archive/ ? (y/n) : "
18
+ dir_answer = STDIN.gets.chomp()
19
+ if (dir_answer == 'y')
20
+ Dir::mkdir("/tmp/kexp_songs_of_the_day_archive")
21
+ elsif
22
+ puts "Ok, well think about it... "
23
+ else
24
+ puts "Your speaking gibber .. #{dir_answer}"
25
+ end
26
+ elsif ( answer == 'n' )
27
+ puts "Ok, not gonna do it. bye !... "
28
+ exit 1
29
+ else
30
+ puts "Hmm, I don't know #{answer} .. bye "
31
+ exit 1
32
+ end
33
+
34
+
35
+ puts "Downloading... these songs are in the PUBLIC DOMAIN.. "
36
+ puts "Remember to support your local radio station / record store"
37
+
38
+ Dir.chdir("/tmp/kexp_songs_of_the_day_archive/")
39
+ page = Nokogiri::XML(open("http://feeds.kexp.org/kexp/songoftheday"))
40
+
41
+ title = page.xpath("//item/title | //item/link")
42
+ songtitles = []
43
+ links = []
44
+ title.each do |sod|
45
+ sod = sod.text
46
+ if (sod =~ /^http/)
47
+ links.push(sod)
48
+ else
49
+ title1 = sod.gsub(' ', '_')
50
+ title2 = title1.gsub('\'', '')
51
+ title3 = title2.gsub('/', '')
52
+ title4 = title3.gsub('_-_', '-')
53
+ songtitles.push(title4)
54
+ end
55
+
56
+ end
57
+
58
+ stl = songtitles.length
59
+ stl = stl - 1
60
+ range = (0..stl).to_a
61
+
62
+ range.each do |n|
63
+ song = songtitles[n]
64
+ song << ".mp3"
65
+ url = links[n]
66
+ puts "Downloading #{song} from #{url}"
67
+ open(url) do |io|
68
+ File.open(song, 'w') {|out| out.print(io.read) }
69
+ end
70
+ end
71
+
@@ -0,0 +1,19 @@
1
+ class Songsoftheday
2
+
3
+ def sod
4
+ puts "Run the executable ! downloadsongsoftheday "
5
+ end
6
+
7
+ def theyear2000called
8
+ "And they want free content"
9
+ end
10
+
11
+ def howmany
12
+ howmany = 489
13
+ end
14
+
15
+ def thanks
16
+ thanks = "kexp"
17
+ end
18
+
19
+ end
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'Songsoftheday'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,20 @@
1
+ require 'helper'
2
+
3
+ class TestSongsoftheday < Test::Unit::TestCase
4
+ def setup
5
+ @songs = Songsoftheday.new
6
+ end
7
+
8
+ def test_theyear2000called
9
+ assert_equal "And they want free content", @songs.theyear2000called
10
+ end
11
+
12
+ def test_howmany
13
+ assert_equal 489, @songs.howmany
14
+ end
15
+
16
+ def test_thanks
17
+ assert_equal "kexp", @songs.thanks
18
+ end
19
+
20
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Songsoftheday
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jonas Haskins
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.5.10
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.10
30
+ - !ruby/object:Gem::Dependency
31
+ name: shoulda
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rdoc
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '3.12'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: jeweler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.8.7
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.8.7
94
+ description: Downloads some nice mp3's to listen to for when your writing real code.
95
+ first time for me in parsing/nokogiri
96
+ email: h20melonman@gmail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files:
100
+ - LICENSE.txt
101
+ - README.rdoc
102
+ files:
103
+ - .document
104
+ - Gemfile
105
+ - LICENSE.txt
106
+ - README.rdoc
107
+ - Rakefile
108
+ - VERSION
109
+ - lib/Songsoftheday.rb
110
+ - bin/downloadsongsoftheday
111
+ - test/helper.rb
112
+ - test/test_Songsoftheday.rb
113
+ homepage: http://github.com/sanojsniksah/Songsoftheday
114
+ licenses:
115
+ - MIT
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 1.8.25
135
+ signing_key:
136
+ specification_version: 3
137
+ summary: Old School Dl of some hi quality FREE music.
138
+ test_files: []