Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoSa-2000 committed Apr 28, 2023
1 parent ef8c6ab commit 8f97982
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 101 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# anime-gifs.py
Get random anime gifs by category. Use Python (intended initially for Discord).

WIP - updated frequently. v0.2.1 doesn't work anymore.
WIP - updated in time to time. v0.4.0 is the only working release.

`pip install animegifs`

# HOW TO USE

```py
from animegifs import animegifs

gifs = animegifs.Animegifs
from animegifs.animegifs import Animegifs

gif = gifs(category)
gif = gif.get_gif()
gif = Animegifs().get_gif(category)
```

**Category list:**
Expand Down Expand Up @@ -41,5 +39,6 @@ gif = gif.get_gif()
* Insult
* Kill
* Kiss
* Lick

WIP.
1 change: 0 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__all__ = ['animegifs']
3 changes: 0 additions & 3 deletions animegifs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
__all__ = ['animegifs', 'dis_utils']


144 changes: 56 additions & 88 deletions animegifs/animegifs.py
Original file line number Diff line number Diff line change
@@ -1,96 +1,64 @@
import random
import json
from urllib.request import urlopen

def access():
url = 'https://github.com/MarcoSa-2000/marcosa-2000.github.io/raw/main/utils/animegifs_project/gifs.json'
response = urlopen(url)
data = json.loads(response.read())

attack = data['attack'] #0
bite = data['bite'] #1
bloodsuck = data['bloodsuck'] #2
blush = data['blush'] #3
bonk = data['bonk'] #4
brofist = data['brofist'] #5
cry = data['cry'] #6
cuddle = data['cuddle'] #7
dance = data['dance'] #8
disgust = data['disgust'] #9
facedesk = data['facedesk'] #10
facepalm = data['facepalm'] #11
flick = data['flick'] #12
flirt = data['flirt'] #13
handhold = data['handhold'] #14
happy = data['happy'] # 15
harass = data['harass'] # 16
highfive = data['highfive'] # 17
hug = data['hug'] # 18
icecream = data['icecream'] # 19
insult = data['insult'] # 20
kill = data['kill'] # 21
kiss = data['kiss'] # 22

del data

return attack, bite, bloodsuck, blush, bonk, brofist, cry, cuddle, dance, disgust, facedesk, facepalm, flick, \
flirt, handhold, happy, harass, highfive, hug, icecream, insult, kill, kiss
from animegifs.dis_utils import gifs

class Animegifs():

def __init__(self, category=None):
def __init__(self):
self.category = None

def get_gif(self, category=None):
if category is None:
raise Exception("No category has been specified.")
else:
self.category = category

