Git Product home page Git Product logo

misc-powershell's People

Contributors

pandages avatar wi-ry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pandages

misc-powershell's Issues

Only searches 1 subreddit at a time

With some tweaks to the code, I think this script could check multiple subreddits. I feel like that would be smart, especially when combined with making the naming of files be human-readable, at that would catch crossposts and eliminate duplicates.

Script Interacts with JSON, but as Text rather than as PowerShell objects

per my understanding, this script:

  1. Downloads JSON
  2. Looks for URLs within JSON
  3. checks URLs for a specific string (using a regex)
  4. Counts the number of hits
  5. Provides a status to the user via commandline (number of images to download, and percentage completed).
  6. Validates that the already-downloaded images are of specified resolution, and deletes them if not.

What it does not do is, interpret the JSON a PowerShell object, using the ConvertFrom-JSON cmdlet.

I think refactoring the code to use ConvertFrom-JSON could improve things. For example, the script could name the files based on the Title of the Reddit thread, rather than the original filename (which is randomized or serial-numbered, not human-readable).

It may also allow filtering on keywords, tags, or resolutions of images based on the properties available within the JSON. As I haven't implemented this myself, I can't say for sure, but I'd wager at least some of this would be easy enough to do.

Alternatively, the script could be reimplemented to use a Hashtable. This would give a similar result.

Script only downloads files with extension JPG

By design, this script only downloads files with names like *.JPG. Should a file be named *.JPEG it will not be processed. PNG files will also not be processed.

I'm working on a way to fix that.

Checks dimensions of files once downloaded, rather than within the JSON prior to download

There's a significant block of code in this script which appears to be present specifically to check that files are no smaller than the specified minimum Height and Width parameters.

The Height and Width values of the images are contained within the JSON:

data.children.data.preview.images.source.height
data.children.data.preview.images.source.width

We can filter out files that are below the minimum specified by the input parameters, just have to rework a bit of the code. I'll see what I can do.

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.