GithubHelp home page GithubHelp logo

danmindru / cncnet-map-downloader.js Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 177 KB

Downloads & unzips all cncnet maps for a given command and conquer game (i.e. Yuri's Revenge)

JavaScript 100.00%
yurisrevenge yuri cncnet redalert2 cli command-line-tool windows macos linux command-and-conquer

cncnet-map-downloader.js's Introduction

npm

cncnet-map-downloader.js ⬇️💻

Downloads all maps from cncnet.org into a directory of your choice.

Usage

Grab the latest binary release on the release page 💽.

Double-click your favorite executable or run the executable through the command line. You will be guided through the options (see demo).

  • By default, it only downloads Yuri (yr) maps, but can be configured to download other types. See config below.
  • If the process is somehow killed, it will resume downloading maps that haven't been downloaded yet (skips previously downlaoded maps).
  • It sorts maps in directories by name (alpha numeric).
  • It checks for duplicate maps (size, id, sha).

Demo

cncnet-map-downloader linux

Windows preview Mac preview

Build it yourself

Clone the repo, then run npm install.
You can start a download with npm run download. Downloads can be configured in package.json under scripts.

Configuration

You can configure the downloader through enviornment variables.

  • MAP_AGE - the age of the map in months (default: not specified - will get all). Example: 12 will get maps that are 1 year old and newer.
  • GAME_TYPE - the type of maps to download (default: yr). Available: ts, ra, d2, td, dta.
  • DESTINATION_DIR - the location to download files (default: cncnet-maps).

Configuration examples

  • Get all Yuri's Revenge / Red Alert 2 maps in a custom directory
DESTINATION_DIR=my-yuri-maps ./cncnet-map-downloader-js-x-x-x-macos
  • Get all Red alert maps
GAME_TYPE=ra ./cncnet-map-downloader-js-x-x-x-macos
  • Get all Tiberian Sun maps, not older than 1 year
GAME_TYPE=ts MAP_AGE=12 ./cncnet-map-downloader-js-x-x-x-macos
Dev config
  • RUN_UNPACKAGED - run the script in unpacked mode[1] (default: false; see npm run download in package.json for an example).
  • DEBUG - print additional debug info.

[1] essentially, run the non-binary script. Requires node v12.9+ & npm install

About the method

Uses the cncnet search endpoint to retrieve all existing maps, then requests each map zip individually with a delay to be nice on the server.

Previously, scarping was considered, but not necessary at this point in time.

Debugging

Run

DEBUG=true MAX_NUMBER_OF_MAPS=5 REQUEST_DELAY=5000 MAP_AGE=1 RUN_UNPACKAGED=true GAME_TYPE=yr DESTINATION_DIR=./cncnet-yuri-maps node --inspect-brk ./scripts/main.js

And open chrome://inspect to debug the node process.

Other art

Check out the cncnet search, where you can search and download maps.

cncnet-map-downloader.js's People

Contributors

danmindru avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cncnet-map-downloader.js's Issues

Update outdated maps

On script re-runs, maps can be checked by date and replaced instead of skipped.

This requires the date to be in the file name of the map.

Do not exit on windows

Windows terminal window is closed when done. Would prefer to have to press a key instead

Use more actions

  • publish automatically with action
  • add release & artifacts automatically with action (is it possible)?
  • publish downloads to gh-pages through action?

Better progress feedback

possible flow:

  • looking for existing maps
    • no maps found
  • found x maps, skipping download (could be a prompt y/n)
  • write finish log to file:
    • date, size, no of maps downloaded, no of maps failed, no of maps skipped?

Skip duplicates

Need some sort of smart duplicate detection.
Many maps have the same name with v1, v2, etc

Upload to s3

resulting maps could be uploaded to s3 periodically

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.