Package: manifest-ingest
Manifest IngestAuthor: Tim Santortsantor@xstudios.comOverviewDownload a project JSON manifest and its media files via S3, SFTP or HTTP. This tool was developed for internal use on all X Studios interactive installations which need to have the ability to run "offline" when there is no active network connection.Installationpip install manifest-ingestOr if you want to install a development version:pip install git+https://bitbucket.org/xstudios/manifest-ingest.git@tagNote: On Windows Visual Studio C++ Build Tools 14 is required. You can install it with Chocolatey via:choco install microsoft-visual-cpp-build-toolsUsageCreate a Config fileCreate a config file at~/manifest-ingest.cfg:[default]; API endpoint which returns JSONapi_url=http://192.168.1.69:8000/api/v1/music/playlist/; Authorization header needed to access the API (optional)api_token=Token API_TOKEN; Regex of key names to search forkeys=(audio_url|artwork_url); Override the default manifest filename (optional)manifest_filename=manifest.json; Local directory to place downloaded fileslocal_dir=~/target/dir/downloads; Where to place the log file for the applicationlog=~/target/dir/manifest-ingest.log; Max retries to make failed network request before giving upmax_retries=5; Base URL for relative pathsbase_url=http://192.168.1.69:8000; Concurrent downloads (number of cores * 2 is usually best)concurrent_downloads=4[s3]profile_name=defaultbucket_name=BUCKET_NAME; Compare MD5 hash of local file with remote filecompare_md5=true[sftp]server=192.168.1.100username=USERNAMEpassword=PASSWORD; Remote directory on server to prepend to file URLs in manifestremote_dir=/path/to/project[post_download]; Command to run when completecommand=osascript -e 'tell application "Safari" to activate'NOTE: The config file can be located anywhere that is readable by the user. Thes3,sftpandpost_downloadsections are optional.Usagemanifest-ingest--config=~/manifest-ingest.cfgRun at Startup (Mac)Create a plist file as/Library/LaunchAgents/com.user.manifestingest.plist<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plistversion="1.0"><dict><key>Label</key><string>com.user.manifestingest</string><key>ProgramArguments</key><array><string>/usr/local/bin/manifest-ingest</string><string>--config</string><string>~/config/manifest-ingest.cfg</string></array><key>RunAtLoad</key><true/></dict></plist>Then run:launchctlload/Library/LaunchAgents/com.user.manifestingest.plistRun at Startup (PC)Create a Scheduled Task.Triggers- At log on of any user (Delay task for 30 secs)Actions- Start a Program: manifest-ingest --config="/Users/Admin/project/config/manifest-ingest.cfg"On Windows, your bat file to launch a Unity app will look something like this:START "" /D "C:\Users\Admin\Desktop\AppName" "AppName.exe" -screen-fullscreen 1 -screen-width 1920 -screen-height 1080IssuesIf you experience any issues, please create anissueon Bitbucket.HistoryAll notable changes to this project will be documented in this file. This project adheres toSemantic Versioning.0.0.1- Initial release0.0.2- Added saving and backup of manifest locally0.0.3- Graceful error handling for when a remote file doesn't exist and we attempt to download it0.0.4- Added config option to launch command line app when download finished0.0.5- Added alternate media URL strip method0.0.6- Major refactor to make more configurable0.0.7- Added single package entry point (all script entry points us same config) and Removedmanifest-quickstart0.0.8- Fixed bug where we expected a api_token in the config (not always needed)0.0.9- Fixed bug with config setup importing from wrong package0.1.0- Fixed bug with run_command call typo0.1.1- Fixed url path removal from JSON and correct os paths0.1.2- Fixed remote path bug on Windows0.1.3- Added elapsed time to log0.2.0- Key names are now a regex which is more flexible & powerful0.2.1- Fixed bug where local filename would be striped of the word "media"0.2.2- Additional logging0.2.3- Removed some logging clutter0.2.4- If manifest is empty (eg - {}), then we abort and do not launch post_download commands0.2.5- Use Keychain (OSX) or Credential Manager (Windows) to get SFTP password0.2.6- When executingmanifest-sftpover SSH, Keychain/Credential Manager do not provide the password so we added the ability to manually provide a password via the-por--passwordargument on the command line (use with caution)0.2.7- Due to complications with running via command line, we removed the Keychain/Credential Manager support.  You may now pass passwords via Base64 to at least thwart over the shoulder attacks.  Also changed the way we execute the post download command to be non-blocking.0.2.8- Improved connection and SSH exception handling and added connection retries up to a max number of times.0.2.9- Lock in version of pysftp to 0.2.8 due to 0.2.9 HostKeys issue.0.3.0- Revert to original manifest on SFTP login failure as we won't be able to download the files in the manifest.0.3.1- Bug fix with creating remote path correctly on Windows.0.3.2- After a failed SSH attempt, revert manifest to original and run post_download.0.3.3- Addedmanifest_filenameconfig so we can save to custom named manifest file.0.3.4- Lock in version of pysftp to 0.2.8 due to 0.2.9 HostKeys issue...again.0.3.5- Addedmanifest-s3to handle manifests of S3 files.0.3.6- Update the way we save the manifest with s3 manifests.0.4.0- Complete refactor.  Single entrypoint ofmanifest-ingest. Via config can handle S3, SFTP and HTTP manifest URL downloads.0.4.1- Added ability to compare local and remote MD5 hashes to determine if a file is newer on S3.0.4.2ChangedChanged the way we look for keys with URLs (absolute or relative) to regex.ChangedChanged the way we strip URL prefixes to make paths relative (to to the download directory) to regex.AddedAdded ability to specify AWS credenttial profile to use for S3 in config.0.4.3- Added multiprocessing to speed up downloads0.4.4- It's a mystery...0.4.5- Added Python 3.6+ support (still works with Python 2.7+)0.4.6- No changes. Version bump so we can remove older versions from PyPi. Sorry.0.4.7- No changes. Version bump so we can remove older versions from test PyPi. Sorry.0.4.8- Support S3, SFTP and HTTP download URLs.0.4.9- Bug fix and handle ports in IPs.0.5.0- Bug fix with handling S3 downloads as the bucket name can be in the domain name or in the path (eg - bucket-name.s3.amazonaws.com or s3.amazonaws.com/bucket-name)0.5.1- Bug fix with multiprocessing on Windows.0.5.2- Added more complex regex to find key/value pairs where the value may be a URL or list of URLs0.5.3(8-31-21) - Updated packaging method, add Makefile for development, update setup.py