Last active
August 29, 2015 14:06
-
-
Save yanniks/fa9ce00c19a6fb74ea0a to your computer and use it in GitHub Desktop.
Get newest Kodi nightly - Mac specific
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 | |
$timezone = "Europe/Berlin"; | |
function getxbmc($currv,$date) { | |
$left = strstr($currv,"kodi-".$date); | |
echo "Selected build: ".$date."\n\n"; | |
$filename = substr($left,0,strpos($left,".dmg")).".dmg"; | |
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.kodi.tv/nightlies/osx/x86_64/".$filename)); | |
echo "Done.\n"; | |
echo "Mount image...\n"; | |
exec("hdiutil attach ".$filename); | |
echo "Replace old file...\n"; | |
exec("rm -rf /Applications/Kodi.app"); | |
exec("cp -R /Volumes/Kodi/Kodi.app /Applications/Kodi.app"); | |
echo "Eject image...\n"; | |
exec("diskutil eject /Volumes/Kodi"); | |
echo("Delete image...\n"); | |
unlink($filename); | |
echo "Done!\n"; | |
} | |
date_default_timezone_set($timezone); | |
$currv = file_get_contents("http://mirrors.kodi.tv/nightlies/osx/x86_64/"); | |
if (stripos($currv,date('Ymd')) !== false) { | |
getxbmc($currv,date('Ymd')); | |
}elseif (stripos($currv,date('Ymd',strtotime('-1 days'))) !== false) { | |
getxbmc($currv,date('Ymd',strtotime('-1 days'))); | |
} 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