maraschino icon indicating copy to clipboard operation
maraschino copied to clipboard

Plex support for Maraschino

Open bob3695 opened this issue 11 years ago • 54 comments

This is not 100% complete but is at a stable point where it can be brought into the main repo for people to start enjoying.

bob3695 avatar Jan 19 '13 13:01 bob3695

just browsing thru the code there is 1 thing that is a show stopper. in maraschino/models.py we are unable to add new fields to a db table. XBMCServer will need to be ditched and a new 1 created. MediaServer i guess?. Also, while doing that it would be best to use pickletype the same as recently added and disks are using just in case of future expansion.

I will get pms installed then figure out what to do about the client. Can LG Media LINK be used as a client?

N3MIS15 avatar Jan 19 '13 22:01 N3MIS15

Ok, I wasn't aware that the system wouldn't dynamically add the field, I will update the code to a new tabel for the new setup.

As for LG Media LINK: http://www.plexapp.com/medialink/files/index.html should get you started

bob3695 avatar Jan 19 '13 22:01 bob3695

Created the new table and reverted the old. I didn't write any code to migrate old servers to the new just yet but will if you guys feel that is needed. Otherwise when people update they will no longer have servers until they re-create them.

Also - I didn't convert it over to a pickletype as I have no experience with that yet so doing so will take a short while for me to learn and recode what is needed. Until then we can put this request on hold

bob3695 avatar Jan 19 '13 22:01 bob3695

Switched it over to a pickletype as suggested. I think I got all the places that access the data that I put into the 'data' column. Did some testing and all seems fine to me.

bob3695 avatar Jan 20 '13 00:01 bob3695

pickletype lets you define dicts, lists and so on. So with pickletype you can have server.data['hostname'] for example. If any new field needs to be added in the future we can just add it to the dict rather than a new field.

just merged and it wont let me create any servers. http://pastebin.com/n2aQ0GdB

N3MIS15 avatar Jan 20 '13 00:01 N3MIS15

Is that with a fresh database or one from before the upgrade?

bob3695 avatar Jan 20 '13 00:01 bob3695

fresh

N3MIS15 avatar Jan 20 '13 01:01 N3MIS15

Ok, I'll try and replicate and get a fix in. I am not seeing this error locally on my Mac dev box.

bob3695 avatar Jan 20 '13 02:01 bob3695

Pushed a fix for your issue - I wasn't running in develop mode when I tested so it just swallowed the error and didn't tell me anything about it. I had to break away from direct access of the data in the template and pass all the relevant values in on the render_template command so I could make sure there was a data object to pull the data from prior to passing it to the template.

bob3695 avatar Jan 20 '13 14:01 bob3695

How are we doing on this? To be honest, as long as you guys are happy with it having tested both with XBMC and Plex, and it doesn't break existing XBMC installs, then I am happy with it. If for XBMC users nothing changes then it is a base for the new Plex support which can be added to and refined over time, and I vote to get it into master ASAP.

I'd be happy to test the whole "not breaking existing XBMC installations" thing (my main concern) if you like. And also new installs from scratch. Another test on another (Debian in this case) system is generally a good thing, and shouldn't take me long at all.

Shout when you're at the point that you think me doing these tests would be beneficial (or not, if you have things on super lock-down) and I'll get back to you with my findings!

mrkipling avatar Jan 21 '13 23:01 mrkipling

