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
269 stars 39 forks source link

Program crashes after it finishes downloading seasonals #100

Closed Quicksilver151 closed 1 year ago

Quicksilver151 commented 1 year ago

Describe the bug Its a bit weird but it seems like the program just crashes after the downloads are all complete, without giving any opportunity to select options from the menu

To Reproduce Steps to reproduce the behavior:

  1. Download all updated anime with seasonal mode

Expected behavior

Info full terminal copy-paste

> ./anipy_cli.py -Sq 720
[a] Add Anime
[e] Delete one anime from seasonals
[l] List animes in seasonals file
[d] Download newest episodes
[w] Binge watch newest episodes
[q] Quit
Enter option: a
Search Kitsu for anime in Season? (y|n): 
>> y
Season Year: 2023
Season Name (spring|summer|fall|winter): winter
Anime found in 2023 winter Season: 
[1] JoJo no Kimyou na Bouken: Stone Ocean Part 3
[2] Oemojisangjuui
[3] Gokushufudou Season 2
[4] Nanatsu no Taizai: Ensa no Edinburgh
[5] Buta no Liver wa Kanetsu Shiro
[6] Summer Pockets
[7] Kami wa Game ni Ueteiru.
[8] Isekai Shoukan wa Nidome desu
[9] Be Forever Yamato: Rebel 3199
[10] Saihate no Paladin 2
[11] Saikyou Onmyouji no Isekai Tenseiki: Geboku no Youkaidomo ni Kurabete Monster ga Yowai Sugirundaga
[12] Kitarou Tanjou: Gegege no Nazo
[13] Fate/strange Fake: Whispers of Dawn
[14] Hiroshima Animation Season 2022 Trailer
[15] Moment of my life
[16] Lupin III VS Cat's Eye
[17] Mou Ippon!
[18] 4*Town: 1 True Love
[19] San Ti
[20] Bing Huo Mo Chu 2
[21] Kaguya-sama wa Kokurasetai: First Kiss wa Owaranai
[22] THE FIRST SLAM DUNK
[23] saikai
[24] HOLD IT DOWN
[25] TECHNOROID OVERMIND
[26] Koori Zokusei Danshi to Cool na Douryou Joshi
[27] Tsundere Akuyaku Reijou Liselotte to Jikkyou no Endo-kun to Kaisetsu no Kobayashi-san
[28] Dragon Age: Absolution
[29] Majutsushi Orphen Hagure Tabi: Urbanrama-hen
[30] Spy Kyoushitsu
[31] Tensei Oujo to Tensai Reijou no Mahou Kakumei
[32] REVENGER
[33] Nitian Xie Shen (2023)
[34] Estab-Life: Revengers Road
[35] THE iDOLM@STER Cinderella Girls: U149
[36] Kaminaki Sekai no Kamisama Katsudou
[37] Watashi no Shiawase na Kekkon
[38] Fate/kaleid liner Prisma☆Illya (Zoku-hen)
[39] Nijiyon
[40] Soukyuu no Fafner: Behind the Line
[41] Itou Junji: Maniac
[42] Tondemo Skill de Isekai Hourou Meshi
[43] NieR:Automata Ver 1.1a
[44] Betsu Sekai
[45] Pocket Monsters: Haruka Naru Aoi Sora
[46] Tsurune: Tsunagari no Issha
[47] hololive shuffle medley
[48] Maou Gakuin no Futekigousha: Shijou Saikyou no Maou no Shiso, Tensei shite Shison-tachi no Gakkou e Kayou 2nd Season
[49] Migi to Dali
[50] D4DJ All Mix
[51] Cardfight!! Vanguard: will+Dress Season 2
[52] Make My Day
[53] KJ File (Zoku-hen)
[54] Otonari no Tenshi-sama ni Itsunomanika Dame Ningen ni Sareteita Ken
[55] Kijin Gentoushou
[56] Mononogatari
[57] Ane Naru Mono
[58] Seirei Gensouki 2
[59] Nokemono-tachi no Yoru
[60] Kimi to Boku no Saigo no Senjou, Aruiwa Sekai ga Hajimaru Seisen Season 2
[61] Ayakashi Triangle
[62] TRIGUN STAMPEDE
[63] Kagami no Kojou
[64] Xingchen Bian: An Xing Jie Pian
[65] Fate/Grand Order: Fujimaru Ritsuka wa Wakaranai
[66] Fight Song
[67] Violet Evergarden: Recollections
[68] Shirayuki
[69] Kubo-san wa Mob wo Yurusanai
[70] Ooyukiumi no Kaina
[71] Boku to Roboco
[72] Vinland Saga Season 2
[73] Hyouken no Majutsushi ga Sekai wo Suberu
[74] Ningen Fushin no Boukensha-tachi ga Sekai wo Sukuu you desu
[75] Inu ni Nattara Suki na Hito ni Hirowareta
[76] GRIDMAN UNIVERSE
[77] Lv1 Maou to One Room Yuusha
[78] UniteUp
[79] BIRDIE WING: Golf Girls' Story Season 2
[80] Ijiranaide, Nagatoro-san 2nd Attack
[81] Hirano to Kagiura
[82] Kin no Kuni Mizu no Kuni
[83] Kaiko sareta Ankoku Heishi (30-dai) no Slow na Second Life
[84] Kyuuketsuki Sugu Shinu 2
[85] Eiyuu Kyoushitsu
[86] Kira Killer
[87] The Legend of Vox Machina Season 2
[88] Tokyo Revengers: Seiya Kessen-hen
[89] for Victory!
[90] Lee Shi Zhentan Shiwusuo
[91] Sasaki to Miyano Movie: Sotsugyou-hen
[92] Bungou Stray Dogs 4th Season
[93] Taste of Death
[94] Kyokou Suiri 2nd Season
[95] LUPIN ZERO
[96] Dungeon ni Deai wo Motomeru no wa Machigatteiru Darou ka IV: Fuka Shou Yakusai-hen
[97] Eiga no Osomatsu-san 2
[98] Kaitou Queen wa Circus ga Osuki
[99] Tonari no Youkai-san
[100] Alice Gear Aegis
[101] Isekai Nonbiri Nouka
[102] Ars no Kyojuu
[103] Hikari no Ou
[104] Akuma-kun
[105] Shuumatsu no Walküre Season 2
[106] Rougo ni Sonaete Isekai de 8-manmai no Kinka wo Tamemasu
[107] Shin Shinka no Mi: Shiranai Uchi ni Kachigumi Jinsei
[108] Puella Magi Madoka Magica the Movie -Walpurgisnacht: Rising
[109] Isekai One Turn Kill Nee-san: Ane Douhan no Isekai Seikatsu Hajimemashita
[110] Skip to Loafer
[111] Mahouka Koukou no Rettousei 3
[112] High Card
[113] Iiwake Bunny
[114] BLUE GIANT
[115] Lip-Sync
[116] Benriya Saitou san, Isekai ni Iku
[117] Pocket Monsters: Mezase Pokémon Master
[118] Wu Liuqi: Anying Suming
[119] Eiyuu-ou, Bu wo Kiwameru Tame Tenseisu: Soshite, Sekai Saikyou no Minarai Kishi♀
[120] Buddy Daddies
[121] Sonic Prime
[122] Jouya Repaint
[123] Wanted, Wasted
[124] Kami-tachi ni Hirowareta Otoko 2
[125] Itai no wa Iya nano de Bougyoryoku ni Kyokufuri Shitai to Omoimasu II
[126] Tomo-chan wa Onnanoko!
[127] Onii-chan wa Oshimai!
Selection: (e.g. 1, 1  3 or 1-3) 
>> 127 125 10
Trying all titles:

