PlexKodiConnect: Kodi Plex Integration Done Right

@gdachs said:
I started to test PlexKodiConnect. I use OpenELEC master on a RPi2 currently. I have send a PR to make it compatible to Krypton.

The RPi2 has not enough RAM to make the initial Scan of my movies. I have added a temporary swapfile so that it managed this task. It just finished scanning of movies and tv shows.

Music scanning didn’t work, because album.iUserrating and song.rating are not allowed to be Null:
18:25:49 2048.077881 T:1766613920 ERROR: PlexKodiConnect Items -> itemtypes.py for music album has crashed for item 93932. Error: 18:25:49 2048.078369 T:1766613920 ERROR: PlexKodiConnect Items -> NOT NULL constraint failed: album.iUserrating 18:25:50 2048.120117 T:1766613920 NOTICE: PlexKodiConnect Items -> Traceback: Traceback (most recent call last): File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/itemtypes.py", line 1756, in add_updateAlbum self.run_add_updateAlbum(item, viewtag, viewid) File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/itemtypes.py", line 1848, in run_add_updateAlbum rating, lastScraped, "album", albumid)) IntegrityError: NOT NULL constraint failed: album.iUserrating

19:28:00 5778.384766 T:1765168032 ERROR: PlexKodiConnect Items -> itemtypes.py for music song has crashed for item 94014. Error: 19:28:00 5778.385254 T:1765168032 ERROR: PlexKodiConnect Items -> NOT NULL constraint failed: song.rating 19:28:00 5778.387695 T:1765168032 NOTICE: PlexKodiConnect Items -> Traceback: Traceback (most recent call last): File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/itemtypes.py", line 1957, in add_updateSong self.run_add_updateSong(item, viewtag, viewid) File "/storage/.kodi/addons/plugin.video.plexkodiconnect/resources/lib/itemtypes.py", line 2170, in run_add_updateSong dateplayed, rating)) IntegrityError: NOT NULL constraint failed: song.rating

Sorry for this few details, I am more a C/C++ programmer than a Python programmer.

Gerald

Thanks for the log! Will look into it.

I have a rpi2 working right now. Memory was never an issue. Could you maybe send a more detailed log via PM? Thanks

@croneter said:

@hstamas said:

@croneter said:
Last one before the Easter break.

Download: Releases · croneter/PlexKodiConnect · GitHub

##Changelog##

version 1.0.17

  • Fix transcoding
  • Get a machineIdentifier if it is missing
  • New Setting: Choose Plex Server from a list
  • Generate a new unique Plex device ID in settings

Edit
If you run into problems with PKC not starting up as it should (log: “NameError: global name ‘guidoc’ is not defined”), try raising the startup delay: Settings → Advanced → Startup Delay.

Seems to lock up Kodi on exit. reinstalled 1.0.16 and working properly again. PM’d you my log. Have a good Easter weekend and thanks for everything!

Nope, should not lock up kodi on exit. I’ve been seeing this error message from the start :wink:

What message are you referring to specifically @croneter? Something in my logs that are different from everyone elses?

I have a rpi2 working right now. Memory was never an issue. Could you maybe send a more detailed log via PM? Thanks
You didn’t say which OS you are using. Maybe Raspian with swap partition? That would make the difference.

Here is the full log: http://sprunge.us/NiAB

Gerald

@gdachs said:

I have a rpi2 working right now. Memory was never an issue. Could you maybe send a more detailed log via PM? Thanks
You didn’t say which OS you are using. Maybe Raspian with swap partition? That would make the difference.

Here is the full log: http://sprunge.us/NiAB

Gerald

Thanks! I’m using off-the-shelf Openelec.

I’m 90% sure that Plex Music crashed your rpi. Kodi just keeps scanning these folders unsuccessfully :frowning:

I’m 90% sure that Plex Music crashed your rpi. Kodi just keeps scanning these folders unsuccessfully :frowning:
Not sure what you mean? There is no crash in the log. Do you think because of memory problems I told? That is of course not in this log. I wrote already that I added a swapfile so that I don’t get a crash. And even if, the crash was in the journal, the OOM Killer was just killing Kodi.

Gerald

Some more details. This is the schema of the old table song:
sqlite> .schema song CREATE TABLE song (idSong integer primary key, idAlbum integer, idPath integer, strArtists text, strGenres text, strTitle varchar(512), iTrack integer, iDuration integer, iYear integer, dwFileNameCRC text, strFileName text, strMusicBrainzTrackID text, iTimesPlayed integer, iStartOffset integer, iEndOffset integer, idThumb integer, lastplayed varchar(20) default NULL, rating char default '0', comment text, mood text, dateAdded text);
rating is a char with default ‘0’.
Here the new table:
sqlite> .schema song CREATE TABLE song (idSong integer primary key, idAlbum integer, idPath integer, strArtists text, strGenres text, strTitle varchar(512), iTrack integer, iDuration integer, iYear integer, dwFileNameCRC text, strFileName text, strMusicBrainzTrackID text, iTimesPlayed integer, iStartOffset integer, iEndOffset integer, idThumb integer, lastplayed varchar(20) default NULL, rating FLOAT NOT NULL DEFAULT 0, userrating INTEGER NOT NULL DEFAULT 0, comment text, mood text, dateAdded text, votes INTEGER NOT NULL DEFAULT 0);
rating is now a float and has not to be NULL, so it has to be initialized in your code before an insert.
I am sure the other problem is very similar.

