Giter VIP home page Giter VIP logo

Comments (6)

enderlein avatar enderlein commented on July 4, 2024 1

No problem at all. I'll keep looking.

from anime-downloader.

vn-ki avatar vn-ki commented on July 4, 2024

Yeah. There are a lot of things to be ironed out in that category.

Funny of me to assume one will get 30 results for every search. If you're willing to open a PR, I'm happy to merge it.

from anime-downloader.

vn-ki avatar vn-ki commented on July 4, 2024

If you are okay with it, let @KashTag take up this issue. I'm sure you'll find a lot more bugs!

from anime-downloader.

vn-ki avatar vn-ki commented on July 4, 2024

That's great @enderlein.

@KashTag If you are interested, please look into this issue.

EDIT: I'm linking the relevant code below,

https://github.com/vn-ki/anime-downloader/blob/35d6e303d2dca36daa7c359888f959315753b800/anime_downloader/util.py#L40-L62

from anime-downloader.

KashTag avatar KashTag commented on July 4, 2024

Sorry I'm still new to Python so I took my stupid time working this out.
I changed the code like this.

def search(query):
    # Since this function outputs to stdout this should ideally be in
    # cli. But it is used in watch too. :(
    try:
        search_results = NineAnime.search(query)
    except Exception as e:
        logging.error(click.style(str(e), fg='red'))
        sys.exit(1)
    click.echo(format_search_results(search_results))
    if not search_results: 
        print('No such Anime found')
        sys.exit(1)
    val = click.prompt('Enter the anime no: ', type=int, default=1)

    try:
        url = search_results[val-1].url
        title = search_results[val-1].title
    except IndexError:
        logging.error('Only maximum of 30 search results are allowed.'
                      ' Please input a number less than 31')
        sys.exit(1)

    logging.info('Selected {}'.format(title))

    return url

I wish I knew how to make it rerun the function instead of exiting.

Now it shows the following:

capture3

That last edit was a mistake. Sorry i thought the val variable stored the number of search results. I'll try to find it. I closed the accidental pull request.

If I find out then ill use .format and replace 30 and 31

from anime-downloader.

vn-ki avatar vn-ki commented on July 4, 2024

#14 closes this.

from anime-downloader.

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.