Skip to content
Browse files

Added config for host and port

  • Loading branch information...
1 parent b099bfd commit bad1fc4052961e9474f29e1f09a6164b4ae8b343 @ndbroadbent committed Nov 22, 2010
Showing with 12 additions and 4 deletions.
  1. +2 −0 .gitignore
  2. +4 −0 config.yml.sample
  3. +6 −4 shell-fm_lcd_console.rb
View
2 .gitignore
@@ -0,0 +1,2 @@
+config.yml
+
View
4 config.yml.sample
@@ -0,0 +1,4 @@
+---
+host: localhost # (shellfm host)
+port: 54311 # (Port to control shell-fm on.)
+
View
10 shell-fm_lcd_console.rb
@@ -7,12 +7,14 @@
require 'rubygems'
require 'socket'
+require 'yaml'
require File.join(File.dirname(__FILE__), 'lib', 'rubyX2040')
require File.join(File.dirname(__FILE__), 'lib', 'widget')
-# shell.fm network interface config
-IP = "localhost"
-PORT = "54311"
+# Load config.
+config = YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
+Host = config["host"]
+Port = config["port"]
Update_delay = 3.0 # Delay between shell.fm refreshes.
Scroll_delay = 0.5 # speed of artist and title scrolling
@@ -24,7 +26,7 @@
def shellfm_info
# Gets the 'artist', 'title', and 'remaining seconds'
cmd = "info %a||%l||%t||%R"
- t = TCPSocket.new(IP, PORT)
+ t = TCPSocket.new(Host, Port)
t.print cmd + "\n"
info = t.gets(nil).split("||")
t.close

0 comments on commit bad1fc4

Please sign in to comment.
Something went wrong with that request. Please try again.