<file_sep>#Installer file settings
#DO NOT CHANGE unless the download id's have changed 
default['radiobot']['install'] = {
	'debian' => {
		'packages' => 'openssl sqlite3 libsqlite3-0 libmysqlclient18 libwxgtk2.8-0 libcurl3 libphysfs1 tcl8.5 libloudmouth1-0 libtag1c2a libtagc0 espeak espeak-data festival libssl1.0.0 libwxgtk2.8-0 libsqlite3-0 libmpg123-0 libogg0 libvorbis0a libvorbisfile3 libsndfile1 libavformat53 libavcodec53 libmp3lame0 libflac8 libresample1 libfaac0 libprotobuf7 libmuparser2 liblua5.1-0 libaacplus2 libsoxr0',
		'downloads' => {
			'6' => {
				'i686' => 69,
				'x86_64' => 70
			},
			'7' => {
				'i686' => 94,
				'x86_64' => 93
			}
		},
		'override' => {
			'ubuntu' => {
				'packages' => 'openssl sqlite3 libwxgtk2.8-0 lame libtag1c2a libtagc0 libmp3lame0 libmp3lame-dev libogg-dev libvorbis-dev libsndfile1 libsndfile1-dev libavformat54 libavcodec54 libcurl4-openssl-dev libmpg123-0 libresample1 libncurses5 libphysfs1 libpcre3 libprotobuf8 libmysqlclient18 libfaac0 libopus0 libloudmouth1-0 libdbus-glib-1-2 libmuparser2 libsoxr0',
				'downloads' => {
					'13' => {
						'i386' => 66,
						'x86_64' => 68
					},
					'14' => {
						'i686' => 138,
						'x86_64' => 137
					},
				}
			}
		}
	},
	'rhel' => {
		'packages' => 'openssl sqlite mysql wxGTK cryptopp taglib physfs lame curl protobuf muParser lua libogg libvorbis mpg123 libresample lame-devel libsndfile ffmpeg flac opus',
		'downloads' => {
			'5' => {
				'i686' => 65,
				'x86_64' => 67
			},
			'6' => {
				'i686' => 71,
				'x86_64' => 63
			}
		}
	}
}

#Base settings
default['radiobot']['base']['nick'] = 'RadioBot'
default['radiobot']['base']['logfile'] = 'ircbot.log'
default['radiobot']['base']['do_spam'] = true
default['radiobot']['base']['do_on_join'] = true
default['radiobot']['base']['do_topic'] = true
default['radiobot']['base']['auto_reg_on_hello'] = true
default['radiobot']['base']['enable_request_sys'] = true
default['radiobot']['base']['enable_rating'] = true
default['radiobot']['base']['allow_pm_requests'] = true
default['radiobot']['base']['remote_port'] = 10001
default['radiobot']['base']['dj_name'] = 'Standard'
default['radiobot']['base']['ssl_cert'] = 'ircbot.pem'
default['radiobot']['base']['reg_name'] = ''
default['radiobot']['base']['reg_key'] = ''

#IRC settings
default['radiobot']['irc']['servers'] = {
	'irc.host.com' => {
		'port' => 6667,
		'ssl' => false,
		'pass' => false,
		'identity_pass' => false,
		'bindip' => false,
		'channels' => {
			'#channel' => {
				'channel_pass' => false,
				'do_spam' => true,
				'do_on_join' => true,
				'do_topic' => true,
				'song_interval' => 0,
				'song_interval_source' => 0,
				'no_topic_check' => false
			}
		}
	}
}

#SS settings
default['radiobot']['server_streams']['servers'] = {
	'your_sc_server.com' => {
		'type' => 'shoutcast',
		'port' => 8000,
		'stream_id' => 1,
		'mount' => '/live',
		'user' => 'admin',
		'pass' => '<PASSWORD>'
	}
}

#AutoDJ settings

default['radiobot']['autodj']['server']['password'] = '<PASSWORD>'
default['radiobot']['autodj']['server']['name'] = 'DJ Test'
default['radiobot']['autodj']['server']['description'] = 'Test Stream'
default['radiobot']['autodj']['server']['genre'] = 'Various'
default['radiobot']['autodj']['server']['url'] = 'http://www.yoururl.com'
default['radiobot']['autodj']['server']['icq'] = 11001100
default['radiobot']['autodj']['server']['aim'] = 'aim_name'
default['radiobot']['autodj']['server']['irc'] = 'irc://irc.yourirc.net/channel'
default['radiobot']['autodj']['server']['public'] = true
default['radiobot']['autodj']['server']['encoder'] = 'mp3'
default['radiobot']['autodj']['server']['bitrate'] = 64
default['radiobot']['autodj']['server']['sample'] = 44100
default['radiobot']['autodj']['server']['channels'] = 1
default['radiobot']['autodj']['server']['mount'] = '/'
default['radiobot']['autodj']['server']['music_dir'] = 'f:\my_music'
default['radiobot']['autodj']['server']['promos_dir'] = 'f:\my_promos'

