Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
croneter committed Mar 10, 2016
2 parents a76b539 + fa7bc12 commit 3d4e51e
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 47 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
**Installation in Kodi**

1. You might want to uninstall everything else Plex related first, e.g. PlexBMC and PlexBMC Helper. Starting with a fresh Kodi install might be a good idea. Be sure to use a "normal", unmodded Skin in Kodi.
If you're updating, you might also want to do a complete reset of the plugin: Settings -> Advanced -> "Performe full DB reset". Choose "Yes" for everything.
If you're updating, you might also want to do a complete reset of the plugin: Settings -> Advanced -> "Perform full DB reset". Choose "Yes" for all questions.
2. Simply fire up Kodi and Install from ZIP from here on.
3. Install the 2 needed dependencies first (be sure to NOT download the sources but the additional release files): https://github.com/croneter/plugin.video.plexkodiconnect.tvshows/releases/tag/1.0.0 and https://github.com/croneter/plugin.video.plexkodiconnect.movies/releases/tag/1.0.0
3. Install the 2 needed dependencies first (be sure to NOT download the sources but the additional release files): https://github.com/croneter/plugin.video.plexkodiconnect.tvshows/releases/ and https://github.com/croneter/plugin.video.plexkodiconnect.movies/releases/
5. Then install PlexKodiConnect, again the additional release file from here: https://github.com/croneter/PlexKodiConnect/releases/
6. Within a few seconds you should be prompted to log into plex.tv. This is mandatory for Plex Home, otherwise you can skip. If nothing happens, try to restart Kodi
7. Once you're succesfully authenticated to your Plex server, the initial sync will start.
8. The first sync of the Plex server to local Kodi database may take a LONG time. With my setup (~400 movies, ~600 episodes, couple of Test music albums and a very powerful NAS), sync take approximately 5 minutes.
8. The first sync of the Plex server to local Kodi database may take a LONG time. With my setup (~400 movies, ~600 episodes, couple of Test music albums and a very powerful NAS), sync takes approximately 5 minutes.
9. Once the full sync is done, you can browse your media in Kodi, syncs will be automatically done in the background.
10. Restart!

Expand Down Expand Up @@ -62,6 +62,8 @@ Guess what, this is BETA. Currently these features are working:
- Pictures
- Watch Later
- Music Videos
- Playlists
- Play directly from SMB paths ("\\\\server\\Plex\\movie.mkv" on Windows) instead of HTTP ("192.168.1.1:32400")
- TV Shows Theme Music (ultra-low prio)


Expand Down
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect"
name="PlexKodiConnect"
version="1.0.5"
version="1.0.6"
provider-name="croneter">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
version 1.0.6
- Enable traceback and dump XMLs of failed PMS items in the log for lib sync
- Optimize notifications for library syncs
- Manually trigger full library scan from settings
- Merge with MediaBrowser/master up until db4cb448b0e4fd82662f8b82a800d8da8ea33688


version 1.0.5
- Catch exceptions in itemtypes and log them
- Slightly increased download timeouts
Expand Down
1 change: 1 addition & 0 deletions contextmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def logMsg(msg, lvl=1):
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
item = emby_db.getItem_byKodiId(itemid, itemtype)
embycursor.close()
if item: embyid = item[0]

logMsg("Contextmenu opened for embyid: %s - itemtype: %s" %(embyid,itemtype))
Expand Down
17 changes: 15 additions & 2 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import xbmc
import xbmcaddon
import xbmcgui

#################################################################################################

Expand Down Expand Up @@ -66,7 +67,8 @@ def __init__(self):
'companion': entrypoint.plexCompanion,
'switchuser': entrypoint.switchPlexUser,
'deviceid': entrypoint.resetDeviceId,
'reConnect': entrypoint.reConnect
'reConnect': entrypoint.reConnect,
'delete': entrypoint.deleteItem
}

if "/extrafanart" in sys.argv[0]:
Expand Down Expand Up @@ -108,7 +110,18 @@ def __init__(self):
if mode == "settings":
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.plexkodiconnect)')
elif mode in ("manualsync", "repair"):
entrypoint.RunLibScan(mode)
if utils.window('emby_online') != "true":
# Server is not online, do not run the sync
xbmcgui.Dialog().ok(heading="PlexKodiConnect",
line1=("Unable to run the sync, the add-on is not "
"connected to the Emby server."))
utils.logMsg("PLEX", "Not connected to the emby server.", 1)
return

else:
utils.logMsg("PLEX", "Requesting full library scan", 1)
utils.window('plex_runLibScan', value="full")

elif mode == "texturecache":
import artwork
artwork.Artwork().FullTextureCacheSync()
Expand Down
2 changes: 2 additions & 0 deletions resources/language/English/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,7 @@
<string id="39404">Startup syncing process failed repeatedly. Try restarting Kodi. Stopping Sync for now.</string>
<string id="39405">Plex playlists/nodes refreshed</string>
<string id="39406">Plex playlists/nodes refresh failed</string>
<string id="39407">Full library sync finished</string>
<string id="39408">Sync had to skip some items because they could not be processed. Please post your Kodi logs to the Plex forum.</string>

