somadic 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +24 -13
- data/lib/somadic/audio_addict.rb +2 -2
- data/lib/somadic/channel/di.rb +11 -13
- data/lib/somadic/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca4d0b5f1262c05f4c93871065843f3a08b16da5
|
4
|
+
data.tar.gz: dd8035445c3828512c2acfe0a80faf62e68020d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 824df614dc6f57756a05a79e1fc3e149e9e7ed78c14c2d852f81d1b517ebaac14e590b51f115a4b7d1715369df7b4316fa29b7bda4e7329e04d077196af75202
|
7
|
+
data.tar.gz: 3e1fb4eafd3569ed18942bc4c483041593209aa405df7c0da4cb6cae2f60452069515bf75b00a98f7f1bd59d43e44437ec105923b98dab15e3619ff830faf3c7
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Somadic
|
2
2
|
|
3
|
-
Somadic is a bare-bones terminal-based player for somafm.com and di.fm.
|
4
|
-
do the heavy lifting.
|
3
|
+
Somadic is a bare-bones terminal-based player for [somafm.com](http://somafm.com) and [di.fm](http://di.fm).
|
4
|
+
It uses `mplayer` to do the heavy lifting.
|
5
5
|
|
6
6
|
```
|
7
7
|
$ somadic-curses di:breaks
|
@@ -17,17 +17,9 @@ $ somadic-curses di:breaks
|
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Build the gem:
|
25
|
-
|
26
|
-
$ gem build somadic.gemspec
|
27
|
-
|
28
|
-
Install the gem:
|
29
|
-
|
30
|
-
$ gem install somadic-0.0.1.gem
|
20
|
+
```
|
21
|
+
$ gem install somadic
|
22
|
+
```
|
31
23
|
|
32
24
|
## Usage
|
33
25
|
|
@@ -58,6 +50,25 @@ s - Search Google for the current track
|
|
58
50
|
/ - Goto site:channel
|
59
51
|
```
|
60
52
|
|
53
|
+
#### Presets
|
54
|
+
|
55
|
+
You can create preset files rather than listing multiple channels on the command line. Create
|
56
|
+
a YAML file in `~/.somadic/presets`, say `chill.yaml`, with the following content:
|
57
|
+
|
58
|
+
```
|
59
|
+
---
|
60
|
+
- di:breaks
|
61
|
+
- soma:secretagent
|
62
|
+
- di:psychill
|
63
|
+
- soma:lush
|
64
|
+
```
|
65
|
+
|
66
|
+
You can then start somadic with the preset's name:
|
67
|
+
|
68
|
+
```
|
69
|
+
$ somadic chill
|
70
|
+
```
|
71
|
+
|
61
72
|
#### Examples
|
62
73
|
|
63
74
|
**Listen to breaks on DI**
|
data/lib/somadic/audio_addict.rb
CHANGED
data/lib/somadic/channel/di.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pp'
|
2
|
+
|
1
3
|
module Somadic
|
2
4
|
module Channel
|
3
5
|
class DI < Somadic::BaseChannel
|
@@ -14,9 +16,7 @@ module Somadic
|
|
14
16
|
# Overrides BaseChannel
|
15
17
|
def find_channel(name)
|
16
18
|
Somadic::Logger.debug("DI#find_channel(#{name})")
|
17
|
-
@channels.each
|
18
|
-
return c if c[:name] == name
|
19
|
-
end
|
19
|
+
@channels.each { |c| return c if c[:name] == name }
|
20
20
|
nil
|
21
21
|
end
|
22
22
|
|
@@ -24,6 +24,8 @@ module Somadic
|
|
24
24
|
#
|
25
25
|
# TODO: time isn't used, song isn't required
|
26
26
|
def update(time, song)
|
27
|
+
return unless @channel
|
28
|
+
|
27
29
|
@song = song if song
|
28
30
|
aa = Somadic::AudioAddict.new(@channel[:id])
|
29
31
|
songs = aa.refresh_playlist
|
@@ -66,16 +68,12 @@ module Somadic
|
|
66
68
|
APICache.get('di_fm_channel_list', cache: ONE_DAY, timeout: API_TIMEOUT) do
|
67
69
|
Somadic::Logger.debug('DI#load_channels')
|
68
70
|
channels = []
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
channels << {id: z[0], name: z[1]}
|
76
|
-
end
|
77
|
-
channels.sort_by! {|k, _| k[:name]}
|
78
|
-
channels.uniq! {|k, _| k[:name]}
|
71
|
+
page = open('http://www.di.fm').read
|
72
|
+
app_start = page.scan(/di\.app\.start\((.*?)\);/).flatten[0]
|
73
|
+
json = JSON.parse(app_start)
|
74
|
+
json['channels'].each { |c| channels << {id: c['id'], name: c['key']} }
|
75
|
+
|
76
|
+
channels
|
79
77
|
end
|
80
78
|
end
|
81
79
|
end
|
data/lib/somadic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: somadic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Thomas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mono_logger
|
@@ -218,3 +218,4 @@ test_files:
|
|
218
218
|
- spec/lib/somadic/mplayer_spec.rb
|
219
219
|
- spec/lib/somadic_spec.rb
|
220
220
|
- spec/spec_helper.rb
|
221
|
+
has_rdoc:
|