default['radiobot']['autodj']['mp3_encoder']['mode'] = 'stereo'
default['radiobot']['autodj']['mp3_encoder']['vbr'] = 0
default['radiobot']['autodj']['mp3_encoder']['min_bitrate'] = 0
default['radiobot']['autodj']['mp3_encoder']['max_bitrate'] = 0
default['radiobot']['autodj']['mp3_encoder']['quality'] = 4		
default['radiobot']['autodj']['mp3_encoder']['vbr_quality'] = 4		

default['radiobot']['autodj']['queue_mysql']['host'] = 'host'
default['radiobot']['autodj']['queue_mysql']['user'] = 'user'
default['radiobot']['autodj']['queue_mysql']['pass'] = '<PASSWORD>'
default['radiobot']['autodj']['queue_mysql']['port'] = 0
default['radiobot']['autodj']['queue_mysql']['db_name'] = 'ShoutIRC'
default['radiobot']['autodj']['queue_mysql']['db_table'] = 'AutoDJ'
default['radiobot']['autodj']['queue_mysql']['keep_history'] = 7

default['radiobot']['autodj']['options']['use_mysql_queue'] = false
default['radiobot']['autodj']['options']['resampler'] = 'speex'
default['radiobot']['autodj']['options']['no_play_filters'] = '*SomeJunk*,*more junk*'
default['radiobot']['autodj']['options']['no_repeat'] = 600
default['radiobot']['autodj']['options']['do_promos'] = '0'
default['radiobot']['autodj']['options']['num_promos'] = 1
default['radiobot']['autodj']['options']['enable_requests'] = true
default['radiobot']['autodj']['options']['enable_find'] = true
default['radiobot']['autodj']['options']['enable_crossface'] = false
default['radiobot']['autodj']['options']['enable_voice'] = false
default['radiobot']['autodj']['options']['voice_artist'] = 'www.ShoutIRC.com'
default['radiobot']['autodj']['options']['voice_title'] = 'The Voice of AutoDJ'
default['radiobot']['autodj']['options']['moved_dir'] = './moved'
default['radiobot']['autodj']['options']['auto_start'] = true
default['radiobot']['autodj']['options']['autoplay_if_no_source'] = false
default['radiobot']['autodj']['options']['enable_yp'] = true<file_sep>ShoutIRC RadioBot Cookbook
=================
[![Build Status](https://travis-ci.org/HiveMedia/radiobot.svg?branch=master)](https://travis-ci.org/HiveMedia/radiobot) [![Code Climate](https://codeclimate.com/github/HiveMedia/radiobot/badges/gpa.svg)](https://codeclimate.com/github/HiveMedia/radiobot) [![Test Coverage](https://codeclimate.com/github/HiveMedia/radiobot/badges/coverage.svg)](https://codeclimate.com/github/HiveMedia/radiobot)

The ShoutIRC RadioBot cookbook is designed to allow users a simple and easy to understand way of installing the ShoutIRC radiobot on their servers whiel still having full control over the settings of the radiobot

Currently this cookbook only supports the AutoDJ plugin of RadioBot

Attributes
----------
#### radiobot::default

All attributes are inline with the configuration settings of RadioBot which can be found here
http://wiki.shoutirc.com/index.php/Configuration:Base

All settings are set out as "radiobot->***section_name***->***setting_name***"

e.g.
```json
{
  "default_attributes": {
	"radiobot": {
	  "base": {
		"reg_name": "YourUserNameHere-TP-********************************",
		"reg_key": "****-**********",
        "nick": "MyRadioBotNick"
	  },
	},
  },
}
```

Usage
-----
#### radiobot::default

Just include `radiobot` in your node's `run_list`:

```json
{
  "name":"my_node",
  "run_list": [
    "recipe[radiobot]"
  ]
}
```

Contributing
------------

Want to join in on the fun and help? You can do so by doing the following,

1. Fork the repository on Github
2. Create a named feature branch (like `add_component_x`)
3. Write your change
4. Write tests for your change (if applicable)
5. Run the tests, ensuring they all pass
6. Submit a Pull Request using Github

License and Authors
-------------------
Authors: <NAME> <liam.<EMAIL>>

The license is Apache v2 which can be found in the LICENSE file
<file_sep>#
# Cookbook Name:: radiobot
# Recipe:: default
#
# Copyright 2014, ShoutIRC.com
#

#Check if this platform is supported
if node['radiobot']['install'][node['platform_family']].nil?
	Chef::Log.error "A radiobot install options does not exist for '#{node['platform_family']}'. This means the radiobot cookbook does not have support for the	#{node['platform_family']} family."
    raise "A radiobot install options does not exist for '#{node['platform_family']}'. This means the radiobot cookbook does not have support for the	#{node['platform_family']} family."
end

#Get the install options for this platform
install_options = node['radiobot']['install'][node['platform_family']]

#Check if overrides exist for distro specific install options
if node['radiobot']['install'][node['platform_family']]['override'] && node['radiobot']['install'][node['platform_family']]['override'][node['platform']]
	install_options = node['radiobot']['install'][node['platform_family']]['override'][node['platform']]
end

#Check if this platform version is supported
if install_options['downloads'][node['platform_version'].split('.').first].nil?
	Chef::Log.error "A radiobot install options does exist for '#{node['platform']}' but not this version of your platform, #{node['platform_version'].split('.').first}."
    raise "A radiobot install options does exist for '#{node['platform']}' but not this version of your platform, #{node['platform_version'].split('.').first}."
end

#Add the repos that RHEL needs to install right
if node['platform_family'] == "rhel"
    #add the EPEL repo
    yum_repository 'epel' do
      description 'Extra Packages for Enterprise Linux'
      mirrorlist 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch'
      gpgkey 'http://dl.fedoraproject.org/pub/epel/RP<KEY>'
      action :create
    end

    #add the RPMforge
    yum_repository 'rpmforge' do
      description 'RepoForge is the new RPMforge. Please excuse the dust as we move in and remodel'
      mirrorlist 'http://mirrorlist.repoforge.org/el6/mirrors-rpmforge'
      gpgkey 'http://apt.sw.be/RPM-GPG-KEY.dag.txt'
      action :create
    end    
end

#Install the packages required for this platform
install_options['packages'].split.each do |pkg|
	package pkg do
		action :install 
	end
end

#Add the RadioBot user
user "radiobot" do
  supports :manage_home => true
  comment "ShoutIRC RadioBot user"
  gid "users"
  home "/opt/radiobot"
  shell "/bin/bash"
end

curl_download_id = install_options['downloads'][node['platform_version'].split('.').first][node['kernel']['machine']]

#Download RadioBot for this platform
bash "install_radiobot" do
  user "root"
  cwd "/opt"
  code <<-EOH
	 mkdir -p radiobot
	 cd radiobot
	 wget -O radiobot.tar.gz "https://www.shoutirc.com/index.php?mod=Downloads&action=download&id=#{curl_download_id}"
	 tar -xsvf radiobot.tar.gz
	 rm radiobot.tar.gz
	 chown radiobot ./ -R
  EOH
end unless File.exist?('/opt/radiobot/radiobot')

#Insert RadioBots config file based on user settings
template "/opt/radiobot/ircbot.conf" do
  source "ircbot.conf.erb"
  owner "radiobot"
  mode 0644
end

#TODO: Add support for IRCBot.text

#Install the RadioBot plugins so the AutoDJ can work
bash "install_radiobot" do
  user "radiobot"
  cwd "/opt/radiobot"
  code "./updater -a"
end

#Places the service init.d script into the platform
cookbook_file "radiobot_service" do
  path "/etc/init.d/radiobot"
  action :create_if_missing
  source "radiobot.init"
  group "root"
  owner "root"
  mode 0777
end

# Enable and start the RadioBot service
service "radiobot" do
  action [:enable, :start]
end<file_sep>radiobot CHANGELOG
==================

This file is used to list changes made in each version of the radiobot cookbook.

0.1.0
-----
- [<NAME>] - Initial release of the radiobot cookbook

<file_sep>name             'radiobot'
maintainer       '<NAME>'
maintainer_email '<EMAIL>'
license          'ApacheV2'
description      'Installs/Configures radiobot'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '0.1.0'
