Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b9e24c4ca6 | ||
![]() |
c6c5868cc2 | ||
![]() |
c105995d6d | ||
![]() |
d9dba801cf |
3 changed files with 22 additions and 71 deletions
5
LICENSE
5
LICENSE
|
@ -631,8 +631,9 @@ to attach them to the start of each source file to most effectively
|
||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
Raspberry Pi Media center
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
Copyright (C) 2020 Paul Malcher
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
19
README.md
19
README.md
|
@ -1,2 +1,21 @@
|
||||||
# rpimc
|
# rpimc
|
||||||
Raspberry PI Medial Center
|
Raspberry PI Medial Center
|
||||||
|
|
||||||
|
Designed to be used with a google chromecasts. Componets seperated into branches.
|
||||||
|
|
||||||
|
# Current Status as of 1/10/22
|
||||||
|
|
||||||
|
Allot of recent work on the Frontend. A large part due to having to update the code to a newer version of expo. Backend is ok for the most part a few items to do. See issues for a break down.
|
||||||
|
|
||||||
|
# Frontend Branch
|
||||||
|
A react native android application, acts as a remote control. This is built using
|
||||||
|
Expo.
|
||||||
|
|
||||||
|
# Backend Branch
|
||||||
|
A Python based web service and controller chromecasts
|
||||||
|
|
||||||
|
# Notes
|
||||||
|
Example for cloning the frontend
|
||||||
|
git clone -b frontend https://github.com/kake26/rpimc.git
|
||||||
|
|
||||||
|
Some values still hardcoded as its a work in progress. 1.0 Release will be soon.
|
||||||
|
|
69
csrv.py
69
csrv.py
|
@ -1,69 +0,0 @@
|
||||||
# Required Klein and Pychromecast modules
|
|
||||||
from twisted.web.static import File
|
|
||||||
from klein import run, route
|
|
||||||
from klein import Klein
|
|
||||||
import pychromecast
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
app = Klein()
|
|
||||||
|
|
||||||
chromecasts = pychromecast.get_chromecasts()
|
|
||||||
[cc.device.friendly_name for cc in chromecasts]
|
|
||||||
cast = next(cc for cc in chromecasts if cc.device.friendly_name == "living room") # You may need to change to your chromecast name for now
|
|
||||||
cast.wait()
|
|
||||||
print(cast.status) # Has display name and status text
|
|
||||||
mc = cast.media_controller
|
|
||||||
|
|
||||||
@route('/movies/', branch=True)
|
|
||||||
def static(request):
|
|
||||||
return File("./movies")
|
|
||||||
|
|
||||||
@route('/devices/')
|
|
||||||
def dlist(request):
|
|
||||||
|
|
||||||
return mc
|
|
||||||
|
|
||||||
@route('/play/<fn>')
|
|
||||||
def crun(request,fn):
|
|
||||||
mc.play_media('http://192.168.1.158:8080/movies/' + fn, 'video/mp4') # Update this IP to match yours
|
|
||||||
mc.block_until_active()
|
|
||||||
mc.pause()
|
|
||||||
time.sleep(2)
|
|
||||||
mc.play()
|
|
||||||
return 'Play'
|
|
||||||
|
|
||||||
@route('/pause/')
|
|
||||||
def cpause(request):
|
|
||||||
mc.pause()
|
|
||||||
return 'Pause'
|
|
||||||
|
|
||||||
@route('/resume/')
|
|
||||||
def cres(request):
|
|
||||||
mc.play()
|
|
||||||
return 'Resuming'
|
|
||||||
|
|
||||||
@route('/stop/')
|
|
||||||
def cstop(request):
|
|
||||||
mc.stop()
|
|
||||||
return 'STOP!!!'
|
|
||||||
|
|
||||||
@route('/list/')
|
|
||||||
def clist(request):
|
|
||||||
path = './movies'
|
|
||||||
files = os.listdir\
|
|
||||||
(path)
|
|
||||||
e = []
|
|
||||||
d = {'data' : e }
|
|
||||||
for x in range(len(files)):
|
|
||||||
#e.append("movie")
|
|
||||||
e.append(files[x])
|
|
||||||
return json.dumps(d)
|
|
||||||
|
|
||||||
@route('/')
|
|
||||||
def home(request):
|
|
||||||
return 'Welcome to the RPI Python based Chromecast Media Service! Please use the HTTP API!'
|
|
||||||
|
|
||||||
run("192.168.1.158", 8080) # Obviously you need to change that IP to your local one
|
|
Loading…
Add table
Add a link
Reference in a new issue