ryukinix / mal

MAL: A MyAnimeList Command Line Interface [BROKEN: BLAME MyAnimeList]
https://mal.readthedocs.io
Other
109 stars 9 forks source link

Add edit sub-command #46

Closed ryukinix closed 6 years ago

ryukinix commented 7 years ago

Old idea

The current possibility to put score on anime is only when the watching process is completed using mal inc regex command, so the CLI will ask for the user about the score of that anime.

Would be better if we can score any anime of the user list.

Edited

This thread now is about creating the command edit with the following features: edit the fields of a specific anime: status, score and tags. Maybe we can add more of them later.

Status of implementation:

mparadinha commented 7 years ago

How about an edit command where the user could change the score as well as the status and tags?

ryukinix commented 7 years ago

Ok

ryukinix commented 7 years ago

We have WIP on the branch edit-cmd. Help would be great.

ryukinix commented 7 years ago

@mparadinha what is the state of your implementation of the edit command? Would be great your report about what is lacking to do.

mparadinha commented 7 years ago

I'd like to switch the order of the command to be mal edit <regex> <section>. Functionality for editing multiple attributes at once using comma separated values like mal edit bebop score=10,status=completed, would be a nice addition. Also needs user input checking and some testing to make sure everything works, of course.

ryukinix commented 7 years ago

This seems pretty nice. I'll look into your branch in soon If I can do something to merge and release with our next milestone v0.4

kutsan commented 7 years ago

Or mal edit bebop would open an vim editor that you can edit from a file. Like git's interactive rebase editor.

mparadinha commented 7 years ago

I like the idea.

ryukinix commented 6 years ago

@kutsan thanks for the nice idea! Maybe we should do that for default and then create additional flags to change without the editor (make scripting possible).

mal edit bebop # open editor, vim or emacs through the EDITOR env variable
mal edit bebop --score 10 # set score
mal edit bebop --status watching # set list section
mal edit bebop --tags futurist space sci-fi # set tags
kutsan commented 6 years ago

@ryukinix You are welcome! And I agree, flags would be useful for quick editing and scripting.

kutsan commented 6 years ago

@ryukinix please also include that, in some systems users can't have access to /tmp directory. I use mal under Termux on Android and creating temporary files under /tmp would potentially break the mal. If /tmp is not accessible, you should handle it.

Another directory under $HOME is okay though.

ryukinix commented 6 years ago

Maybe after that we should set drop command as deprecated in the next version v0.4 and remove it in future. After all, the edit command will already accomplish that feature through mal edit bebop --status dropped. mal drop bebop is shortner, but I don't know if we should keep that for this reason. I created the drop sub-command just because I needed in some moment, but I not thought well about that.

ryukinix commented 6 years ago

@kutsan good to know, I didn't thinking about that. In android or specifically we have any folder for temporary files? Naively, when a /tmp is not present or allowed to write/read, we can create the temporary file for edit on the directory which was be called and so then delete after the process finish. But we have a problem with it, if something crash this will leak a file on your filesystem and this is not very good. Using /tmp is not a problem because after a reboot all the files is gone.

You have some recommendation about this problem?

ryukinix commented 6 years ago

We have a problem about flags name's collision here: --status and --score when created the short flags will be intuitively -s for both. We obviously can create another short-name for one of them (probably status), but -s (score) and -S (status) is not good, -s and -t neither, maybe -st (status) and -sc (score) can fix the ambiguity with more clarity, but using short flags with more than one character is very uncommon.

Any suggestion is welcome.

kutsan commented 6 years ago

Termux uses its own rules. So, if you are asking about Termux, you can use $PREFIX/tmp which is the same as /tmp on normal systems. I don't know any other terminal emulator that you can use pip under it, to install mal. But, let's assume there are other ones, they probably not gonna have /tmp or $PREFIX/tmp either. So, if you want to support them, probably ~/.config/mal/cache/ directory is the only option IMO. At least, users can see the cache itself and delete it if necessary.

About other thing you just said. I think you are right and you should remove it. Since drop one isn't that shorter I think: mal edit bebop -st dropped, mal drop bebop. And drop command will only make things complicated.

kutsan commented 6 years ago

@ryukinix Just saying but -s option may will determinate what user asked for. For example, -s 6 would expand --score 6 and -s dropped would expand --status dropped depending on the context. It may not be good though.

ryukinix commented 6 years ago

This is clever, but anyone will expect this? At least me, I always expect one short flag for each extended flag. Merging both in one can be very tricky until the user understand that. I think we should avoid it.

kutsan commented 6 years ago

Yeah... I wouldn't even expect either.

ryukinix commented 6 years ago

Yes, we should remove drop in future, but in the next version will be just deprecated. We should tag that on the mal help and maybe I can print a warning too about that when a user call mal drop. I do not expect that anyone have love about the drop command and neither even use that, but I cannot confirm, so then tagging as deprecated in v0.4 and removing on the next (maybe v0.5) should be good enough.

ryukinix commented 6 years ago

Termux uses its own rules. So, if you are asking about Termux, you can use $PREFIX/tmp which is the same as /tmp on normal systems. I don't know any other terminal emulator that you can use pip under it, to install mal. But, let's assume there are other ones, they probably not gonna have /tmp or $PREFIX/tmp either. So, if you want to support them, probably ~/.config/mal/cache/ directory is the only option IMO. At least, users can see the cache itself and delete it if necessary.

Yes, definitely. We can give partial support for termux for now and set as $PREFIX/tmp when a user call mal through the termux. But, just for ask, using the standard-library tempdir will not return the correct temporary folder on termux? Try later execute this on termux (I don't have any phone with me):

import tempfile
tempfile.gettempdir()

This apply too when we have a strange environment, like Windows and the correct folder is used: %USER%\AppData\Local\Temp\.

kutsan commented 6 years ago

It actually works.

ryukinix commented 6 years ago

So then problem solved :)

ryukinix commented 6 years ago

implemented at #78, closing this issue.

kutsan commented 6 years ago

@ryukinix It's great to see this. But one thing, I don't know about MyAnimeList API but in official website, when editing an anime, there are tons of options, such as start date, finish date, priority, storage, total times re-watched, rewatch value, comments, etc.. Are you going to implement those of them too? Although, I don't use them much but still useful in some cases.

ryukinix commented 6 years ago

Well, this is indeed is not priority, but we can implement further yes. But on v0.4.0 we don't have plans to add that, since the most important is what we have now. Are you ok with that? I have priority to implement the torrent command and write the docs for the manpage to delivery the v0.4.0 version of mal.

BTW, this is the values that you can edit through the MAL API:

image

kutsan commented 6 years ago

Thanks! I am okay with everything. I think this project still by far the best MAL CLI client even with current features. I also think too the torrent feature is more prior.

By the way, care to share your MyAnimeList account?

ryukinix commented 6 years ago

Thanks! I am okay with everything. I think this project still by far the best MAL CLI client even with current features. I also think too the torrent feature is more prior.

This is a nice feedback. Thanks. Feedback, positive or negative, is always welcome.

By the way, care to share your MyAnimeList account?

Not at all, I can share with you. I sent a email with my profile.

kutsan commented 6 years ago

Thanks, received!