From ccd0a6a3be8c3b4565c8dfc6ba33124c880727d1 Mon Sep 17 00:00:00 2001 From: redone Date: Mon, 24 Jan 2022 01:05:43 +0100 Subject: [PATCH] add the streaming features --- README.md | 6 +++++- main.py | 28 ++++++++++++++++++---------- setup.py | 11 +++++++++++ 3 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 setup.py diff --git a/README.md b/README.md index af3e324..c8f43a1 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# Torrent \ No newline at end of file +# IT_Streams +### Stream your favorite movies in your terminal + +## Installation: +... \ No newline at end of file diff --git a/main.py b/main.py index 1d2777c..89c9199 100644 --- a/main.py +++ b/main.py @@ -10,7 +10,7 @@ import requests from bs4 import BeautifulSoup from prettytable import PrettyTable -import pyperclip +import subprocess def get_titles(): @@ -30,6 +30,7 @@ def get_titles(): title.append(i) return title + def get_magnet_links(): '''this function search for the magnet links''' magnet = [] @@ -40,6 +41,7 @@ def get_magnet_links(): return magnet + search = input("What are you searching for? ").split(" ") search = "+".join(search) @@ -78,17 +80,23 @@ def selection(magnet): lenght = [item for item in range(len(magnet))] is_invalid = True - - # while is_invalid: - # number = input("Enter Your Choice: ") - # if number in lenght: - # is_invalid = False - # else: - # print("Please enter a valid choice") + # TODO: add a check if the number is valid or not number = int(input("Enter Your Choice: ")) return magnet[number] -pyperclip.copy(selection(magnet)) -spam = pyperclip.paste() \ No newline at end of file +def stream(magnet): + # TODO: add the ability to check if a vlc or other video player exist + # supported player + # DNLA + # MPlayer + # MPV + # OMX + # VLC + # IINA + # SMPlayer + # XBMC + subprocess.run(["webtorrent", magnet, "--mpv"]) + +stream(selection(magnet)) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..be88da7 --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +# TODO: configure the setup script + +import setuptools + +setuptools.setup( + name='itstreams', + version='0.1', + install_requires=["requests", "BeautifulSoup4", "prettytable", "subprocess"], + scripts=['itstreams'] +) +