Giter Club home page Giter Club logo

Comments (5)

eamonnkenny avatar eamonnkenny commented on May 18, 2024 1

Great work. Really like what you have done with this.

from google-images-download.

hardikvasa avatar hardikvasa commented on May 18, 2024

@eamonnkenny thanks for your feedback :-)

This script, as you know would run from Command Line Interface. With that, could you tell me how do you propose it to be used from within other python files? Like even if the methods were put in classes, how would it still be like an API?

For now, the best way to call this from within another python file would be
subprocess.call("googleimagesdownload -cf config.json)

and have all the arguments in the config (JSON) file. And since it is JSON format, it could also be automated as required.

Thnx

from google-images-download.

eamonnkenny avatar eamonnkenny commented on May 18, 2024

The issue is that with an API the individual using it does not want to have all the configuration in one script. I for instance would like to use it as an API with some default behaviour, downloading 10 labeled for reuse images given some input search string that changes each time.
(by the way, typos related to labled instead of labeled in your main calling function, need fixing)

I've attached a calling function that includes a class. Basically its probably better if you use a class instead of a function call and this gives people the ability to manipulate some of the variables.

I have to say you have done a great job on this as it stands. I really like the results that the functions use and you have so much added functionality and configurability. Its great.

I've attached a workaround for what I am trying to do. I basically wrapped your code up in a class.
The class could be extended to have a whole lot more default arguments. I also have the ability at the moment to just add in extra arguments (this isn't actually the way to do it), but it would be nicer if every single argument can be passed to a constructor of a class. The calling function can be basically what you have with lots of arguments and then fed into the class afterwards. Hope this makes sense. That way the class then becomes the front for the API calls. The command line main function is just a usage of the API.

ImageDownloadClass.zip

from google-images-download.

hardikvasa avatar hardikvasa commented on May 18, 2024

@eamonnkenny thanks for the suggestion. The new version of this lib allows you to call it from another python file. An example is provided in the docs. You can now create an object and pass on the parameters inside it.

Had to make a lot of changes in the code for good to implement this... :D . Few minor changes around the edges will be done in coming days...but for now this works fine.

Do let me know if this is more usable now.

from google-images-download.

hardikvasa avatar hardikvasa commented on May 18, 2024

Closing this issue. Seems to be stable on all major OSs.

from google-images-download.

Related Issues (20)

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.