Skip to content

Commit

Permalink
Merge pull request #61 from rawfunkmaharishi/soundcloud-urls
Browse files Browse the repository at this point in the history
Write SoundCloud URLs
  • Loading branch information
Sam Pikesley committed Jan 22, 2016
2 parents 65d5068 + 9272273 commit b2c119f
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: ruby
rvm:
- 2.2.0
- 2.3.0
env:
global:
- secure: Pp7JaGVsZyPJPaZHgpWEibRDtpg4aWWTC9yb7SITdXTJ7AN5gZPLIyNuYfY937Ypq2JoJAI2yhJzfMPTQJ/FwF8OV1d9dUZyDv3R6aMsE41xJoL6X2bLtyh3TduULSIeiemoOEk4Y5JqOJb8JEyFMd0n+0AD+hn+HBPysIfwgHM=
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![Code Climate](http://img.shields.io/codeclimate/github/rawfunkmaharishi/purdie.svg?style=flat-square)](https://codeclimate.com/github/rawfunkmaharishi/purdie)
[![Gem Version](http://img.shields.io/gem/v/purdie.svg?style=flat-square)](https://rubygems.org/gems/purdie)
[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://rawfunkmaharishi.mit-license.org)
[![Badges](http://img.shields.io/:badges-7/7-ff6799.svg?style=flat-square)](https://github.com/badges/badgerbadgerbadger)

#Purdie

Expand Down Expand Up @@ -67,9 +66,7 @@ You also need a *.env* file with the relevant credentials in it:

VIMEO_BEARER_TOKEN: this_is_bearer_token

YOUTUBE_API_KEY: this_is_key_for_youtube

(get those things from [Flickr](https://www.flickr.com/services/apps/create/apply), [SoundCloud](http://soundcloud.com/you/apps/new), [Vimeo](https://developer.vimeo.com/apps/new) and [YouTube](https://console.developers.google.com/project))
(get those things from [Flickr](https://www.flickr.com/services/apps/create/apply), [SoundCloud](http://soundcloud.com/you/apps/new) and [Vimeo](https://developer.vimeo.com/apps/new)

And then you can run

Expand Down Expand Up @@ -108,7 +105,7 @@ Tread carefully for now, because my metadata hacks aren't fully documented, and

##What next?

There's no reason I couldn't support other services - I've already added [YouTube](https://github.com/rawfunkmaharishi/purdie/blob/master/spec/services/youtube_spec.rb) [support](https://github.com/rawfunkmaharishi/purdie/blob/master/lib/purdie/services/youtube.rb) and others should be fairly simple. There's some introspection magic at the heart of all of this which means that as long as each service is represented by a class that:
There's no reason I couldn't support other services. There's some introspection magic at the heart of all of this which means that as long as each service is represented by a class that:

* includes the `Purdie::Service` module, and
* sports a `::matcher` class method which returns a string which will pick a URL out of an input file, and
Expand Down
4 changes: 4 additions & 0 deletions features/soundcloud-set.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,28 @@ Feature: Soundcloud set
---
- title: Hexaflexagon
id: 193008299
url: http://soundcloud.com/rawfunkmaharishi/hexaflexagon-1
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/4.0/
- title: Beer, Of Course, But Why
id: 193006525
url: http://soundcloud.com/rawfunkmaharishi/beer-of-course-but-why
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/4.0/
- title: Junalbandi
id: 193005357
url: http://soundcloud.com/rawfunkmaharishi/junalbandi-3
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/4.0/
- title: Bernard
id: 192841052
url: http://soundcloud.com/rawfunkmaharishi/bernard
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
Expand Down
3 changes: 3 additions & 0 deletions features/soundcloud.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Feature: Soundcloud
"""
- title: Hexaflexagon
id: 193008299
url: http://soundcloud.com/rawfunkmaharishi/hexaflexagon-1
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
Expand All @@ -30,12 +31,14 @@ Feature: Soundcloud
"""
- title: Hexaflexagon
id: 193008299
url: http://soundcloud.com/rawfunkmaharishi/hexaflexagon-1
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/4.0/
- title: Junalbandi
id: 193005357
url: http://soundcloud.com/rawfunkmaharishi/junalbandi-3
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
Expand Down
52 changes: 0 additions & 52 deletions features/youtube-playlist.feature

This file was deleted.

20 changes: 0 additions & 20 deletions features/youtube.feature

This file was deleted.

1 change: 0 additions & 1 deletion lib/purdie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@
require 'purdie/services/soundcloud'
require 'purdie/services/flickr'
require 'purdie/services/vimeo'
require 'purdie/services/youtube'
3 changes: 2 additions & 1 deletion lib/purdie/services/soundcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def distill url
results = {}
results['title'] = track['title']
results['id'] = track['id']

results['url'] = track['permalink_url']

description = YAML.load track['description']
if description.class == Hash
description.keys.each do |k|
Expand Down
104 changes: 0 additions & 104 deletions lib/purdie/services/youtube.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/purdie/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Purdie
VERSION = "0.1.1al"
VERSION = "0.1.2"
end
26 changes: 0 additions & 26 deletions spec/purdie/duff_keys_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,5 @@ module Services
}
end
end

describe YouTube do
after :each do
reset_env
end

it 'responds usefully in the face of no credentials' do
unset_env
y = YouTube.new
expect { y.distill 'https://www.youtube.com/watch?v=JCix1XW329g' }.to raise_exception { |e|
expect(e).to be_a Purdie::CredentialsException
expect(e.service.class).to eq Purdie::Services::YouTube
expect(e.message).to eq 'missing'
}
end

it 'responds usefully in the face of duff credentials' do
randomise_env
y = YouTube.new
expect { y.distill 'https://www.youtube.com/watch?v=JCix1XW329g' }.to raise_exception { |e|
expect(e).to be_a Purdie::CredentialsException
expect(e.service.class).to eq Purdie::Services::YouTube
expect(e.message).to eq 'duff'
}
end
end
end
end
6 changes: 0 additions & 6 deletions spec/purdie/resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,5 @@ module Purdie
expect(Purdie.strip_scheme resolved[0]).to eq '//soundcloud.com/rawfunkmaharishi/beer-of-course-but-why'
expect(Purdie.strip_scheme resolved[2]).to eq '//soundcloud.com/rawfunkmaharishi/junalbandi-3'
end

it 'resolves a YouTube playlist', :vcr do
resolved = Resolver.resolve 'https://www.youtube.com/playlist?list=PLuPLM2FI60-OIgFTc9YCrGgH5XWGT6znV'
expect(resolved.count).to eq 9
expect(Purdie.strip_scheme resolved.first).to eq '//youtube.com/watch?v=U23Ezi6q30E'
end
end
end
2 changes: 2 additions & 0 deletions spec/purdie/services/soundcloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module Services
"---
title: Hexaflexagon
id: 193008299
url: http://soundcloud.com/rawfunkmaharishi/hexaflexagon-1
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
Expand All @@ -31,6 +32,7 @@ module Services
"---
title: Don The Crown
id: 234830006
url: http://soundcloud.com/rawfunkmaharishi/don-the-crown-1
location: Rogue Studios
engineer: Alessio
date: '2015-11-25'
Expand Down
40 changes: 0 additions & 40 deletions spec/purdie/services/youtube_spec.rb

This file was deleted.

0 comments on commit b2c119f

Please sign in to comment.