Giter VIP home page Giter VIP logo

Comments (11)

justfoolingaround avatar justfoolingaround commented on May 10, 2024 1

I was thinking that, given a flag, something like --json, all the output could be just JSON.

Added by default. All the values shown in the grab stdout will now be in JSON format.. just separated by newlines on each episodes (You can easily guess why that is done).

To make things easier, I've added a --quiet option alongside all the commands and with this, banner will be silenced as well with all the "announcements" done by animdl.

This has been pushed to the unstable version (the non-packaged repo) atm and will be pushed to the packaged repo soon.

From what I gather, this line is responsible for crashing, and I think it's because of the color formatting?

I'm not sure how to find a workaround for that. Should I raise the issue in https://github.com/justfoolingaround/animdl-install?

EDIT - Found how to work around that, using python -X utf8 fixes the issue. I don't know how fixable it is on your end though.

Ah, that's great to know!

from animdl.

innocenzi avatar innocenzi commented on May 10, 2024 1

Alright, that's good enough for me. Thanks a lot! I'll probably publish my wrapper and the app I'll make in a few weeks. animdl is very useful. :)

from animdl.

justfoolingaround avatar justfoolingaround commented on May 10, 2024 1

Added. I kinda separated the provider argument; you can get the output you desire by using

animdl.py search "one piece" --json --quiet

Don't worry about 2 calls making your wrapper or normal usage inefficient. The search done by other commands is ignored if the url matches hence, there won't ever be any unnecessary calls.

from animdl.

innocenzi avatar innocenzi commented on May 10, 2024

Actually, ainsi seem to make the program crash when calling from symfony/process:

Traceback (most recent call last):
  File "D:\Programmes\Python\3-8-0\Scripts\animdl-script.py", line 11, in <module>
    load_entry_point('animdl==1.3.1', 'console_scripts', 'animdl')()
  File "d:\programmes\python\3-8-0\lib\site-packages\pkg_resources\__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "d:\programmes\python\3-8-0\lib\site-packages\pkg_resources\__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "d:\programmes\python\3-8-0\lib\site-packages\pkg_resources\__init__.py", line 2443, in load
    return self.resolve()
  File "d:\programmes\python\3-8-0\lib\site-packages\pkg_resources\__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "d:\programmes\python\3-8-0\lib\site-packages\animdl\__main__.py", line 11, in <module>
    print("\x1b[35m{}\x1b[39m".format(package_banner))
  File "d:\programmes\python\3-8-0\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 5-51: character maps to <undefined>

From what I gather, this line is responsible for crashing, and I think it's because of the color formatting?

I'm not sure how to find a workaround for that. Should I raise the issue in https://github.com/justfoolingaround/animdl-install?

EDIT - Found how to work around that, using python -X utf8 fixes the issue. I don't know how fixable it is on your end though.

from animdl.

innocenzi avatar innocenzi commented on May 10, 2024

That's great, that was fast!

Could I abuse and ask if it's possible to do the same for animdl grab "one piece" --quiet? Currently this one still outputs colors and non-json, as well as waiting for user input :/

I tested animdl grab https://9anime.to/watch/one-piece.ov8 --quiet though and this is perfect. 🙏

from animdl.

justfoolingaround avatar justfoolingaround commented on May 10, 2024

So, I've added an auto flag with an index argument which will be in use if the flag is passed.

In case of One Piece, the auto would've just selected the dub version which isn't ideal for most use-cases; hence, using a index would make selecting easy from queries (1; or second item would be the sub one).

Keep in mind that the index is a programmer's index so 1 will be equivalent to the second item. Not sure if I even have to mention this xd.

from animdl.

justfoolingaround avatar justfoolingaround commented on May 10, 2024

Also, for the record, these all features are added to all the major commands so yeah, you can avoid the colored stuff and the query selector in those commands (stream/download) as well.

from animdl.

innocenzi avatar innocenzi commented on May 10, 2024

Hey,

It's me again! I've discovered while working on it that the --auto option is not that convenient, since I want the user to be able to look for an anime.

I was going to just parse the output (and not use --auto), but without TTY the CLI returns the code 1. It means that I have to modify my abstraction to not throw, and while I could do that, I think it'd be better if the CLI could just understand --quiet and return a result like the following:

➜ python .\animdl.py grab "one piece" --quiet
{"name": "One Piece", "url": "https://9anime.to/watch/one-piece.ov8"}
{"name": "One Piece (Dub)", "url": "https://9anime.to/watch/one-piece-dub.34r"}
{"name": "One Piece Recap", "url": "https://9anime.to/watch/one-piece-recap.j8j8"}

This is more convenient because, from a query, I can actually get a list of matching animes and their URL, so the user can chose the one they want (same problematic you solved with index, but the user would have no way to input that index so we can't use it there).

Alternatively I could make the search with an external API (eg. AniList) but the names are not the exact sames so it's not reliable.

TL;DR: I'd like the user to be able to search for an anime, select one, and after use the corresponding link (ie. https://9anime.to/watch/one-piece.ov8) to get the episode list (python .\animdl.py grab https://9anime.to/watch/one-piece.ov8 --quiet works wonderfully though).

from animdl.

justfoolingaround avatar justfoolingaround commented on May 10, 2024

I think I'll add a search command for that when I get time. Giving json queries on quiet mode wouldn't be ideal. And of course, this search command will have its own --json/-j flag.

from animdl.

innocenzi avatar innocenzi commented on May 10, 2024

Ah, that seems perfect. 👍

from animdl.

innocenzi avatar innocenzi commented on May 10, 2024

You're so fast, this is exactly what I needed. Thanks again!

from animdl.

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.