picast

package module
v0.0.0-...-5045279 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2014 License: Apache-2.0 Imports: 20 Imported by: 0

README

pi-cast

Broadcast Chrome browser window and video streams to RaspberryPi

Pi-cast 0.1 pre-alpha

The goal of this initial release is to make it simple and easy to seamlessly cast Youtube videos from your Chrome browser tab to a secondary display through a RaspberryPi on the local network. The backend core Python server apps are at 80% and the rest has yet to be implemented.

####Dependencies/Technologies:

  • Backend (rpi)
    • youtube-dl: for downloading/buffering videos to rpi sdcard
    • omxplayer: playing videos on rpi
    • Python 2.7: on-demand video player daemon (jobserver.py), database reader and video handler (client.py)
      • Pyro4: Interprocess communication between jobserver.py and client.py
      • python-daemon
    • sqlite3: playlist database
    • Go 1.0.2: HTTP listen server and database writer
  • Frontend (chrome)
    • Javascript: Chrome extension
      • famous-angular: MVC framework with the strength of Angular and the shine of Famo.us - generates our Views and communicates with our HTTP server via REST protocol
  • Future Frontend (Android/iOS)

####Pipe Dreams:

  • Encode realtime video stream of browser tab using ffmpeg-PNaCL in Chrome and cast it to rpi

Documentation

Index

Constants

View Source
const (
	STOPPED = 0
	LOADING = 1
	PAUSED  = 2
	PLAYING = 3
)

Variables

View Source
var (
	OmxProcess *exec.Cmd
)
View Source
var (
	SpotifyLogin spotify.Credentials
)

Functions

func RunServer

func RunServer(displayUpdates chan PlaylistEntry)

func YoutubeDl

func YoutubeDl(url string, result chan string)

Types

type Media

type Media struct {
	Metadata     *PlaylistEntry
	Player       MediaPlayer // Eventually change to anonymous interface
	MediaChanged chan bool
	MediaAdded   chan bool
	Playlist     []PlaylistEntry
	CurrentIndex int
}
var (
	MainMedia Media
)

func (*Media) Add

func (media *Media) Add(w rest.ResponseWriter, r *rest.Request)

func (*Media) GetPlaylist

func (media *Media) GetPlaylist(w rest.ResponseWriter, r *rest.Request)

func (*Media) Init

func (media *Media) Init()

func (*Media) Play

func (media *Media) Play(w rest.ResponseWriter, r *rest.Request)

func (*Media) PlayAll

func (media *Media) PlayAll()

func (*Media) Status

func (media *Media) Status(w rest.ResponseWriter, r *rest.Request)

func (*Media) StatusBuilder

func (media *Media) StatusBuilder() *ServerStatus

TODO: Needs cleanup

func (*Media) Stop

func (media *Media) Stop(w rest.ResponseWriter, r *rest.Request)

func (*Media) TogglePause

func (media *Media) TogglePause(w rest.ResponseWriter, r *rest.Request)

type MediaPlayer

type MediaPlayer interface {
	Play()
	TogglePause()
	Stop(int) // pass -1 if calling from external (non-MediaPlayer) method
	ReturnCode() int
	StatusCode() int // 0 = stopped, 1 = loading, 2 = paused, 3 = playing
}

type MyCorsMiddleware

type MyCorsMiddleware struct{}

func (*MyCorsMiddleware) MiddlewareFunc

func (mw *MyCorsMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc

type OmxPlayer

type OmxPlayer struct {
	Outfile string

	Status int

	Duration time.Duration
	Position time.Duration

	KillSwitch chan int // Signal to break out of WatchPosition and clear struct

}

func (*OmxPlayer) Play

func (video *OmxPlayer) Play()

func (*OmxPlayer) ReturnCode

func (video *OmxPlayer) ReturnCode() int

func (*OmxPlayer) StatusCode

func (video *OmxPlayer) StatusCode() int

func (*OmxPlayer) Stop

func (video *OmxPlayer) Stop(signal int)

Stop method can be called internally from WatchPosition with kill signal 1 on normal video end OR externally from Api or Media methods with kill signal -1

func (*OmxPlayer) TogglePause

func (video *OmxPlayer) TogglePause()

type PlaylistEntry

type PlaylistEntry struct {
	Title   string
	Artist  string
	Album   string
	ArtPath string
	Url     string
}

Matches database schema

type ServerObject

type ServerObject struct {
	Url  string
	Data interface{}
}

type ServerStatus

type ServerStatus struct {
	Server string
	Url    string
}

type SpotifyPlayer

type SpotifyPlayer struct {
	Outfile string

	Status int

	Duration time.Duration
	Position time.Duration

	KillSwitch chan int // Signal to break out of WatchPosition and clear struct

	ChangeTrack chan bool
	StopTrack   chan bool
	PauseTrack  chan bool
	ResumeTrack chan bool
}

func (*SpotifyPlayer) Play

func (spotty *SpotifyPlayer) Play()

func (*SpotifyPlayer) ReturnCode

func (spotty *SpotifyPlayer) ReturnCode() int

func (*SpotifyPlayer) SpotifyThread

func (spotty *SpotifyPlayer) SpotifyThread()

func (*SpotifyPlayer) StatusCode

func (spotty *SpotifyPlayer) StatusCode() int

func (*SpotifyPlayer) Stop

func (spotty *SpotifyPlayer) Stop(signal int)

func (*SpotifyPlayer) TogglePause

func (spotty *SpotifyPlayer) TogglePause()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL