Skip to main content

An easy-to-use, OS-Independent updater for games/programs.

Project description

MBH Updater

A Python script designed for frontend updating of files. Not intended for use as a GIT alternative for backend programming.

Overview

This is a fairly simple program that will copy files from online and keep the file structure. For example, if you have /path/to/file/code.txt and /path/to/code.txt, it will keep those files in those folders locally.

Documentation

Updater class

What each class variable means.

class Updater(object):

def __init__(local_version_file="version.txt",
            latest_version_file="new_version.txt",
            latesturl=False, new_files=[],
            new_filesurl=True, output=True,
            source_file="", source_file_enabled=True,
            source_fileurl=True, files_offset=0)
    """
    local_version_file: The downloaded version of the software.
    Should contain a number, like 1, 1.2, 1.234.
    latest_version_file: Likely stored online. This is the latest version of the software.
    Should contain a number, like 2, 2.3, 2.345.
    latesturl: Boolean. Whether or not the file stored at latest_version_file is a url.
    new_files: Array. Contains the location of the files to update if the versions don't match.
    new_filesurl: Boolean. Whether or not the items listed in new_files are urls.
    output: Boolean. Whether or not to write to screen. Ignored for TQDMUpdater.
    source_file: (optional) The location of the source file (where all files required to pull
    are stored).
    source_file_enabled: Boolean. Whether or not to use the source file feature.
    source_fileurl: Whether or not the source file is stored online.
    files_offset: Integer. Contains the folder offset to add to URLs when pulling from online. (eg. If the url is http://files.net/files/source/file.txt, and files_offset is 1, it will be pulled into /source/file.txt. If the offset is 2, it will not be stored in an extra folder.)
    """

Initialize the updater

Standard
import mbhupdater.updater

updater = mbhupdater.updater.Updater()
tqdm (Progress Bar)
import mbhupdater.tqdm_updater

updater = mbhupdater.tqdm_updater.TQDMUpdater()

Pull the new files

Pull without comparing versions:
updater.pull_files()
Pull if local version is outdated:
updater.compare_and_pull()

When you are pulling files from online, you MUST include the http:// or https:// part of the URL in the sources list, otherwise there may be errors in both pulling the file from online, and writing the files locally.

Example source file

There is an optional source file feature in the updater. If you're using it, this is how you would format it:

http://www.location1.com/file/file.txt
http://files.server.net/files/code.py
[DELETE]
/local/path/to/file.txt
/local/path/to/file2.txt
/old/thing/file.txt
/old/folder/
/temp/

Make sure to include the http:// or https:// for online files, otherwise it will not output to the correct folder and may crash.
Any files under the [DELETE] tag will be deleted instead of updated/created. The path for deletion must be a local file, not a URL.
If you want to delete a folder, you must have a / at the end.

Getters and setters

Pretty easy to guess what they do, they just use the variable names in the functions. Here's a list:

# Getters
get_local_version_file()
get_latest_version_file()
get_latesturl_status()
get_files_offset()
get_new_filesurl_status()
get_output_status()
get_local_version()
get_latest_version()
get_source_file_enabled()
get_source_fileurl_status()
# Setters
set_local_version_file(local_version_file)
set_latest_version_file(latest_version_file)
set_source_file(source_file)
set_files_offset()
toggle_latesturl()
toggle_new_filesurl()
toggle_output()
toggle_source_file_enabled()
toggle_source_fileurl()

All functions have descriptions that will show up in IDEs.

Other functions

# Other functions
compare_versions() - Returns True if the versions match and False if the local one is out of date.
read_files()       - Reads the content of the version files. Must use before get_local_version() or get_latest_version()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mbhupdater-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

mbhupdater-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file mbhupdater-0.1.0.tar.gz.

File metadata

  • Download URL: mbhupdater-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for mbhupdater-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da73b7498f98bc3ca16b662baa37b1e552279eaaa6caf34a9b0e19e98d069cd7
MD5 bb001f7760c4be4de56feea3bda2856c
BLAKE2b-256 98d60fd0af3cece077ea4a6b7675d4986e9b81bb2b151c5176c86d4ea0977bf7

See more details on using hashes here.

File details

Details for the file mbhupdater-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mbhupdater-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for mbhupdater-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d204c7225f7780591f6d2e5ff3771d1e0e85ac5f2486c4e940e6dcfb2840f87
MD5 11f22835f0d230d5b5ec8776e2aa1772
BLAKE2b-256 754569a01e90323dd3fd95227b964a2be9cb64a38381263940d3f636d4f15662

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page