def get_gif(self):
if self.category == 'attack' or self.category == 'attacc':
gif = random.choice(access()[0])
elif self.category == 'bite':
gif = random.choice(access()[1])
elif self.category == 'bloodsuck':
gif = random.choice(access()[2])
elif self.category == 'blush':
gif = random.choice(access()[3])
elif self.category == 'bonk':
gif = random.choice(access()[4])
elif self.category == 'brofist':
gif = random.choice(access()[5])
elif self.category == 'cry':
gif = random.choice(access()[6])
elif self.category == 'cuddle':
gif = random.choice(access()[7])
elif self.category == 'dance':
gif = random.choice(access()[8])
elif self.category == 'disgust':
gif = random.choice(access()[9])
elif self.category == 'facedesk':
gif = random.choice(access()[10])
elif self.category == 'facepalm':
gif = random.choice(access()[11])
elif self.category == 'flick':
gif = random.choice(access()[12])
elif self.category == 'flirt':
gif = random.choice(access()[13])
elif self.category == 'handhold':
gif = random.choice(access()[14])
elif self.category == 'happy':
gif = random.choice(access()[15])
elif self.category == 'harass':
gif = random.choice(access()[16])
elif self.category == 'highfive':
gif = random.choice(access()[17])
elif self.category == 'hug':
gif = random.choice(access()[18])
elif self.category == 'icecream':
gif = random.choice(access()[19])
elif self.category == 'insult':
gif = random.choice(access()[20])
elif self.category == 'kill':
gif = random.choice(access()[21])
elif self.category == 'kiss':
gif = random.choice(access()[22])
else:
raise Exception("Not a valid category.")
if category == 'attack' or category == 'attacc':
gif = random.choice(gifs.access()[0])
elif category == 'bite':
gif = random.choice(gifs.access()[1])
elif category == 'bloodsuck':
gif = random.choice(gifs.access()[2])
elif category == 'blush':
gif = random.choice(gifs.access()[3])
elif category == 'bonk':
gif = random.choice(gifs.access()[4])
elif category == 'brofist':
gif = random.choice(gifs.access()[5])
elif category == 'cry':
gif = random.choice(gifs.access()[6])
elif category == 'cuddle':
gif = random.choice(gifs.access()[7])
elif category == 'dance':
gif = random.choice(gifs.access()[8])
elif category == 'disgust':
gif = random.choice(gifs.access()[9])
elif category == 'facedesk':
gif = random.choice(gifs.access()[10])
elif category == 'facepalm':
gif = random.choice(gifs.access()[11])
elif category == 'flick':
gif = random.choice(gifs.access()[12])
elif category == 'flirt':
gif = random.choice(gifs.access()[13])
elif category == 'handhold':
gif = random.choice(gifs.access()[14])
elif category == 'happy':
gif = random.choice(gifs.access()[15])
elif category == 'harass':
gif = random.choice(gifs.access()[16])
elif category == 'highfive':
gif = random.choice(gifs.access()[17])
elif category == 'hug':
gif = random.choice(gifs.access()[18])
elif category == 'icecream':
gif = random.choice(gifs.access()[19])
elif category == 'insult':
gif = random.choice(gifs.access()[20])
elif category == 'kill':
gif = random.choice(gifs.access()[21])
elif category == 'kiss':
gif = random.choice(gifs.access()[22])
elif category == 'lick':
gif = random.choice(gifs.access()[23])
else:
raise Exception("Not a valid category. You can check valid categories at: https://github.com/MarcoSa-2000/animegifs")
return gif

3 changes: 1 addition & 2 deletions animegifs/dis_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# __init__.py
__all__ = ['infoes.py']

38 changes: 38 additions & 0 deletions animegifs/dis_utils/gifs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import json
import requests

def access():
data = requests.get("https://objectstorage.eu-frankfurt-1.oraclecloud.com/p/zDPowf1lXXMMpXzo_Lnb31IOtUyxrtD-kDS7fpKxLuCYnR5xr-171Tyz0tW0EhKV/n/frqs54dqeajn/b/animegifs_lib/o/gifs.json").content
data = json.loads(data)

attack = data['attack'] #0
bite = data['bite'] #1
bloodsuck = data['bloodsuck'] #2
blush = data['blush'] #3
bonk = data['bonk'] #4
brofist = data['brofist'] #5
cry = data['cry'] #6
cuddle = data['cuddle'] #7
dance = data['dance'] #8
disgust = data['disgust'] #9
facedesk = data['facedesk'] #10
facepalm = data['facepalm'] #11
flick = data['flick'] #12
flirt = data['flirt'] #13
handhold = data['handhold'] #14
happy = data['happy'] # 15
harass = data['harass'] # 16
highfive = data['highfive'] # 17
hug = data['hug'] # 18
icecream = data['icecream'] # 19
insult = data['insult'] # 20
kill = data['kill'] # 21
kiss = data['kiss'] # 22
lick = data['lick'] # 23

del data

return attack, bite, bloodsuck, blush, bonk, brofist, cry, cuddle, dance, disgust, facedesk, facepalm, flick, \
flirt, handhold, happy, harass, highfive, hug, icecream, insult, kill, kiss, lick


1 change: 0 additions & 1 deletion animegifs/dis_utils/infoes.py

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.28.2,<=2.29.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
long_description = "\n" + fh.read()

LONG_DESCRIPTION = long_description
VERSION = '0.3.4'
VERSION = '0.4.0'

setup(
name='animegifs',
Expand Down

0 comments on commit 8f97982

Please sign in to comment.