-- Onii-chan wa Oshimai! --
[1] Oniichan wa Oshimai!
[2] Oniichan wa Oshimai! (Uncensored)
Enter Number: 2
Last Episode you watched (put 0 to start at the beginning)  [1-1]
>> 0
Trying all titles:

-- Itai no wa Iya nano de Bougyoryoku ni Kyokufuri Shitai to Omoimasu II --
anipy-cli: error: no search results
[a] Add Anime
[e] Delete one anime from seasonals
[l] List animes in seasonals file
[d] Download newest episodes
[w] Binge watch newest episodes
[q] Quit
Enter option: d
Stuff to be downloaded:
Blue Lock:
Fumetsu no Anata e 2nd Season:
Isekai Ojisan:
Kage no Jitsuryokusha ni Naritakute!:
Oniichan wa Oshimai! (Uncensored):
==> EP: 1
Itai no wa Iya nano de Bougyoryoku ni Kyokufuri Shitai to Omoimasu. 2:
==> EP: 1
Saihate no Paladin 2nd Season:
Enter to continue or CTRL+C to abort.
Downloading newest urls for Blue Lock
Downloading newest urls for Fumetsu no Anata e 2nd Season
Downloading newest urls for Isekai Ojisan
Downloading newest urls for Kage no Jitsuryokusha ni Naritakute!
Downloading newest urls for Oniichan wa Oshimai! (Uncensored)
anipy-cli: error: quality not avalible, using default
--------------------
Downloading: Oniichan wa Oshimai! (Uncensored) EP: 1 - hls 
Type: m3u8
Downloader: internal
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 354/354
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 352/354
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 348/354
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 348/354
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 336/354
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 354/354
Parts Downloaded
Merging Parts using Movie.py...
Moviepy - Running:
>>> "+ " ".join(cmd)
Moviepy - Command successful
Merge finished.

