Created
October 26, 2014 17:03
-
-
Save yanniks/a8b952e339a2cdc06a6f to your computer and use it in GitHub Desktop.
Update Kodi on your Fire TV to latest nightly automatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env php | |
<?php | |
// Set ARM or x86 | |
$arch = "arm"; | |
// IP adress of Fire TV | |
$ip = "10.0.0.229"; | |
// Timezone | |
$timezone = "Europe/Berlin"; | |
function getxbmc($currv,$date,$arch,$ip) { | |
if (stripos($currv,"kodi-") !== false) { | |
$left = strstr($currv,"kodi-".$date); | |
} else { | |
$left = strstr($currv,"xbmc-".$date); | |
} | |
$filename = substr($left,0,strpos($left,".apk")).".apk"; | |
if(file_exists($filename)) { | |
unlink($filename); | |
echo "Old file deleted.\n"; | |
} | |
echo "Download new file...\n"; | |
file_put_contents($filename,file_get_contents("http://mirrors.xbmc.org/nightlies/android/".$arch."/".$filename)); | |
echo "Done.\n"; | |
echo "connecting to Fire TV with IP ".$ip." ...\n"; | |
echo exec("adb connect ".$ip)."\n"; | |
echo "Installing...\n"; | |
echo exec("adb install -r ".$filename)."\n"; | |
echo "Deleting Kodi build...\n"; | |
unlink($filename); | |
echo "Done!\n"; | |
} | |
date_default_timezone_set($timezone); | |
$currv = file_get_contents("http://mirrors.xbmc.org/nightlies/android/".$arch."/"); | |
if (stripos($currv,date('Ymd')) !== false) { | |
getxbmc($currv,date('Ymd'),$arch,$ip); | |
}elseif (stripos($currv,date('Ymd',strtotime('-1 days'))) !== false) { | |
getxbmc($currv,date('Ymd',strtotime('-1 days')),$arch,$ip); | |
} else { | |
echo "No new build today or yesterday!\n"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment