Skip to content

Instantly share code, notes, and snippets.

@snorkellingcactus
Created April 24, 2019 19:14
Show Gist options
  • Save snorkellingcactus/efd73deecd17e7ae3f09f7aecda1ef25 to your computer and use it in GitHub Desktop.
Save snorkellingcactus/efd73deecd17e7ae3f09f7aecda1ef25 to your computer and use it in GitHub Desktop.
diff --git a/bin/install.sh b/bin/install.sh
index ffd66bb..a03c111 100755
--- a/bin/install.sh
+++ b/bin/install.sh
@@ -27,7 +27,18 @@ cd ~/tmp/if-media-player
blue "# update system dependencies"
-VERSION_CODENAME="$(lsb_release -a | grep Codename | cut -f2)"
+sudo apt-get install -y lsb-release
+
+lsb_release_field(){
+ FIELD="${1}"
+
+ echo $(lsb_release -a | grep ${FIELD} | cut -d: -f2)
+}
+
+
+VERSION_CODENAME="$(lsb_release_field Codename)"
+VERSION_ID="$(lsb_release_field Release)"
+
OLD_RELEASE="vivid"
ARCHIVE='us.archive'
SECURITY='security'
@@ -47,8 +58,23 @@ deb http://${ARCHIVE}.ubuntu.com/ubuntu/ $VERSION_CODENAME-backports main restr
deb http://${SECURITY}.ubuntu.com/ubuntu/ $VERSION_CODENAME-security main restricted universe multiverse\n
"
echo -e $SOURCES_LIST | sudo tee /etc/apt/sources.list > /dev/null
+
+if $(lsmod | grep -q i915)
+then
+ INTEL='
+ # Generated by Omnially showctrl installer\n
+ Section "Device"\n
+ Identifier "Intel Graphics"\n
+ Driver "intel"\n
+ Option "TearFree" "true"\n
+ EndSection\n
+ '
+
+ echo -e $INTEL | sudo tee /usr/share/X11/xorg.conf.d/20-intel.conf > /dev/null
+fi
+
sudo apt-get update
-sudo apt-get purge -y apport update-manager
+sudo apt-get purge -y apport update-manager deja-dup
sudo apt-get dist-upgrade -y
@@ -57,7 +83,7 @@ sudo apt-get dist-upgrade -y
blue "# system dependencies"
vlc --version && scrot -v && git --version || {
sudo apt-get update
- sudo apt-get install -y unclutter git vlc scrot lsb vim x11-xserver-utils xterm
+ sudo apt-get install -y unclutter git vlc scrot lsb vim x11-xserver-utils xterm linux-image-virtual-hwe-${VERSION_ID} linux-headers-virtual-hwe-${VERSION_ID} xserver-xorg-hwe-${VERSION_ID}
}
if git --version && vlc --version && scrot -v ; then
green "# system dependencies : Ok!"
@@ -147,7 +173,7 @@ chruby $RUBY_VERSION
blue "# install bundler"
bundle -v || {
blue "# install bundler : installing..."
- gem install bundler
+ gem install bundler -v 1.17.1
}
if bundle -v; then
green "# install bundler : Ok!"
@@ -191,12 +217,12 @@ blue "# move media files to home"
blue "# unpacking app"
cd $HOME
# remove previous install
-rm -rf $TARGET_DIR
+#rm -rf $TARGET_DIR
# look for the newest tar.gz
TARFILE=`ls -tc *.tar.gz | head -n1`
-mkdir $TARGET_DIR
-tar -xvf $TARFILE -C $TARGET_DIR
+#mkdir $TARGET_DIR
+#tar -xvf $TARFILE -C $TARGET_DIR
@@ -228,15 +254,15 @@ sudo ln -s $TARGET_DIR/config/udev/85-usb.rules /etc/udev/rules.d/85-usb.rules
blue "# linking media library"
-rm -rf $TARGET_DIR/media
-ln -s $HOME/media $TARGET_DIR/
+#rm -rf $TARGET_DIR/media
+#ln -s $HOME/media $TARGET_DIR/
blue "# cleaning install files"
rm -rf ~/tmp/if-media-player
-rm $HOME/*.tar.gz
-rm $HOME/*.oax
+#rm $HOME/*.tar.gz
+#rm $HOME/*.oax
diff --git a/bin/player.sh b/bin/player.sh
index 9c8a885..1cf6a41 100755
--- a/bin/player.sh
+++ b/bin/player.sh
@@ -15,6 +15,6 @@ while true; do
pl="$HOME/if-media-player/data/default_playlist/playlist.xspf"
fi
- vlc --no-quiet -I luaintf --lua-intf cli --cli-host localhost:9090 --no-media-library --loop --fullscreen --no-video-title-show --video-on-top --inhibit --disable-screensaver --mouse-hide-timeout 0 --antiflicker-window-size 100 --antiflicker-softening-size 31 --nooverlay $pl 2>&1 | tee -a logs/vlc.log
+ vlc --no-quiet -I luaintf --lua-intf cli --cli-host localhost:9090 --no-media-library --loop --fullscreen --no-video-title-show --video-on-top --inhibit --disable-screensaver --mouse-hide-timeout 0 --antiflicker-window-size 100 --antiflicker-softening-size 31 --file-caching 10000 --nooverlay $pl 2>&1 | tee -a logs/vlc.log
sleep 1
done
diff --git a/ws.rb b/ws.rb
index 998ef42..a287b78 100644
--- a/ws.rb
+++ b/ws.rb
@@ -59,7 +59,7 @@ module MediaPlayer
exit
end
- sleep ENV["STATUS_UPDATES_FREQ"] || 15
+ sleep ENV["STATUS_UPDATES_FREQ"].to_i || 15
end
end
@@ -79,11 +79,11 @@ module MediaPlayer
no_display_notification = Notification.new(ws, :no_display_failure)
# look for locked threads, and restart the process if there are too many
- EM::PeriodicTimer.new(ENV['STATUS_UPDATES_FREQ'] || 60) do
+ EM::PeriodicTimer.new(ENV['STATUS_UPDATES_FREQ'].to_i || 60) do
raise Error, 'Too Many file descriptors opened. Restarting :P' if `lsof -p #{$$} | grep tty | wc -l`.to_i > 10
end
- EM::PeriodicTimer.new(ENV['STATUS_UPDATES_FREQ'] || 60) do
+ EM::PeriodicTimer.new(ENV['STATUS_UPDATES_FREQ'].to_i || 60) do
EM.defer do
json = merge_with_timer(Unit::Snapshot::MediaPlayerBuilder.snapshot(MediaPlayer::VERSION))
json = merge_with_env(json)
@@ -97,14 +97,14 @@ module MediaPlayer
EM.defer { Timer.load.tick! }
end
- EM::PeriodicTimer.new(30) do
+ EM::PeriodicTimer.new(ENV['STATUS_UPDATES_FREQ'].to_i || 30) do
ws.pong
logger.debug "[ws.rb] pong!"
end
# Error condition checking timer
#TODO: Refactor this?
- EM::PeriodicTimer.new(60) do
+ EM::PeriodicTimer.new(ENV['STATUS_UPDATES_FREQ'].to_i || 60) do
EM.defer do
now = Time.now
last_event = Timer.load.last_triggered # Check if display status is coherent with what the timer says it should be.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment