All Projects → jrudio → Go Plex Client

jrudio / Go Plex Client

A Plex.tv and Plex Media Server Go client

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Plex Client

Arch Plex
Docker build script for Arch Linux base with Plex Media Server
Stars: ✭ 10 (-88.24%)
Mutual labels:  plex, media-server
arch-plexpass
Docker build script for Arch Linux base with Plex Pass Media Server installed
Stars: ✭ 21 (-75.29%)
Mutual labels:  plex, media-server
Docker Compose Usenet
Docker-powered usenet pipeline
Stars: ✭ 240 (+182.35%)
Mutual labels:  plex, media-server
Ppp
Sync music playlists between your local music library and Plex!
Stars: ✭ 57 (-32.94%)
Mutual labels:  plex, media-server
Tooloop Os
Tooloop OS is a minimal installation of Ubuntu Server with some post-install customization to fit the needs of public multimedia installations.
Stars: ✭ 44 (-48.24%)
Mutual labels:  media-server
Rtsp Simple Server
ready-to-use RTSP / RTMP server and proxy that allows to read, publish and proxy video and audio streams
Stars: ✭ 882 (+937.65%)
Mutual labels:  media-server
Media Server
WebRTC Media Server
Stars: ✭ 821 (+865.88%)
Mutual labels:  media-server
Iptv.bundle
Plex plug-in that plays live streams (like IPTV) from a M3U playlist
Stars: ✭ 739 (+769.41%)
Mutual labels:  plex
Streama
Self hosted streaming media server. https://docs.streama-project.com/
Stars: ✭ 8,948 (+10427.06%)
Mutual labels:  media-server
Nowshowing
Generates an email and web page of Plex recently added content
Stars: ✭ 70 (-17.65%)
Mutual labels:  plex
Sonarrplex
📡 View and manage your shows in Sonarr directly in the Plex app
Stars: ✭ 39 (-54.12%)
Mutual labels:  plex
Flox
Self Hosted Movie, Series and Anime Watch List
Stars: ✭ 901 (+960%)
Mutual labels:  plex
Traileraddict.bundle
Stars: ✭ 44 (-48.24%)
Mutual labels:  plex
Varken
Standalone application to aggregate data from the Plex ecosystem into InfluxDB using Grafana for a frontend
Stars: ✭ 829 (+875.29%)
Mutual labels:  plex
Plexus
A suite of tools to help manage your media collection.
Stars: ✭ 78 (-8.24%)
Mutual labels:  plex
Hama.bundle
Plex HTTP Anidb Metadata Agent (HAMA)
Stars: ✭ 740 (+770.59%)
Mutual labels:  plex
Porthole
A window into the status of multiple services related to Plex Media Server (Plex, Couchpotato, Sickrage, Deluge, Sabnzbd+, etc.).
Stars: ✭ 30 (-64.71%)
Mutual labels:  plex
Organizr Plex Theme
🎨 A theme for Organizr that emulates the style of Plex
Stars: ✭ 62 (-27.06%)
Mutual labels:  plex
Navidrome
🎧☁️ Modern Music Server and Streamer compatible with Subsonic/Airsonic
Stars: ✭ 932 (+996.47%)
Mutual labels:  media-server
Muximux
A lightweight way to manage your HTPC
Stars: ✭ 1,008 (+1085.88%)
Mutual labels:  plex

Plex.tv and Plex Media Server client written in Go

godoc

go get -u github.com/jrudio/go-plex-client

Cli

You can tinker with this library using the command-line over here

Usage

plexConnection, err := plex.New("http://192.168.1.2:32400", "myPlexToken")

// Test your connection to your Plex server
result, err := plexConnection.Test()

// Search for media in your plex server
results, err := plexConnection.Search("The Walking Dead")

// Webhook handler to easily handle events on your server
	wh := plex.NewWebhook()

	wh.OnPlay(func(w plex.Webhook) {
		fmt.Printf("%s is playing\n", w.Metadata.Title)
	})

	wh.OnPause(func(w plex.Webhook) {
		fmt.Printf("%s is paused\n", w.Metadata.Title)
	})

	wh.OnResume(func(w plex.Webhook) {
		fmt.Printf("%s has resumed\n", w.Metadata.Title)
	})

	wh.OnStop(func(w plex.Webhook) {
		fmt.Printf("%s has stopped\n", w.Metadata.Title)
	})

	http.HandleFunc("/", wh.Handler)

	http.ListenAndServe("192.168.1.14:8080", nil)

// connect to your server via websockets to listen for events

ctrlC := make(chan os.Signal, 1)
onError := func(err error) {
	fmt.Println(err)
}

events := plex.NewNotificationEvents()
events.OnPlaying(func(n NotificationContainer) {
	mediaID := n.PlaySessionStateNotification[0].RatingKey
	sessionID := n.PlaySessionStateNotification[0].SessionKey
	var title

	sessions, err := plexConnection.GetSessions()

	if err != nil {
		fmt.Printf("failed to fetch sessions on plex server: %v\n", err)
		return
	}

	for _, session := range sessions.MediaContainer.Video {
		if sessionID != session.SessionKey {
			continue
		}

		userID = session.User.ID
		username = session.User.Title

		break
	}

	metadata, err := plexConnection.GetMetadata(mediaID)

	if err != nil {
		fmt.Printf("failed to get metadata for key %s: %v\n", mediaID, err)
	} else {
		title = metadata.MediaContainer.Metadata[0].Title
	}

	fmt.Printf("user (id: %s) has started playing %s (id: %s) %s\n", username, userID, title, mediaID)
})

plexConnection.SubscribeToNotifications(events, ctrlC, onError)

// ... and more! Please checkout plex.go for more methods
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].