watch-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
watch/__init__.py
ADDED
|
File without changes
|
watch/main.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import typer
|
|
3
|
+
import requests
|
|
4
|
+
import webbrowser
|
|
5
|
+
from urllib.parse import quote
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
from rich.progress import track
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def progress_bar():
|
|
13
|
+
total = 0
|
|
14
|
+
for value in track(range(100), description="Processing..."):
|
|
15
|
+
# Fake processing time
|
|
16
|
+
time.sleep(0.01)
|
|
17
|
+
total += 1
|
|
18
|
+
print(f"Processed {total}.")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_data(name):
|
|
23
|
+
url = f"https://v3.sg.media-imdb.com/suggestion/titles/x/{quote(name)}.json"
|
|
24
|
+
r = requests.get(url)
|
|
25
|
+
return r.json()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def open_web(name):
|
|
31
|
+
data = get_data(name)
|
|
32
|
+
if "d" in data and len(data["d"]) > 0:
|
|
33
|
+
first = data["d"][0]
|
|
34
|
+
imdb_id = first["id"]
|
|
35
|
+
webbrowser.open(f"https://www.playimdb.com/title/{imdb_id}")
|
|
36
|
+
else:
|
|
37
|
+
print("not found")
|
|
38
|
+
|
|
39
|
+
app = typer.Typer()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@app.command("tv")
|
|
43
|
+
def tv(
|
|
44
|
+
name: Annotated[str, typer.Argument(help="Enter the series name")],
|
|
45
|
+
season: Annotated[int, typer.Option("-s","--season",help="Select season")] = None,
|
|
46
|
+
episode: Annotated[int, typer.Option("-e","--episode",help="Select episode")] = None,):
|
|
47
|
+
|
|
48
|
+
progress_bar()
|
|
49
|
+
data = get_data(name)
|
|
50
|
+
imdb_id = data["d"][0]["id"]
|
|
51
|
+
if season and episode:
|
|
52
|
+
webbrowser.open(f"https://vaplayer.ru/embed/tv/{imdb_id}/S{season}E{episode}")
|
|
53
|
+
else:
|
|
54
|
+
webbrowser.open(f"https://vaplayer.ru/embed/tv/{imdb_id}")
|
|
55
|
+
|
|
56
|
+
@app.command("movie")
|
|
57
|
+
def movie( name: Annotated[str, typer.Argument(help="Enter the movie name")],):
|
|
58
|
+
progress_bar()
|
|
59
|
+
data = get_data(name)
|
|
60
|
+
imdb_id = data["d"][0]["id"]
|
|
61
|
+
webbrowser.open(f"https://vaplayer.ru/embed/movie/{imdb_id}")
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
app()
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
watch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
watch/main.py,sha256=XbuiqR-9tiLhuvcLG8n-xRKVJ8R543fc76BsQGiYGN0,1627
|
|
3
|
+
watch_cli-0.1.0.dist-info/METADATA,sha256=95pEai06djydPsoP31iled__hQrGbdTfak6n9vMkxOM,166
|
|
4
|
+
watch_cli-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
watch_cli-0.1.0.dist-info/entry_points.txt,sha256=J6nVw2oSnWu-R1kQVaE3zkvWNY_4Rk626H8na5gWIzE,41
|
|
6
|
+
watch_cli-0.1.0.dist-info/top_level.txt,sha256=fLBJKZZO_KHGHX4Wo5mwFBx4Pgq3jX9HEY7byjoLujY,6
|
|
7
|
+
watch_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
watch
|