sdaqo / anipy-cli

Little tool in python to watch and download anime from the terminal (the better way to watch anime). Also applicable as an API
https://sdaqo.github.io/anipy-cli
GNU General Public License v3.0
270 stars 40 forks source link

[Feature Request] Add "Add to seasonals" to the main menu #170

Closed GreatTeacherOni closed 5 months ago

GreatTeacherOni commented 5 months ago

Describe the the new feature While playing an episode (except when already using -S mode) there should be a direct way to add the current episode to seasonals via e.g. [as] Add anime to seasonals

What problem are you trying to solve? This way it is also possible to directly add an anime to seasonals without having to start in Seasonal Mode first. QoL improvement.

Do you have any ideas for implementation? Add following implementation to the main menu (except when already inside Seasonal Mode which already has [a] Add Anime): [as] Add anime to seasonals

sdaqo commented 5 months ago

Ok, seems like a useful feature.

GreatTeacherOni commented 5 months ago

Thank you for the implementation! I just tested the feature and found a little thing that should probably be added/changed.

When I got more than 1 instance of anipy-cli open I can run into following issue:

Step 1: $\textcolor{green}{\textsf{-----------------------------}}$ On anipy-cli instance A: Add an anime+episode to seasonals via pressing t. That means it gets added to the LocalList of A (LocalList of A is in state 1) and the LocalList of A gets copied to the seasonal_list.

seasonal_list now contains the exact content of LocalList A. $\textcolor{green}{\textsf{-----------------------------}}$

Step 2: $\textcolor{blue}{\textsf{-----------------------------}}$ On anipy-cli instance B: Add an anime+episode to seasonals via pressing t. That means it gets added to the LocalList of B (LocalList of B is in state 1) and the LocalList of B gets copied to the seasonal_list practically overwriting the changes (previously added or deleted anime episodes by A) made by LocalList A.

seasonal_list now contains the exact content of LocalList B (and no more content of LocalList A). $\textcolor{blue}{\textsf{-----------------------------}}$

Step 3: $\textcolor{green}{\textsf{-----------------------------}}$ On anipy-cli instance A: Now add or remove an anime+episode to seasonal via pressing t. That means it gets added to the LocalList of A

In short: LocalList of A in state 1 -> LocalList of A in state 2 -> state 2 gets copied to seasonal_list overwriting older changes which get lost

Longer explanation **A** now adds or deletes anime episodes to **state 1** transitioning into **state 2** and the **LocalList of A** gets copied to the `seasonal_list` practically overwriting the changes (previously added or deleted anime episodes by B are lost)

seasonal_list now contains the exact content of LocalList A. $\textcolor{green}{\textsf{-----------------------------}}$

TLDR: LocalList X of an instance X of anipy-cli gets copied to seasonal_list overwriting all the previous changes made by other instances of anipy-cli.

Possible Solution 1: When adding or deleting anime episodes: Before copying LocalList to seasonal_list first update LocalList with the content changes (delta) of seasonal_list (essentially just copy seasonal_list to LocalList, overwriting LocalList)

Possible Solution 2: Keep LocalList independent to each instance of anipy-cli and implement a manual "[u] Update list" feature. Important in Solution 2: Do not automatically update seasonal_list with LocalList since that would produce the explained issue (check TLDR) and do not copy seasonal_list to LocalList since neither list is the single source of truth

sdaqo commented 5 months ago

Alright, so the fix would basically be: read the file again before writing. Ok noted, thanks. Could you maybe open a different issue for this? Just copy the contents of your message, thats fine.

Will close this now as the "add to seasonals" seems to be working.