久しぶりにubuntu12.04をパソコンに導入した。ついでにAirVideo Serverを導入しようと思い以前試した簡単導入方を試してみた。2013/12/30現在簡単にインストールできた。
注意 メニューのAirvideoServerを使うとうまくいかない。またubuntu13.10ではインストール出来なかったので注意
手順は
2.Add the AirVideo PPA repository
sudo add-apt-repository ppa:rubiojr/airvideo
3.Update package index
sudo apt-get update
4.Install AirVideo Server
sudo apt-get install airvideo-server
5.Tweak the 'folders' property editing /opt/airvideo-server/AirVideoServerLinux.propertiesを環境に合わせ修正する。
重要
/opt/airvideo-serverにtrayを言うファイルを作成しパーミッションを0755とする。ファイルの内容は以下の通り、ショートカットを作成し(/opt/airvideo-serve/tray)実行するとトレイアイコンが表示されるのでマウスの右クリックでStart serverをクリックするとAirVideo Serverが動く。
#!/usr/bin/env ruby
require 'Qt4'
class Tray < Qt::SystemTrayIcon
slots :startStopAction, :quit
def initialize(parent = nil)
super(parent)
@serverThread = nil
@serverRunning = false
@startStopAction = Qt::Action.new(tr("&Start Server"), self)
connect(@startStopAction, SIGNAL(:triggered), self, SLOT(:startStopAction))
@quitAction = Qt::Action.new(tr("&Quit"), self)
connect(@quitAction, SIGNAL(:triggered), self, SLOT(:quit))
@trayIconMenu = Qt::Menu.new(nil) do |t|
t.addAction(@startStopAction)
t.addSeparator()
t.addAction(@quitAction)
end
self.contextMenu = @trayIconMenu
self.icon = Qt::Icon.new("#{File.dirname(__FILE__)}/airvideo-tray-off.png")
self.toolTip = 'AirVideo Server'
end
def quit
if @serverThread
Process.kill(9, @serverThread)
end
$qApp.quit
end
def startStopAction
if @serverRunning
@startStopAction.text = 'Start Server'
@serverRunning = false
if @serverThread
Process.kill(9, @serverThread)
end
self.icon = Qt::Icon.new("#{File.dirname(__FILE__)}/airvideo-tray-off.png")
else
@startStopAction.text = 'Stop Server'
@serverRunning = true
cmd = 'java -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.properties'
@serverThread = fork { exec cmd }
self.icon = Qt::Icon.new("#{File.dirname(__FILE__)}/airvideo-tray.png")
end
end
def createTrayIcon()
end
end
app = Qt::Application.new(ARGV)
if !Qt::SystemTrayIcon.isSystemTrayAvailable
Qt::MessageBox.critical(nil, Qt::Object.tr("Systray"),
Qt::Object.tr("I couldn't detect any system tray " \
"on this system."))
exit 1
end
tray = Tray.new
tray.show
app.exec