Gerald

@croneter said:
Last one before the Easter break.

Download: Releases · croneter/PlexKodiConnect · GitHub

##Changelog##

version 1.0.17

  • Fix transcoding
  • Get a machineIdentifier if it is missing
  • New Setting: Choose Plex Server from a list
  • Generate a new unique Plex device ID in settings

Edit
If you run into problems with PKC not starting up as it should (log: “NameError: global name ‘guidoc’ is not defined”), try raising the startup delay: Settings → Advanced → Startup Delay.

Wow, you are a code-writing machine. So if I want to clone an install, do I just clone and then change the Plex device ID on the cloned machine? Thanks for all of your work on this.

Do I need a Plex Premium account for this to work, or something?
When I’m prompted to log in, I enter the correct details. Afterwards, nothing happens.

When I try to manually tell it my server, it tries to reset PMS connections but fails. It also doesn’t let me select a server from the list (that part is in yellow instead of grey, unlike the rest). It also says that it can’t find any Plex server in the network.

When I try to log in to Plex.tv (this menu item is also yellow), it basically does nothing again.

I’m seriously confused how to use this software. I’ve been trying all day to run a Plex client on my Pi2 (running OSMC). Even after a full reset nothing changed.

Is the “Log-out Plex Home User:” supposed to show me my username? I’ll change the log level tomorrow and upload a log then.

Hmmm. Installing 1.0.17 then going back to 1.0.16 seems to have caused the missing movie information menu bug again. I’ve done nothing else with the system otherwise.

So has the Kodi v17 changed database structure?

If I delete a movie from my server, do I have clean my kodi library, and not just update, to delete it from pkc?

@Hufvudet said:
If I delete a movie from my server, do I have clean my kodi library, and not just update, to delete it from pkc?

Nope. That’s the beauty of the add on. It syncs the Kodi database with Plex. No more database management of any kind. As long as your using the default add on setting and not direct path option it will sync every 30 minutes.

@DocACE911 said:
So has the Kodi v17 changed database structure?

No

@Hufvudet said:
If I delete a movie from my server, do I have clean my kodi library, and not just update, to delete it from pkc?

Background full sync, running every ~30min, will delete the movie. The normal, instant background sync cannot know that it was deleted.

@croneter No idea why movie/show information context menu has dropped off again?

I have updated my PR. With this changes the error messages regarding the constraint violations are gone.
Get now all metadata, but no songs :(.

I think I will stop my tests for now, maybe I try it a little bit later again.

This plugin is pretty awesome, makes Kodi and Plex work together nicely. I have one small issue at the moment - 3D movies that I keep in a separate library in Plex show in the main movies library in Kodi, with no way to tell the difference. further to that, Kodi is unable to automatically detect the 3D type, even though the files are correctly named on the plex server (3D.SBS etc)

Is this a known issue?

@hstamas said:
@croneter No idea why movie/show information context menu has dropped off again?

I’m also affected by this, but the show information is always available. Only movie information disappears.

Ok i am confused about the “show information”

after a fresh install and using addon"default" and change absolutely nothing

When i go into the movies page and hit “i” on the keyboard nothing happens
When i go into the TV Shows page and hit “i” it works as should
While playing a movie and hit “i” it works as should

and to make it more confusing ,when i switch to the Titan skin it is all the same as above except it works as it should with the movies only on the Widget section.

Should i not see the info in the movies page

It has been like this for me since version 12

Thanks

@predatorx11 said:
This plugin is pretty awesome, makes Kodi and Plex work together nicely. I have one small issue at the moment - 3D movies that I keep in a separate library in Plex show in the main movies library in Kodi, with no way to tell the difference. further to that, Kodi is unable to automatically detect the 3D type, even though the files are correctly named on the plex server (3D.SBS etc)

Is this a known issue?

You can use the Plex nodes that PKC sets up to separate out your 3D movies from your regular ones. Just go to the plugins video section where it lists all the different Plex libraries and use those as your home screen items (if the skin your using supports that).

Im not aware of Kodi automatically detecting what 3D mode the movie is in unless again its skin specific? Don’t you just choose how you want it to alert you (Preferred, Ask, SBS etc).