In theory these changes should not break any XBMC code as I just took all existing code for XBMC and wrapped it in if statements checking the server type. It will however remove any setup servers (well, won't remove but the setup is using a new table so the servers will no longer be used) so when upgrading the users will have to re-add their servers or we could theoretically put together a update script that migrates the old servers to the new db table and assumes they are XBMC (as that is all that is supported prior to this PR).

I would love for someone to test the changes on a XBMC setup as I only did light tests against Frodo and I don't have my full media library or even use the setup on a day-to-day basis. One thing to note: I did find a bug in the recently viewed module on my Mac that kept the cache from working so it deleted the images and redownloaded them every time it updated - I had to make a change that as under Unix. I have not tested that against a linux machine. I know Mac is based on *nix but they might treat that differently so I would be especially interested in knowing how testing that against other Linux based boxes go. The changeset I am talking about is: https://github.com/bob3695/maraschino/commit/f695b08d419f622b83afa2c33bb1cc8fdbc4014c. It was one of the first few that I did. Also note that I had a few other fixes in that change set that I forgot to write about in the comment so the change I am talking about is in recently_added.py

bob3695 avatar Jan 22 '13 00:01 bob3695

In theory these changes should not break any XBMC code as I just took all existing code for XBMC and wrapped it in if statements checking the server type.

The XBMC code will need to checked then (probably already has, @N3MIS15 this is looking good?)

It will however remove any setup servers (well, won't remove but the setup is using a new table so the servers will no longer be used) so when upgrading the users will have to re-add their servers or we could theoretically put together a update script that migrates the old servers to the new db table and assumes they are XBMC (as that is all that is supported prior to this PR).

We don't like updates that break functionality for users. Generally, if they click the "update" button in Maraschino, there is an implicit level of trust that things will be mostly working as normal (save for bugs, which we will fix) after doing so.

If what you are telling me is correct (entirely new table to store that can differentiate from XBMC/Plex, and all the code has been updated to use this new table) then I think that migrating the old server-info tables from the old "XBMC-only" tables to use this new format is a worthwhile thing to be doing.

I just don't want XBMC users (read: currently literally 100% of users) to have a broken database and an unusable Maraschino interface.

My vote goes to writing a migration script which takes the old XBMC-specific table and converts it into the new one, if it/any exists. Quick check on startup (in lieu of a proper migration script).

Sound reasonable? Or have I lost the plot?

(getting your head back into development isn't super-easy after so long :)

mrkipling avatar Jan 22 '13 00:01 mrkipling

I think writing code on the startup to check for the old table is very reasonable. I will get that written most likely tomorrow and attaching to this PR. I will do some testing but those changes might require more testing as I don't have a full setup going on the original table setup. So look for an additional commit in the coming days to over come the upgrade issue

bob3695 avatar Jan 22 '13 00:01 bob3695

I look forward to your changes, look forward to testing, and look forward to merging this in (pending @N3MIS15's approval of course, as he is in charge of this PR) - I'm just trying to provide some sensible options and guidance in his absence!

mrkipling avatar Jan 22 '13 00:01 mrkipling

100% agree with mrkipling. I will get a chance to test later today to make sure nothing is broken.

N3MIS15 avatar Jan 22 '13 01:01 N3MIS15

This was a PITA to get working at all. I managed to get a plex server added after a tweak to https://github.com/mrkipling/maraschino/pull/285/files#L4R1182 it should be: mediaServer = MediaServer.query.get(server_id)

After i got that sorted i switched to the plex server and tried the media library. I tried movies, failed. tried music, failed. tried tvshows and it worked. (the failures may be due to the ids in settings. I have no idea to figure out which id goes with what..) Clicked a show, failed. Traceback: 17:00:33 :: INFO :: 127.0.0.1 - - [22/Jan/2013 17:00:33] "GET /xhr/library/tvsho ws HTTP/1.1" 200 - 17:00:34 :: INFO :: LIBRARY :: Retrieving seasons for tvshowid: 2671 17:00:34 :: ERROR :: LIBRARY :: Problem fetching seasons 17:00:34 :: DEBUG :: EXCEPTION :: 'PLEXLibrary' object has no attribute 'plexget xml'

This needs a lot more testing/fixing before it can be merged into master.

N3MIS15 avatar Jan 22 '13 06:01 N3MIS15

Ok, I'll check it out. I thought I got all the places when i renamed that function.

You get the id a few ways. The most straight forward is go to the web interface and go in to the section. The id should be near the end in the address bar. Or you could point your browser to http://:32400/library/sections which returns XML of all sections and find the id in there.

I will fix the other issues you had when I go to write the update code for the database

bob3695 avatar Jan 22 '13 10:01 bob3695

@N3MIS15 I fixed up the issues you were seeing. They seem to have been a issue with my ability to find and replace :-) Anyway, it should be a lot more smooth now. I tested a full setup from fresh with library and all the recent modules and everything is working as expected.

I will begin work on the upgrade code now.

bob3695 avatar Jan 22 '13 20:01 bob3695

Ok, code to upgrade users complete. Note that I tested with 1 server. I am not sure if it is the norm for the XBMC side to have more then 1 server but that case is not tested as of yet but theoretically should work. I will test with a multi server setup in a little while if one of you guys don't beat me to it.

bob3695 avatar Jan 22 '13 21:01 bob3695

That was easier to test then expected...

I tested with two servers and they both appear to be working correctly and pulled all the correct data

bob3695 avatar Jan 22 '13 21:01 bob3695

@N3MIS15 Any word on further testing with the fixes?

bob3695 avatar Jan 24 '13 23:01 bob3695

Will this be merged in soon? I'm needing some plex lovin' over here. thanks for doing this @bob3695!

josephmc5 avatar Feb 02 '13 04:02 josephmc5

Keeping up with commits

bob3695 avatar Feb 04 '13 13:02 bob3695

Keep up the great work! Maybe someday soon I'll be able to take a stab at it and contribute a little to the cause as a daily plex user.

josephmc5 avatar Feb 04 '13 19:02 josephmc5

Any news about this upcoming feature?

l-t-k avatar Apr 08 '13 15:04 l-t-k

Any news on this @N3MIS15 ? It would be a awesome addition.

Hellowlol avatar Jun 23 '13 11:06 Hellowlol

I'm sure it would, but its just too hacky and incomplete as it stands IMO. I have other pull requests to try and make the core XBMC stuff more flexible. Personally I dislike plex and their antics, I will not be offering support for any of the plex features (I am not a user of plex and most likely never will be). I am however more than happy to try and expand Maraschino's usability if the authors of this PR are willing to follow thru with any issues that may arise.

This may be a rant, but you need to understand that once something gets pulled into master it needs to be supported. I will not be offering any plex related support since I have never really used it and dont plan too.

N3MIS15 avatar Jun 23 '13 11:06 N3MIS15

@N3MIS15 This is sad to hear. The Plex community is thriving, and rightly so - the Plex team has done wonderful and creative things to benefit HTPC users (I love the web interface, and the PMS to decentralize the server vs. clients), XBMC has some cool tricks up it's sleeve too. We all have our opinions on which product is better, and we're all smart enough people to make either product do what we want it to do. I believe your stance on only supporting XBMC is only limiting the success of Maraschino... thus, I am sad. Thanks to those who have taken the time to write the code to make this work.

that1guy avatar Oct 12 '13 23:10 that1guy

@that1guy I do agree with you that the choice of no Plex support is not helping Maraschino grow however this was not the point raised. As you did say it is more of a personal matter and replicating the features used towards XBMC in this project into another software is no easy feat. Even if we, Maraschino developers, have our own strong opinions about it, none of us are familiar with Plex therefore it does not make sense to implement it. Having that said if I personally had the time to do it I would be glad to however at this point in time it is just not feasible. Everyone is welcome to do the modifications they please tho, this is why open source is so awesome, doesn't mean it will go into the master repository.

gugahoi avatar Oct 13 '13 12:10 gugahoi

@N3MIS15 I Would love to see this ported to Plex also. Hopefully the day will come around where it will support it or perhaps something better will come along. Although I have never used Maraschino it looks nice. Keep up the good work. Thanks!

dpippin avatar Feb 02 '14 05:02 dpippin

Soooo I am thinking of trying to go for a merge here. It would require heaps of testing so I would like to ask for some help if people can. To start off, I dont use plex but I'll find a way to get it properly setup and then I'll need to familiarize myself with the backend. Are this PR and the other plex related one a single one or are they completely different?

gugahoi avatar Feb 11 '14 08:02 gugahoi

Meh, I am against merging this. Its too incomplete and tacked on.

N3MIS15 avatar Feb 11 '14 08:02 N3MIS15

Doesnt need to be in it's current state. I want to find the best possible implementation within my abilities. Maybe after some work I'll get to the same conclusion you have...

gugahoi avatar Feb 11 '14 08:02 gugahoi

There are things XBMC can do that plex cant (and possibly visa versa).

When i re-wrote the library module, i purposely named everything "xbmc" with the intention of having plex and xbmc modules seperate so that 1 did not influence the other in a bad way. I will jump on irc and explain my thinking a bit more if you like..

N3MIS15 avatar Feb 11 '14 08:02 N3MIS15

Ok guys so since people dont seem to be replying here and I could not get it to work I have taken upon myself to develop something. You can find it here: https://github.com/gugahoi/maraschino/tree/plex I have stripped out all XBMC related things and have started interfacing with Plex. Development will prob be slow and I am not sure if it will ever become as useful as XBMC's integration since Plex has a totally different approach to things and no documentation relating their interface. Hope people find it useful and would love for feedback and ideas.

gugahoi avatar Mar 16 '14 03:03 gugahoi

@gugahoi i've tried to pull your latest development and test as i'm also very interested in getting this to work with plex but i get prompted for authentication when initiating the pull...

ramdodger avatar Mar 16 '14 04:03 ramdodger

@gugahoi i was able to pull through a zip file and get it working. looks great! think there is any way you could add the ability to click on a recently added TV show or Movie and open the Plex web interface? let me know if you need assistance with this moving forward. i'd love to see this project moving again.

ramdodger avatar Mar 16 '14 04:03 ramdodger

@ramdodger my bad, didnt even know this was a feature in github but must have made something wrong. I'll check it out and fix it. For the moment tho all I have done is display the stuff in the "on deck" session. I am not sure how I will go about developing things further since I cant seem to find the documentation for the plex stuff. I already know they have some big problems with getting json information out of some sections which kind of sucks since I hate dealing with xml files. Definitely open to ideas about everything tho.

gugahoi avatar Mar 16 '14 04:03 gugahoi

@ramdodger i tried to checkout the branch on a remote machine and everything seemed fine. These are the steps if you wish to still use git:

git clone git://github.com/gugahoi/maraschino/
cd maraschino
git checkout plex

Let me know if you still have any problems. I am still studying Plex's stuff but for now it's mostly guessing since I cannot for the life of me find their docs. If anyone knows where they are please let me know.

gugahoi avatar Mar 16 '14 11:03 gugahoi

http://dev.plexapp.com/docs/api/ On Mar 16, 2014 7:08 AM, "Gustavo Hoirisch" [email protected] wrote:

@ramdodger https://github.com/ramdodger i tried to checkout the branch on a remote machine and everything seemed fine. These are the steps if you wish to still use git:

git clone git://github.com/gugahoi/maraschino/ cd maraschino git checkout plex

Let me know if you still have any problems. I am still studying Plex's stuff but for now it's mostly guessing since I cannot for the life of me find their docs. If anyone knows where they are please let me know.

Reply to this email directly or view it on GitHubhttps://github.com/mrkipling/maraschino/pull/285#issuecomment-37754368 .

Watso4183 avatar Mar 16 '14 12:03 Watso4183

I think thats their internal plugin functions, i could be wrong tho. I need the info like how to access the servers id remotely to read it's functionality and library and stuff like that. So far I know how to get basic info but there are tons of things in there I have no idea of their use like librarySectionUUID. I want a document explaining that for example.

gugahoi avatar Mar 16 '14 13:03 gugahoi

Sorry about that. I'm thinking this is what your looking for then:

https://plexapp.zendesk.com/hc/en-us/articles/201638786-Plex-Media-Server-URL-Commands

I'll have to take a look at your fork and see if I can lend any help.

Watso4183 avatar Mar 16 '14 13:03 Watso4183

Oh perfect, thats some of the info I need. I'll be reading it up later today.

gugahoi avatar Mar 17 '14 01:03 gugahoi

@ramdodger I managed to add links to the web interface and also episode numbers, still learning tho. Maybe you can do some feature requests over on my own repo? That might be easier to track things regarding plex and give me ideas.

gugahoi avatar Mar 18 '14 13:03 gugahoi

I was able to clone the latest release, looks great! the only issue i am having is that i;m unable to use "My Plex" credentials for authentication. In fact i need to leave the username and password fields blank to see any content. when i click on an episode it opens up the plex web interface and i get "media server not found."

On Tue, Mar 18, 2014 at 9:36 AM, Gustavo Hoirisch [email protected]:

@ramdodger https://github.com/ramdodger I managed to add links to the web interface and also episode numbers, still learning tho. Maybe you can do some feature requests over on my own repo? That might be easier to track things regarding plex and give me ideas.

Reply to this email directly or view it on GitHubhttps://github.com/mrkipling/maraschino/pull/285#issuecomment-37932648 .

Bobby Anderson

ramdodger avatar Mar 18 '14 16:03 ramdodger

@gugahoi Hi there, I just came across Maraschino, and then this thread since I'm a Plex user and wanted to say thanks for the effort, so far. I cloned the repo, installed it and have it running for Couchpotato and Sickbeard.

However, in the Plex module, when I click on any movie/TV show, plex.tv/web opens and I get a message saying 'Media server not found', just like @ramdodger. I opened up the plex.tv/web server myself and noticed the issue was the URL structure.

For example with Bates Motel, the URL Maraschino opens is: http://plex.tv/web/app#!/server/False/details/%2Flibrary%2Fmetadata%2F8132%2F, while the Plex web app loads it as: http://plex.tv/web/app#!/server/db4f5914c3c848e17ffd2869b71aca466512b355/details/%2Flibrary%2Fmetadata%2F8132%2F

As you can see, where the server ID (?) - db4f5914c3c848e17ffd2869b71aca466512b355 - is supposed to be, Maraschino instead writes it as False.

I will open an issue on the Plex tree as well, just thought I'd post here as well to corroborate what @ramdodger said yesterday.

Wraithers avatar Mar 19 '14 21:03 Wraithers

@gugahoi Ah, it seems there's no 'Issue' tab on the right-side. I'm relatively new to GitHub, so am I missing something..?

Wraithers avatar Mar 19 '14 21:03 Wraithers

@Wraithers @ramdodger Yes I suspected that could be an issue. At the moment I chose to pick the server based on the internal IP address from Maraschino's own settings so if your plexserver is located at 192.168.0.25 then use that in maraschino's own settings and it should work (it does for me at least). We should move this discussion somewhere else. Post it in my own repository at http://github.com/gugahoi/maraschino

gugahoi avatar Mar 20 '14 05:03 gugahoi

i hope you are not giving up on this project and are working on other things. id really like to see the "recently added" section in the Plex module as well as the ability to choose Plex server or use "myplex" as an alternative as i think people would like to use this outside of their network, like i do.

On Thu, Mar 20, 2014 at 1:20 AM, Gustavo Hoirisch [email protected]:

@Wraithers https://github.com/Wraithers @ramdodgerhttps://github.com/ramdodgerYes I suspected that could be an issue. At the moment I chose to pick the server based on the internal IP address from Maraschino's own settings so if your plexserver is located at 192.168.0.25 then use that in maraschino's own settings and it should work (it does for me at least). We should move this discussion somewhere else. Post it in my own repository at http://github.com/gugahoi/maraschinohttps://github.com/gugahoi/maraschino

Reply to this email directly or view it on GitHubhttps://github.com/mrkipling/maraschino/pull/285#issuecomment-38136094 .

Bobby Anderson

ramdodger avatar Mar 30 '14 03:03 ramdodger

@ramdodger Not sure if you have seen the branch over on my repository. There is an initial implementation but I havent had a lot of time this past week and dont see myself spending a lot of time on it for another couple of weeks. Doesnt mean I gave up just not at the top of my prority list right now. I would love it if you could test things over there and let me know ur opinion and ideas so that when I do sit down to code I can know on what to focus.

https://github.com/gugahoi/maraschino/tree/plex

gugahoi avatar Mar 30 '14 07:03 gugahoi

@ramdodger I have worked on it a bit more this past weekend and have added a significant amount of features. There are now recently added modules for photos, albums, episodes and movies and a now playing bar. Users can change the servers from servers associated with their myPlex account too however at the moment it has to be a server local to maraschino as I am using the local ip address.

Here is how it is looking: screen shot 2014-04-07 at 11 54 54 am

PS.: I am considering closing this PR since the owner has not spoken in a while and I couldn't get anything to work from it.

gugahoi avatar Apr 07 '14 01:04 gugahoi

Looks great @gugahoi !

Hellowlol avatar Apr 07 '14 07:04 Hellowlol

@gugahoi I will gladly test. I have it running off of the plex branch on unraid but am not seeing any of the plex related modules. Am I missing something? Maybe it is not running correctly...

Syco54645 avatar Aug 02 '14 06:08 Syco54645

@Syco54645 I have now dedicated my repository for Maraschino for Plex, just use the master branch over there and if you are moving your db from the xbmc version you will need to sign in to plex from Maraschino on the top right hand corner menu. Otherwise, if starting from scratch just follow the instructions on start up and you should be good. Let me know if you are still having problems.

gugahoi avatar Aug 02 '14 06:08 gugahoi