Skip to content

Commit

Permalink
Merge pull request #6 from maddox/network-logos
Browse files Browse the repository at this point in the history
Network Logos
  • Loading branch information
maddox committed Jul 9, 2013
2 parents 984bb47 + 1b367f4 commit 6cb8646
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ vendor/bundle
.DS_Store
log
config/favorite_channels.json
app/public/logos/*png
app/public/logos/*gif
app/public/logos/*jpg
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ The port that the server will run on.
##### `hd_start`
The start channel of your HD channels. Most providers start all of their HD channels at a certain number. Providing this number will let you browse JUST your HD channels.

### Network Logos

Wallop supports the serving of Network Logos if you configure your channels to use them. Within the `config.toml` file, you can map your channels to images. Just map the channel number to a file name and place those files into `/app/public/logos`. Wallop will send the logo urls along in its JSON response to services talking to it.

```
[channel_logos]
506 = "cbs.png"
508 = "abc.png"
511 = "fox.png"
512 = "nbc.png"
```

you can see that `cbs.png` corresponds to:

![](/app/public/logos/cbs.png)

## Logs

Logs are written out to the `log` directory.
Expand Down
1 change: 1 addition & 0 deletions app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class App < Sinatra::Base
end

before do
Wallop.request_host = request.host
content_type :json
end

Expand Down
Binary file added app/public/logos/abc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/logos/cbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/logos/fox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/logos/nbc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ ffmpeg_path = "/usr/local/bin/ffmpeg"
transcoding_path = "./tmp"
port = "8888"
hd_start = 500

[channel_logos]
506 = "cbs.png"
508 = "abc.png"
511 = "fox.png"
512 = "nbc.png"
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Wallop will return your available channels as well as keep track of your favorit
``` json
{
"GuideNumber":"570",
"GuideName":"ESPN HD"
"GuideName":"ESPN HD",
"LogoUrl":"http://192.168.1.23:888/logos/cbs.png"
}
```

Expand Down
21 changes: 20 additions & 1 deletion lib/wallop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ module Wallop
OLD_LOG_PATH = 'log/wallop.old.log'
FAVORITE_CHANNELS_PATH = 'config/favorite_channels.json'

def self.request_host
@request_host
end

def self.request_host=(host)
@request_host = host
end

def self.request_url
"http://#{request_host}:8888"
end

def self.logger
@logger ||= Logger.new(LOG_PATH)
end
Expand Down Expand Up @@ -86,7 +98,14 @@ def self.hdhomerun_lineup_url
end

def self.lineup
JSON.parse(open(hdhomerun_lineup_url).read)
lineup = JSON.parse(open(hdhomerun_lineup_url).read)
lineup.each do |l|
if config['channel_logos'][l['GuideNumber']]
l['LogoUrl'] = "#{request_url}/logos/#{config['channel_logos'][l['GuideNumber']]}"
else
l['LogoUrl'] = nil
end
end
end

def self.hd_lineup
Expand Down

0 comments on commit 6cb8646

Please sign in to comment.