From d1aad70c4863518b9e5ede1ef86e92e4bfac6810 Mon Sep 17 00:00:00 2001 From: Benex254 Date: Wed, 21 Aug 2024 23:49:39 +0300 Subject: [PATCH] feat: add awesome completions to search command --- fastanime/__init__.py | 2 +- fastanime/cli/commands/anilist/search.py | 401 ++++++++++++++++++++++- pyproject.toml | 2 +- 3 files changed, 401 insertions(+), 4 deletions(-) diff --git a/fastanime/__init__.py b/fastanime/__init__.py index 51b4b6c..779f5b9 100644 --- a/fastanime/__init__.py +++ b/fastanime/__init__.py @@ -6,7 +6,7 @@ if sys.version_info < (3, 10): ) # noqa: F541 -__version__ = "v2.3.7" +__version__ = "v2.3.8" APP_NAME = "FastAnime" AUTHOR = "Benex254" diff --git a/fastanime/cli/commands/anilist/search.py b/fastanime/cli/commands/anilist/search.py index 5425605..1b322cb 100644 --- a/fastanime/cli/commands/anilist/search.py +++ b/fastanime/cli/commands/anilist/search.py @@ -2,6 +2,369 @@ import click from ...completion_functions import anime_titles_shell_complete +tags_available = { + "Cast": ["Polyamorous"], + "Cast / Main Cast": [ + "Anti-Hero", + "Elderly Protagonist", + "Ensemble Cast", + "Estranged Family", + "Female Protagonist", + "Male Protagonist", + "Primarily Adult Cast", + "Primarily Animal Cast", + "Primarily Child Cast", + "Primarily Female Cast", + "Primarily Male Cast", + "Primarily Teen Cast", + ], + "Cast / Traits": [ + "Age Regression", + "Agender", + "Aliens", + "Amnesia", + "Angels", + "Anthropomorphism", + "Aromantic", + "Arranged Marriage", + "Artificial Intelligence", + "Asexual", + "Butler", + "Centaur", + "Chimera", + "Chuunibyou", + "Clone", + "Cosplay", + "Cowboys", + "Crossdressing", + "Cyborg", + "Delinquents", + "Demons", + "Detective", + "Dinosaurs", + "Disability", + "Dissociative Identities", + "Dragons", + "Dullahan", + "Elf", + "Fairy", + "Femboy", + "Ghost", + "Goblin", + "Gods", + "Gyaru", + "Hikikomori", + "Homeless", + "Idol", + "Kemonomimi", + "Kuudere", + "Maids", + "Mermaid", + "Monster Boy", + "Monster Girl", + "Nekomimi", + "Ninja", + "Nudity", + "Nun", + "Office Lady", + "Oiran", + "Ojou-sama", + "Orphan", + "Pirates", + "Robots", + "Samurai", + "Shrine Maiden", + "Skeleton", + "Succubus", + "Tanned Skin", + "Teacher", + "Tomboy", + "Transgender", + "Tsundere", + "Twins", + "Vampire", + "Veterinarian", + "Vikings", + "Villainess", + "VTuber", + "Werewolf", + "Witch", + "Yandere", + "Zombie", + ], + "Demographic": ["Josei", "Kids", "Seinen", "Shoujo", "Shounen"], + "Setting": ["Matriarchy"], + "Setting / Scene": [ + "Bar", + "Boarding School", + "Circus", + "Coastal", + "College", + "Desert", + "Dungeon", + "Foreign", + "Inn", + "Konbini", + "Natural Disaster", + "Office", + "Outdoor", + "Prison", + "Restaurant", + "Rural", + "School", + "School Club", + "Snowscape", + "Urban", + "Work", + ], + "Setting / Time": [ + "Achronological Order", + "Anachronism", + "Ancient China", + "Dystopian", + "Historical", + "Time Skip", + ], + "Setting / Universe": [ + "Afterlife", + "Alternate Universe", + "Augmented Reality", + "Omegaverse", + "Post-Apocalyptic", + "Space", + "Urban Fantasy", + "Virtual World", + ], + "Technical": [ + "4-koma", + "Achromatic", + "Advertisement", + "Anthology", + "CGI", + "Episodic", + "Flash", + "Full CGI", + "Full Color", + "No Dialogue", + "Non-fiction", + "POV", + "Puppetry", + "Rotoscoping", + "Stop Motion", + ], + "Theme / Action": [ + "Archery", + "Battle Royale", + "Espionage", + "Fugitive", + "Guns", + "Martial Arts", + "Spearplay", + "Swordplay", + ], + "Theme / Arts": [ + "Acting", + "Calligraphy", + "Classic Literature", + "Drawing", + "Fashion", + "Food", + "Makeup", + "Photography", + "Rakugo", + "Writing", + ], + "Theme / Arts-Music": [ + "Band", + "Classical Music", + "Dancing", + "Hip-hop Music", + "Jazz Music", + "Metal Music", + "Musical Theater", + "Rock Music", + ], + "Theme / Comedy": ["Parody", "Satire", "Slapstick", "Surreal Comedy"], + "Theme / Drama": [ + "Bullying", + "Class Struggle", + "Coming of Age", + "Conspiracy", + "Eco-Horror", + "Fake Relationship", + "Kingdom Management", + "Rehabilitation", + "Revenge", + "Suicide", + "Tragedy", + ], + "Theme / Fantasy": [ + "Alchemy", + "Body Swapping", + "Cultivation", + "Fairy Tale", + "Henshin", + "Isekai", + "Kaiju", + "Magic", + "Mythology", + "Necromancy", + "Shapeshifting", + "Steampunk", + "Super Power", + "Superhero", + "Wuxia", + "Youkai", + ], + "Theme / Game": ["Board Game", "E-Sports", "Video Games"], + "Theme / Game-Card & Board Game": [ + "Card Battle", + "Go", + "Karuta", + "Mahjong", + "Poker", + "Shogi", + ], + "Theme / Game-Sport": [ + "Acrobatics", + "Airsoft", + "American Football", + "Athletics", + "Badminton", + "Baseball", + "Basketball", + "Bowling", + "Boxing", + "Cheerleading", + "Cycling", + "Fencing", + "Fishing", + "Fitness", + "Football", + "Golf", + "Handball", + "Ice Skating", + "Judo", + "Lacrosse", + "Parkour", + "Rugby", + "Scuba Diving", + "Skateboarding", + "Sumo", + "Surfing", + "Swimming", + "Table Tennis", + "Tennis", + "Volleyball", + "Wrestling", + ], + "Theme / Other": [ + "Adoption", + "Animals", + "Astronomy", + "Autobiographical", + "Biographical", + "Body Horror", + "Cannibalism", + "Chibi", + "Cosmic Horror", + "Crime", + "Crossover", + "Death Game", + "Denpa", + "Drugs", + "Economics", + "Educational", + "Environmental", + "Ero Guro", + "Filmmaking", + "Found Family", + "Gambling", + "Gender Bending", + "Gore", + "Language Barrier", + "LGBTQ+ Themes", + "Lost Civilization", + "Marriage", + "Medicine", + "Memory Manipulation", + "Meta", + "Mountaineering", + "Noir", + "Otaku Culture", + "Pandemic", + "Philosophy", + "Politics", + "Proxy Battle", + "Psychosexual", + "Reincarnation", + "Religion", + "Royal Affairs", + "Slavery", + "Software Development", + "Survival", + "Terrorism", + "Torture", + "Travel", + "War", + ], + "Theme / Other-Organisations": [ + "Assassins", + "Criminal Organization", + "Cult", + "Firefighters", + "Gangs", + "Mafia", + "Military", + "Police", + "Triads", + "Yakuza", + ], + "Theme / Other-Vehicle": [ + "Aviation", + "Cars", + "Mopeds", + "Motorcycles", + "Ships", + "Tanks", + "Trains", + ], + "Theme / Romance": [ + "Age Gap", + "Bisexual", + "Boys' Love", + "Female Harem", + "Heterosexual", + "Love Triangle", + "Male Harem", + "Matchmaking", + "Mixed Gender Harem", + "Teens' Love", + "Unrequited Love", + "Yuri", + ], + "Theme / Sci Fi": [ + "Cyberpunk", + "Space Opera", + "Time Loop", + "Time Manipulation", + "Tokusatsu", + ], + "Theme / Sci Fi-Mecha": ["Real Robot", "Super Robot"], + "Theme / Slice of Life": [ + "Agriculture", + "Cute Boys Doing Cute Things", + "Cute Girls Doing Cute Things", + "Family Life", + "Horticulture", + "Iyashikei", + "Parenthood", + ], +} +tags_available_list = [] +for tag_category, tags_in_category in tags_available.items(): + tags_available_list.extend(tags_in_category) + @click.command( help="Search for anime using anilists api and get top ~50 results", @@ -73,8 +436,42 @@ from ...completion_functions import anime_titles_shell_complete ] ), ) -@click.option("--genres", "-g", multiple=True, help="the genres to filter by") -@click.option("--tags", "-t", multiple=True, help="the tags to filter by") +@click.option( + "--genres", + "-g", + multiple=True, + help="the genres to filter by", + type=click.Choice( + [ + "Action", + "Adventure", + "Comedy", + "Drama", + "Ecchi", + "Fantasy", + "Horror", + "Mahou Shoujo", + "Mecha", + "Music", + "Mystery", + "Psychological", + "Romance", + "Sci-Fi", + "Slice of Life", + "Sports", + "Supernatural", + "Thriller", + "Hentai", + ] + ), +) +@click.option( + "--tags", + "-T", + multiple=True, + help="the tags to filter by", + type=click.Choice(tags_available_list), +) @click.option( "--media-format", "-f", diff --git a/pyproject.toml b/pyproject.toml index 9678166..2feb5c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fastanime" -version = "2.3.7" +version = "2.3.8" description = "A browser anime site experience from the terminal" authors = ["Benextempest "] license = "UNLICENSE"