</strings>
2 changes: 2 additions & 0 deletions resources/language/German/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -337,5 +337,7 @@
<string id="39404">Der Startup Synchronisations-Prozess der Plex Bibliotheken ist mehrmals fehlgeschlagen. Bitte Kodi neu starten. Synch wird jetzt gestoppt.</string>
<string id="39405">Plex Playlisten/Nodes aktualisiert</string>
<string id="39406">Plex Playlisten/Nodes Aktualisierung fehlgeschlagen</string>
<string id="39407">Plex Bibliotheken aktualisiert</string>
<string id="39408">Einige Plex Einträge mussten übersprungen werden, da sie nicht verarbeitet werden konnten. Bitte teilen Sie Ihr Kodi log im Plex Forum.</string>

</strings>
50 changes: 50 additions & 0 deletions resources/lib/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,56 @@ def resetDeviceId():
line1=language(33033))
xbmc.executebuiltin('RestartApp')

##### Delete Item
def deleteItem():

# Serves as a keymap action
if xbmc.getInfoLabel('ListItem.Property(embyid)'): # If we already have the embyid
embyid = xbmc.getInfoLabel('ListItem.Property(embyid)')
else:
dbid = xbmc.getInfoLabel('ListItem.DBID')
itemtype = xbmc.getInfoLabel('ListItem.DBTYPE')

if not itemtype:

if xbmc.getCondVisibility('Container.Content(albums)'):
itemtype = "album"
elif xbmc.getCondVisibility('Container.Content(artists)'):
itemtype = "artist"
elif xbmc.getCondVisibility('Container.Content(songs)'):
itemtype = "song"
elif xbmc.getCondVisibility('Container.Content(pictures)'):
itemtype = "picture"
else:
utils.logMsg("EMBY delete", "Unknown type, unable to proceed.", 1)
return

embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
item = emby_db.getItem_byKodiId(dbid, itemtype)
embycursor.close()

try:
embyid = item[0]
except TypeError:
utils.logMsg("EMBY delete", "Unknown embyId, unable to proceed.", 1)
return

if utils.settings('skipContextMenu') != "true":
resp = xbmcgui.Dialog().yesno(
heading="Confirm delete",
line1=("Delete file from Emby Server? This will "
"also delete the file(s) from disk!"))
if not resp:
utils.logMsg("EMBY delete", "User skipped deletion for: %s." % embyid, 1)
return

doUtils = downloadutils.DownloadUtils()
url = "{server}/emby/Items/%s?format=json" % embyid
utils.logMsg("EMBY delete", "Deleting request: %s" % embyid, 0)
doUtils.downloadUrl(url, type="DELETE")

##### ADD ADDITIONAL USERS #####
def addUser():

Expand Down
72 changes: 64 additions & 8 deletions resources/lib/itemtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,18 @@ def add_update(self, item, viewtag=None, viewid=None):
try:
self.run_add_update(item, viewtag, viewid)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for movies has crashed for item %s. '
'Error:' % item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -920,10 +928,18 @@ def add_update(self, item, viewtag=None, viewid=None):
try:
self.run_add_update(item, viewtag, viewid)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for tv show has crashed for item %s. '
'Error:' % item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -1117,10 +1133,18 @@ def add_updateSeason(self, item, viewtag=None, viewid=None):
try:
self.run_add_updateSeason(item, viewtag, viewid)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for tv seasons has crashed for item %s. '
'Error:' % item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -1162,10 +1186,18 @@ def add_updateEpisode(self, item, viewtag=None, viewid=None):
try:
self.run_add_updateEpisode(item, viewtag, viewid)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for tv episode has crashed for item %s. '
'Error:' % item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -1642,11 +1674,19 @@ def add_updateArtist(self, item, viewtag=None, viewid=None, artisttype="MusicArt
try:
self.run_add_updateArtist(item, viewtag, viewid, artisttype)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for music artist has crashed for '
'item %s. Error:'
% item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -1738,11 +1778,19 @@ def add_updateAlbum(self, item, viewtag=None, viewid=None):
try:
self.run_add_updateAlbum(item, viewtag, viewid)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for music album has crashed for '
'item %s. Error:'
% item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -1936,11 +1984,19 @@ def add_updateSong(self, item, viewtag=None, viewid=None):
try:
self.run_add_updateSong(item, viewtag, viewid)
except Exception as e:
utils.window('emby_dbScan', clear=True)
self.logMsg('itemtypes.py for music song has crashed for '
'item %s. Error:'
% item.attrib.get('ratingKey', None), -1)
self.logMsg(e, -1)
import traceback
self.logMsg("Traceback:\n%s" % traceback.format_exc(), 0)
self.logMsg('The item xml is:', -1)
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
etree.dump(item)
utils.window('plex_scancrashed', value='true')
# skip this item for now
return

Expand Down Expand Up @@ -2275,4 +2331,4 @@ def removeArtist(self, kodiid):
artwork = self.artwork

artwork.deleteArtwork(kodiid, "artist", kodicursor)
kodicursor.execute("DELETE FROM artist WHERE idArtist = ?", (kodiid,))
kodicursor.execute("DELETE FROM artist WHERE idArtist = ?", (kodiid,))
Loading

0 comments on commit 3d4e51e

Please sign in to comment.