Merge branch 'develop' into translations

This commit is contained in:
tomkat83 2017-05-29 17:30:02 +02:00
commit 3c4865c425
8 changed files with 81 additions and 34 deletions

View file

@ -25,6 +25,7 @@ Please help translate PlexKodiConnect into your language: [Transifex.com](https:
* [**What does PKC do?**](#what-does-pkc-do)
* [**PKC Features**](#pkc-features)
* [**Download and Installation**](#download-and-installation)
* [**Additional Artwork**](#additional-artwork)
* [**Important notes**](#important-notes)
* [**Donations**](#donations)
* [**Request a New Feature**](#request-a-new-feature)
@ -76,6 +77,10 @@ Install PKC via the PlexKodiConnect Kodi repository below (we cannot use the off
|----------------|--------------|
| [![stable version](https://img.shields.io/badge/stable_version-latest-blue.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect/bin/repository.plexkodiconnect/repository.plexkodiconnect-1.0.0.zip) | [![beta version](https://img.shields.io/badge/beta_version-latest-red.svg?maxAge=60&style=flat) ](https://dl.bintray.com/croneter/PlexKodiConnect_BETA/bin-BETA/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.0.zip) |
### Additional Artwork
PKC uses additional artwork for free from [TheMovieDB](https://www.themoviedb.org). Many thanks for lettings us use the API, guys!
[![Logo of TheMovieDB](themoviedb.png)](https://www.themoviedb.org)
### Important Notes
1. If you are using a **low CPU device like a Raspberry Pi or a CuBox**, PKC might be instable or crash during initial sync. Lower the number of threads in the [PKC settings under Sync Options](https://github.com/croneter/PlexKodiConnect/wiki/PKC-settings#sync-options). Don't forget to reboot Kodi after that.

View file

@ -1939,3 +1939,8 @@ msgstr ""
msgctxt "#39716"
msgid "Kodi cannot parse {0}. PKC will not function correctly. Please visit {1} and correct your file!"
msgstr ""
# Shown once on first installation to comply with the terms of use of themoviedb.org
msgctxt "#39717"
msgid "PKC uses free additional artwork from www.themoviedb.org. Many thanks!"
msgstr ""

View file

@ -14,6 +14,7 @@ from userclient import UserClient
from PlexAPI import PlexAPI
from PlexFunctions import GetMachineIdentifier, get_PMS_settings
import state
from migration import check_migration
###############################################################################
@ -411,6 +412,9 @@ class InitialSetup():
log.info('Current Kodi video memory cache in bytes: %s' % cache)
settings('kodi_video_cache', value=cache)
# Do we need to migrate stuff?
check_migration()
# Optionally sign into plex.tv. Will not be called on very first run
# as plexToken will be ''
settings('plex_status', value=lang(39226))
@ -488,6 +492,8 @@ class InitialSetup():
# If you use several Plex libraries of one kind, e.g. "Kids Movies" and
# "Parents Movies", be sure to check https://goo.gl/JFtQV9
dialog.ok(heading=lang(29999), line1=lang(39076))
# Need to tell about our image source for collections: themoviedb.org
dialog.ok(heading=lang(29999), line1=lang(39717))
# Make sure that we only ask these questions upon first installation
settings('InstallQuestionsAnswered', value='true')

View file

@ -12,7 +12,7 @@ from xbmcvfs import exists
from utils import window, settings, getUnixTimestamp, sourcesXML,\
thread_methods, create_actor_db_index, dialog, LogTime, getScreensaver,\
setScreensaver, playlistXSP, language as lang, DateToKodi, reset,\
tryDecode, deletePlaylists, deleteNodes, tryEncode
tryDecode, deletePlaylists, deleteNodes, tryEncode, compare_version
import downloadutils
import itemtypes
import plexdb_functions as plexdb
@ -1087,37 +1087,6 @@ class LibrarySync(Thread):
if itemid not in self.allPlexElementsId:
Music.remove(itemid)
def compareDBVersion(self, current, minimum):
# It returns True is database is up to date. False otherwise.
log.info("current DB: %s minimum DB: %s" % (current, minimum))
try:
currMajor, currMinor, currPatch = current.split(".")
except ValueError:
# there WAS no current DB, e.g. deleted.
return True
minMajor, minMinor, minPatch = minimum.split(".")
currMajor = int(currMajor)
currMinor = int(currMinor)
currPatch = int(currPatch)
minMajor = int(minMajor)
minMinor = int(minMinor)
minPatch = int(minPatch)
if currMajor > minMajor:
return True
elif currMajor < minMajor:
return False
if currMinor > minMinor:
return True
elif currMinor < minMinor:
return False
if currPatch >= minPatch:
return True
else:
return False
def processMessage(self, message):
"""
processes json.loads() messages from websocket. Triage what we need to
@ -1486,7 +1455,7 @@ class LibrarySync(Thread):
currentVersion = settings('dbCreatedWithVersion')
minVersion = window('plex_minDBVersion')
if not self.compareDBVersion(currentVersion, minVersion):
if not compare_version(currentVersion, minVersion):
log.warn("Db version out of date: %s minimum version "
"required: %s" % (currentVersion, minVersion))
# DB out of date. Proceed to recreate?

View file

@ -0,0 +1,24 @@
from logging import getLogger
import variables as v
from utils import compare_version, settings
###############################################################################
log = getLogger("PLEX."+__name__)
def check_migration():
log.info('Checking whether we need to migrate something')
last_migration = settings('last_migrated_PKC_version')
if last_migration == v.ADDON_VERSION:
log.info('Already migrated to PKC version %s' % v.ADDON_VERSION)
return
if not last_migration:
log.info('Never migrated, so checking everything')
last_migration = '1.0.0'
if not compare_version(v.ADDON_VERSION, '1.8.2'):
log.info('Migrating to version 1.8.1')
# Set the new PKC theMovieDB key
settings('themoviedbAPIKey', value='19c90103adb9e98f2172c6a6a3d85dc4')
settings('last_migrated_PKC_version', value=v.ADDON_VERSION)

View file

@ -468,6 +468,44 @@ def convertdate(date):
return date
def compare_version(current, minimum):
"""
Returns True if current is >= then minimum. False otherwise. Returns True
if there was no valid input for current!
Input strings: e.g. "1.2.3"; always with Major, Minor and Patch!
"""
log.info("current DB: %s minimum DB: %s" % (current, minimum))
try:
currMajor, currMinor, currPatch = current.split(".")
except ValueError:
# there WAS no current DB, e.g. deleted.
return True
minMajor, minMinor, minPatch = minimum.split(".")
currMajor = int(currMajor)
currMinor = int(currMinor)
currPatch = int(currPatch)
minMajor = int(minMajor)
minMinor = int(minMinor)
minPatch = int(minPatch)
if currMajor > minMajor:
return True
elif currMajor < minMajor:
return False
if currMinor > minMinor:
return True
elif currMinor < minMinor:
return False
if currPatch >= minPatch:
return True
else:
return False
def normalize_nodes(text):
# For video nodes
text = text.replace(":", "")

View file

@ -68,7 +68,7 @@
<setting id="enableExportSongRating" type="bool" label="30525" default="false" visible="false" />
<setting id="kodiplextimeoffset" type="number" label="Time difference in seconds (Koditime - Plextime)" default="0" visible="false" option="int" />
<setting id="enableUpdateSongRating" type="bool" label="30526" default="false" visible="false" />
<setting id="themoviedbAPIKey" type="text" default="ae06df54334aa653354e9a010f4b81cb" visible="false"/>
<setting id="themoviedbAPIKey" type="text" default="19c90103adb9e98f2172c6a6a3d85dc4" visible="false"/>
<setting id="FanArtTVAPIKey" type="text" default="639191cb0774661597f28a47e7e2bad5" visible="false"/>
</category>

BIN
themoviedb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB