Skip to content

Plex support for Maraschino #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 113 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
0ee8403
Interface preparation for Plex support
elsingaa Jun 22, 2012
4f01568
Refactoring: renamed XbmcServer class to MediaServer class
elsingaa Jun 22, 2012
024a258
Added media player type to database model
elsingaa Jun 22, 2012
6511713
Description change for media library
elsingaa Jun 22, 2012
7b7ee26
Show media player type in server menu
elsingaa Jun 22, 2012
3f4cc4b
Saving and loading server type added
elsingaa Jun 22, 2012
2f38e15
Added server_type function
elsingaa Jun 22, 2012
9d2295f
Error message shows media server type
elsingaa Jun 22, 2012
e8ffa1d
Error messages changed for Plex support
elsingaa Jun 22, 2012
7e9091f
Revert "Refactoring: renamed XbmcServer class to MediaServer class"
elsingaa Jun 23, 2012
9501cf5
first steps on Plex library
elsingaa Jun 23, 2012
d884ad3
Renamed xbmc_notify to notify to prepare for other players like Plex
elsingaa Jun 23, 2012
602a9ce
removed xbmc_notify_dialog.html
elsingaa Jun 23, 2012
1bcbc4b
Added missing __init for plex library
elsingaa Jun 23, 2012
2ef5581
Replace xbmc with media player in comments
elsingaa Jun 23, 2012
9e4264c
Added ElementTree as library to plexclient for reading XML
elsingaa Jun 24, 2012
089fd4e
Added getclient to plexclient
elsingaa Jun 24, 2012
696f079
Added small demo program to plexclient library
elsingaa Jun 24, 2012
fa055ba
Added parameters for movie library and tv library to class initializa…
elsingaa Jun 24, 2012
9cccda7
Added getrecentlyaddedepisodes to plea library
elsingaa Jun 24, 2012
ee20d80
Cleanup plex client
elsingaa Jun 24, 2012
4cdeb3b
:@ was always placed on server_address, even if a username or passwor…
elsingaa Jun 24, 2012
0bc9aec
updated plex demo file
elsingaa Jun 24, 2012
d759383
changed plex library init to use http://server:port as parameter
elsingaa Jun 24, 2012
cd6acb6
Basic functionality with recently_added for plex
N3MIS15 Jun 23, 2012
734bb9e
Merge remote-tracking branch 'origin/master' into plexdev
elsingaa Jun 25, 2012
75549c5
Fixed images for Plex
elsingaa Jun 26, 2012
9086c9b
Added Plex logo for applications & server menu
elsingaa Jun 26, 2012
4163b22
Added XBMC and Plex logo's as style for server menu
elsingaa Jun 26, 2012
3041a51
Changed caption on XBMC and PLEX CSS parameters
elsingaa Jun 26, 2012
11cbcc6
More preparations for showing icons in server menu
elsingaa Jun 26, 2012
08b237f
corrected menu images Plex and XBMC
elsingaa Jun 26, 2012
14694d2
showing XBMC and Plex icons in menu
elsingaa Jun 26, 2012
a6c8bac
Total episode fix for Plex support
elsingaa Jun 26, 2012
7e5897c
Added Plex Library ID's to recently added settings.
elsingaa Jun 27, 2012
bc76a4e
Merge commit 'f54ea2da5a44a5410497804246824a80c0514727' into plexdev
elsingaa Jun 27, 2012
94db816
Moved the Plex Library IDs to the correct location in modules.py
elsingaa Jun 27, 2012
30852cb
Added recently added movies for Plex
elsingaa Jun 27, 2012
4a0fc38
Removed excess { from modules.py
elsingaa Jun 27, 2012
e5a9974
Changed Plex client library and demo
elsingaa Jun 27, 2012
2580a3a
added recently added music to plexclient
elsingaa Jun 27, 2012
cba866d
Added Plex recently added album support
elsingaa Jun 27, 2012
06e6e9b
Merge remote-tracking branch 'upstream/master' into plexdev
elsingaa Jun 30, 2012
4ddb4dc
Fix for Plex recently added albums
elsingaa Jun 30, 2012
71141cf
FIX: Plex TV lib and MovieLib weren't read from the database.
elsingaa Jun 30, 2012
3f65905
Updated demo program for Plex library
elsingaa Jun 30, 2012
d880cb0
Revert "Updated demo program for Plex library"
elsingaa Jun 30, 2012
a74b294
FIX: Recently added series and movies for Plex obey watched/unwatched…
elsingaa Jun 30, 2012
07db609
Added console menu for Plex library demo
elsingaa Jun 30, 2012
79c9927
Merge branch 'plexdev'
elsingaa Jun 30, 2012
0fdcc8c
Removed clutter from recently_added
elsingaa Jun 30, 2012
183f8c4
Changed some little things on recently_added albums for Plex
elsingaa Jun 30, 2012
71eeb12
Merge remote-tracking branch 'origin/master' into plexdev
elsingaa Jun 30, 2012
3c4f9e8
Added notify for Plex clients
elsingaa Jul 1, 2012
d5ad124
Code cleanup Plex recently_playing integration
elsingaa Jul 5, 2012
f1f415e
created unified command url for XBMC related commands with Plex
elsingaa Jul 6, 2012
7bb4b5e
Switched to (internal) xml.etree instead of (external) ElementTree
elsingaa Jul 7, 2012
aea69a6
Added rudimentary currently playing for Plex clients
elsingaa Jul 7, 2012
86bb9e7
moved str2int out of class boundary
elsingaa Jul 7, 2012
12a031b
Added currently_playing for all clients in Plex library
elsingaa Jul 7, 2012
567add3
Merge remote-tracking branch 'upstream/master' into plexdev
elsingaa Jul 8, 2012
b3be941
Playing bar didn't show when on pause with Plex
elsingaa Jul 8, 2012
11d09fc
Don't show volume contral on Plex servers
elsingaa Jul 8, 2012
cb12701
Added functionality for controls currently playing for Plex
elsingaa Jul 8, 2012
04d2d39
Removed the need for namedTuples in Plex library
elsingaa Jul 9, 2012
592cb22
Added volume control to Plex library
elsingaa Jul 12, 2012
53b5f95
Added volume control to Currently Playing with Plex
elsingaa Jul 12, 2012
05da483
Merge branch 'feature/plexvolume' into plexdev
elsingaa Jul 12, 2012
5e4b575
Added seekPercentage to Plex library
elsingaa Jul 13, 2012
084cc56
Added seek to currently playing for Plex
elsingaa Jul 13, 2012
df5c5ed
episode ID added to Plex library for TV series
elsingaa Jul 14, 2012
8562e4a
Added playFile to Plex library
elsingaa Jul 15, 2012
ef84f92
Added Play on click for episodes to Plex
elsingaa Jul 15, 2012
8a544b0
Merge branch 'feature/playonclick' into plexdev
elsingaa Jul 15, 2012
9537b8c
Merge branch 'master' of git://github.com/mrkipling/maraschino into p…
elsingaa Jul 15, 2012
675fafd
correct library ID was not used for Plex with play on click
elsingaa Jul 15, 2012
9198b9c
updated playfile with movie for Plex
elsingaa Jul 15, 2012
71329f2
Added click on play for movies to Plex.
elsingaa Jul 15, 2012
eaa5811
Merge branch 'feature/clickonplaymovie' into plexdev
elsingaa Jul 15, 2012
370e718
Merge branch 'master' of git://github.com/mrkipling/maraschino into p…
elsingaa Jul 16, 2012
48b63a1
Merge branch 'master' of git://github.com/mrkipling/maraschino into p…
elsingaa Jul 17, 2012
efdd2ea
Merge branch 'master' of git://github.com/mrkipling/maraschino into p…
elsingaa Jul 18, 2012
e9f85ff
Merge commit '407946e444706fed0e27dc93d66f9523b5ce1315' into plexdev
bob3695 Jan 17, 2013
e1e8e6f
Removing unneeded files and getting recently added movies and recentl…
bob3695 Jan 18, 2013
f695b08
Fixing a issue with caching that made it so images were never picked …
bob3695 Jan 18, 2013
6c02b9b
Updating my gitignore
bob3695 Jan 18, 2013
8eca7cb
xbmc_notify now works with XBMC and Plex!
bob3695 Jan 18, 2013
09e2635
A little bit of work on currently playing
bob3695 Jan 18, 2013
fb381f5
Fixing missing code for recent Albums for Plex
bob3695 Jan 18, 2013
acfcf9c
Another fix to the album issue
bob3695 Jan 18, 2013
d1e6ff0
Renaming XBMC server to Media server to better show that this is no l…
bob3695 Jan 18, 2013
e0d456f
Starting work on the library module to be able to pull Plex media
bob3695 Jan 18, 2013
b95a230
Removed some debug code and made it so 'Hide watched TV Shows' works …
bob3695 Jan 18, 2013
8c12f83
Can now view tv shows down to the episode
bob3695 Jan 18, 2013
4236f66
Fixed the missing param for 'first aired' for tv shows episodes in th…
bob3695 Jan 18, 2013
dcbae92
The start of Movies working for Plex in the library
bob3695 Jan 18, 2013
ba25e82
TV show info, Episode Info, and Movie info work
bob3695 Jan 19, 2013
c97f74d
Fixed play file function so you can start media in plex client from i…
bob3695 Jan 19, 2013
58abdb7
Blanket bypassing library resume check for now for Plex - this needs …
bob3695 Jan 19, 2013
8774304
General code cleanup
bob3695 Jan 19, 2013
93cc3b2
Renaming Mediaplayer to the more correct name of mediaserver
bob3695 Jan 19, 2013
bbc76c0
A little bit more work on Music for Library
bob3695 Jan 19, 2013
8284ffb
More work on the music side of the library
bob3695 Jan 19, 2013
0c5a710
Update system to use the new table for the Media Server. This does no…
bob3695 Jan 19, 2013
5c10037
Switching MediaServer setup to a pickle type to allow for further exp…
bob3695 Jan 20, 2013
15eb90b
A fix to the issue of not being able to create a new server.
bob3695 Jan 20, 2013
c7da31b
Updated the comment to reflect what the code was actually doing
bob3695 Jan 20, 2013
2500487
General cleanup of PlexLibrary code
bob3695 Jan 20, 2013
0f62f76
Fixing some renaming issues and some test code that I left in there
bob3695 Jan 22, 2013
4d8a3d8
Upgrade database code to bring the pre-plex databases up to the post …
bob3695 Jan 22, 2013
076e6d9
A fix for the xbmc_image function stoping everything if for any reaso…
bob3695 Jan 24, 2013
4bbc4d9
Incrementing Version
bob3695 Jan 25, 2013
5354ca9
Merge commit 'f92b6c94b8145c2a21e1e42ea76b0a3f7266cd98' into Plex-Dev
bob3695 Feb 4, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ ehthumbs.db
Thumbs.db
.directory
*~
*.sublime-workspace
*.sublime-project
2 changes: 2 additions & 0 deletions Maraschino.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def main():
import_modules()
maraschino.init_updater()

maraschino.plex_database_upgrade_check()

maraschino.start()


Expand Down
Empty file added lib/plex/__init__.py
Empty file.
202 changes: 202 additions & 0 deletions lib/plex/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
import os
from plexclient import PLEXClient, PLEXLibrary
'''
@author: Anne Jan Elsinga
This scripts serves as a demo for what the plex client library can do.
'''

PlexServer=""
PlexPort=""
TVSection=""
MovieSection=""
AlbumSection=""
NumOfItems=3
mediaplayer=object

def clear_screen():
os.system( [ 'clear', 'cls' ][ os.name == 'nt' ] )

def print_menu():
clear_screen()
print "PLEXLibrary Demo"
print "================="
print
print
print_current_config()
print
print "1. Set connection info"

if hasattr(mediaplayer,'server'):
print "2. Show recently added movies"
print "3. Show recently added episodes"
print "4. Show recently added albums"
print "5. Show currently playing (info)"
print "6. show connected clients"
print "7. Send message to all connected clients"
print "8. Play default client"
print "9. Show currently playing clients"
print "10.Show volume on all players"
print "11.Set volume on all players"
print
print "q. quit"
print

def print_current_config():
print "Current config:"
print " - Plex server: ", PlexServer
print " - Plex Port: ", PlexPort
print " - Movies Library ID: ", MovieSection
print " - Series Library ID: ", TVSection
print " - Albums Library ID: ", AlbumSection
print " - show num of items: ", NumOfItems


def get_connection_info():
global PlexServer
global PlexPort
global TVSection
global MovieSection
global AlbumSection
global actions
global NumOfItems

print
print "Enter configuration info"
print "========================"
PlexServer=raw_input("Enter Plex Server (name or IP address):")
PlexPort=raw_input("enter port: ")
MovieSection=raw_input ("Enter the library ID for your movies: ")
TVSection=raw_input ("Enter the library ID for your series: ")
AlbumSection=raw_input ("Enter the library ID for your albums: ")
NumOfItems=str2num(raw_input("Enter number of items to show: "))
create_connection_object()


def str2num (string):
try:
i = int(string)
except ValueError:
i = 0
return i

def create_connection_object():
global mediaplayer

plexconnectionstring="http://"+PlexServer+":"+PlexPort
mediaplayer = PLEXLibrary(plexconnectionstring,MovieLibID=MovieSection, TVLibID=TVSection, MusicLibID=AlbumSection)

def no_such_action():
print "Chosen option invalid. Please try again"

def wait_for_enter():
raw_input("Press Enter to continue...")

def maxnum (item,itemstoshow):
if len(item)<itemstoshow:
x=len(item)
else:
x=NumOfItems
return x

def showrecentlyaddedmovies():
AllMovies=mediaplayer.getRecentlyAddedMovies()
for x in range (0,maxnum(AllMovies,NumOfItems)):
showmovie(AllMovies[x])
wait_for_enter()

def showrecentlyaddedseries():
AllSeries=mediaplayer.getRecentlyAddedEpisodes()
for x in range (0,maxnum(AllSeries,NumOfItems)):
showseries(AllSeries[x])
wait_for_enter()

def showrecentlyaddedalbums():
AllAlbums=mediaplayer.getRecentlyAddedAlbums()
for x in range (0,maxnum(AllAlbums,NumOfItems)):
showalbums(AllAlbums[x])
wait_for_enter()

def showrecentlyairedseries():
AllSeries=mediaplayer.recentlyAiredTV()
for x in range (0,maxnum(AllSeries,NumOfItems)):
showseries(AllSeries[x])
wait_for_enter()

def doe_wat():
mediaplayer.doAction ('192.168.1.102', 'playback/pause')
#possible commands under playback: play, pause, stop, rewind, fastForward, stepForward
#bigStepForward, stepBack, bigStepBack, skipNext, skipPrevious
wait_for_enter()

def showcurrentlyplaying():
allPlaying,playerinfo=mediaplayer.currentlyPlaying()
print allPlaying,playerinfo
wait_for_enter()

def showplayingclients():
print mediaplayer.activePlayers()
wait_for_enter()

def getvolume():
for connectedclient in mediaplayer.getClients():
client=PLEXClient(connectedclient['host'],connectedclient['port'])
print "Volume is: " + client.getVolume()
wait_for_enter()

def setvolume():
volume=raw_input('Enter volume for all clients (0-100):')
for connectedclient in mediaplayer.getClients():
client=PLEXClient(connectedclient['host'],connectedclient['port'])
client.setVolume(volume)
wait_for_enter()

def showconnectedclients():
for client in mediaplayer.getClients():
print "address: "+ client['address']
print "unique ID: "+client['uniqueid']
print "version: " + client['version']
print "client name: " +client['name']
print "client hostname: " +client['host']
wait_for_enter()

def sendmessagetoallclients():
MessageTitle=raw_input("Enter a title for the message:")
MessageText=raw_input("Enter a message:")
for connectedclient in mediaplayer.getClients():
client=PLEXClient(connectedclient['host'],connectedclient['port'])
client.sendmessage(MessageTitle+","+MessageText)
wait_for_enter()

def buildmenu():
global actions
while True:
print_menu()
selection = raw_input("Your selection: ")
if "q" == selection:
return
toDo = actions.get(selection, no_such_action)
toDo()

def asciiprint (item):
print item.encode('ascii','ignore')

def showmovie(movie):
asciiprint ("Movie title: " + movie.title)
print ('-' * 80)

def showseries(series):
asciiprint ("Series title: " + series.showtitle)
asciiprint ("episode: " + str(series.season) + "x" + str(series.episode) + " " +series.title)
asciiprint ("playcount" + str(series.playcount))
print ('-' * 80)

def showalbums(album):
asciiprint ("Album title: " + album.title)
print ('-' * 80)


if __name__ == '__main__':
actions = {"1": get_connection_info, "2": showrecentlyaddedmovies, "3": showrecentlyaddedseries,"4": showrecentlyaddedalbums,
"5": showcurrentlyplaying, "6": showconnectedclients, "7": sendmessagetoallclients, "8": doe_wat, '9':showplayingclients,
"10": getvolume, "11": setvolume}
buildmenu()
Loading