revamped media scanner using custom built rust program, saving and getting progress capabilties, and more
This commit is contained in:
37
client.py
Normal file
37
client.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import requests
|
||||
import webbrowser
|
||||
|
||||
API_BASE_URL = "http://localhost:8000"
|
||||
|
||||
def list_movies():
|
||||
url = f"{API_BASE_URL}/movies"
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
except Exception as e:
|
||||
print(f"Error fetching movies: {e}")
|
||||
return []
|
||||
return response.json()
|
||||
|
||||
def main():
|
||||
movies = list_movies()
|
||||
if not movies:
|
||||
print("No movies found.")
|
||||
return
|
||||
|
||||
print("Available Movies:")
|
||||
for movie in movies:
|
||||
print(f"{movie['id']}: {movie.get('title', 'Unknown Title')}")
|
||||
|
||||
try:
|
||||
movie_id = int(input("Enter movie ID to stream: "))
|
||||
except ValueError:
|
||||
print("Invalid input. Please enter a numeric movie ID.")
|
||||
return
|
||||
|
||||
stream_url = f"{API_BASE_URL}/stream/{movie_id}"
|
||||
print(f"Opening stream for movie ID {movie_id}...")
|
||||
webbrowser.open(stream_url)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user