Parts Merged
Downloading newest urls for Itai no wa Iya nano de Bougyoryoku ni Kyokufuri Shitai to Omoimasu. 2
anipy-cli: error: quality not avalible, using default
--------------------
Downloading: Itai no wa Iya nano de Bougyoryoku ni Kyokufuri Shitai to Omoimasu. 2 EP: 1 - hls 
Type: m3u8
Downloader: internal
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 310/310
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 307/310
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 299/310
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

Quality for Download: (1920, 1080) 

Downloading  Part: 299/310
Parts Downloaded
anipy-cli: error: Missing a download part, restarting download
Playlist Index: 0
Resolution at this index: (1920, 1080)

Playlist Index: 1
Resolution at this index: (1280, 720)

Playlist Index: 2
Resolution at this index: (854, 480)

Playlist Index: 3
Resolution at this index: (640, 360)

[a] Add Anime
[e] Delete one anime from seasonals
[l] List animes in seasonals file
[d] Download newest episodes
[w] Binge watch newest episodes
[q] Quit
Enter option: Traceback (most recent call last):
  File "./anipy_cli.py", line 14, in <module>
    main()
  File "./anipy_cli.py", line 8, in main
    cli.main()
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 692, in main
    seasonal_cli(args.quality, args.no_kitsu, args.ffmpeg, args.auto_update, player)
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 239, in seasonal_cli
    s.take_input()
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 258, in take_input
    picked = input(colors.END + "Enter option: ")
ValueError: I/O operation on closed file.

Platform

Additional context I think this started happening after the autorestart was implemented Also, this bug isn't really anything that major, as it simply crashes the program after the downloads are all complete. i would just select 'q' to exit the program anyway Just thought id let you know that it does crash for whatever reason

Quicksilver151 commented 1 year ago

also it does seem to be the case that its not downloading in the resolution i selected (720 selected, but downloads 1080; should i make a new issue for this?) but i think that has to do with the other issue about streamsb

sdaqo commented 1 year ago

It now downloads at the right resolution, thanks for pointing that out. As for the error you got, I'm sorry but I cant seem to able to reproduce it.

Quicksilver151 commented 1 year ago

It now downloads at the right resolution, thanks for pointing that out. As for the error you got, I'm sorry but I cant seem to able to reproduce it.

i did say that "I think this started happening after the autorestart was implemented" try manually deleting one of the part files and letting the atuto restart happen and then see if it crashes at the end

also thnx for fixing the resolution thing

sdaqo commented 1 year ago

i did say that "I think this started happening after the autorestart was implemented" try manually deleting one of the part files and letting the atuto restart happen and then see if it crashes at the end

Yes I did that. Works fine, I also tried it with the same Anime you had problems with, still no errors.
The only thing I can guess is that this is an error on your side. Since the error suggests that stdout (or stdin) was closed maybe you could try another terminal emulator? Really not sure if that makes any difference tho.

Quicksilver151 commented 1 year ago

it really is odd cause i just tried again and it still immediately crashes after the downloads are all completed well ill close this issue anyway cause its not much of a problem as the downloads do complete might as well consider the auto exit from the program a feature

edit: also just realized that this is issue 100 :D