'Downloads the latest source tarball from server and installs it over the existing version.'

def update(self):

    tar_download_url = u'https://git.sickrage.ca/SiCKRAGE/sickrage/repository/archive.tar?ref=master'
    try:
        sr_update_dir = os.path.join(sickrage.PROG_DIR, u'sr-update')
        if os.path.isdir(sr_update_dir):
            sickrage.srCore.srLogger.info(((u'Clearing    out    update    folder    ' + sr_update_dir) + u'    before    extracting'))
            shutil.rmtree(sr_update_dir)
        sickrage.srCore.srLogger.info(((u'Creating    update    folder    ' + sr_update_dir) + u'    before    extracting'))
        os.makedirs(sr_update_dir)
        sickrage.srCore.srLogger.info((u'Downloading    update    from    ' + repr(tar_download_url)))
        tar_download_path = os.path.join(sr_update_dir, u'sr-update.tar')
        sickrage.srCore.srWebSession.download(tar_download_url, tar_download_path)
        if (not os.path.isfile(tar_download_path)):
            sickrage.srCore.srLogger.warning(((u'Unable    to    retrieve    new    version    from    ' + tar_download_url) + u",    can't    update"))
            return False
        if (not tarfile.is_tarfile(tar_download_path)):
            sickrage.srCore.srLogger.error(((u'Retrieved    version    from    ' + tar_download_url) + u"    is    corrupt,    can't    update"))
            return False
        sickrage.srCore.srLogger.info((u'Extracting    file    ' + tar_download_path))
        tar = tarfile.open(tar_download_path)
        tar.extractall(sr_update_dir)
        tar.close()
        sickrage.srCore.srLogger.info((u'Deleting    file    ' + tar_download_path))
        os.remove(tar_download_path)
        update_dir_contents = [x for x in os.listdir(sr_update_dir) if os.path.isdir(os.path.join(sr_update_dir, x))]
        if (len(update_dir_contents) != 1):
            sickrage.srCore.srLogger.error((u'Invalid    update    data,    update    failed:    ' + str(update_dir_contents)))
            return False
        content_dir = os.path.join(sr_update_dir, update_dir_contents[0])
        sickrage.srCore.srLogger.info((((u'Moving    files    from    ' + content_dir) + u'    to    ') + sickrage.PROG_DIR))
        for (dirname, _, filenames) in os.walk(content_dir):
            dirname = dirname[(len(content_dir) + 1):]
            for curfile in filenames:
                old_path = os.path.join(content_dir, dirname, curfile)
                new_path = os.path.join(sickrage.PROG_DIR, dirname, curfile)
                if (curfile in (u'unrar.dll', u'unrar64.dll')):
                    try:
                        os.chmod(new_path, stat.S_IWRITE)
                        os.remove(new_path)
                        os.renames(old_path, new_path)
                    except Exception as e:
                        sickrage.srCore.srLogger.debug((((u'Unable    to    update    ' + new_path) + u':    ') + e.message))
                        os.remove(old_path)
                    continue
                if os.path.isfile(new_path):
                    os.remove(new_path)
                os.renames(old_path, new_path)
    except Exception as e:
        sickrage.srCore.srLogger.error(u'Error    while    trying    to    update:    {}'.format(e.message))
        sickrage.srCore.srLogger.debug((u'Traceback:    ' + traceback.format_exc()))
        return False
    if sickrage.srCore.srConfig.NOTIFY_ON_UPDATE:
        srNotifiers.notify_version_update(self.get_newest_version)
    return True
