mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-11-18 22:36:35 +00:00
Version 4.0.0 (#182)
* Adjust refresh behavior
* Fix favorites
* Add option to mask info
* Fix keymap delete
* Fix empty show
* Version bump 3.1.14
* Reset rescan flag
* Fix subtitles encoding
* Fix path verification
* Fix update library
Plug in remove library percentage
* Fix unauthorized behavior
Reprompt user with login
* Fix series pooling
* Version bump 3.1.15
* Fix for additional users
Return all users, not just public users
* Fix http potential errors
Prevent from going further if {server} or {userid} is requested but not filled to avoid 401 errors
* Fix extra fanart
* Fix patch
make a case insensitive search
* Version bump 3.1.16
Additional logging, fix kodi source.
* Fix library tags on update
* Version bump 3.1.17
* Fix season artwork
* Fix season artwork
* Fix logging
* Fix blank files sources
* Add backup option
* Fix userdata song
* Transfer data.txt to data.json
Use default port for webserver caching
* Fix mixed content shortcut
* Fix path encoding for patch
Hopefully this works...
* Fix source nonetype error
Just incase, wrap in a try/except because it's not important.
* Base fast sync on server time
Try to fix music video refresh to prevent cursor from moving up.
* Prep subfolders for dynamic
Support homevideos for now
* Fix empty artist, missing Title
* Version bump 3.1.18a
* Version bump for objects
171076013
* Notify user of large updates
Give option to back out if the user wants to manually update the libraries
* Fix sources.xml verification
* Prevent error in monitor
Put in place try/except in case data is None
* Remember sync position for manual triggers
Allow to resume sync on restart for manual user triggers (update, repair). Automatically refresh boxsets if movie library is selected.
use waitForAbort and emby_should_stop prop to terminate threads
* Update string for sync later
* Add subfolders for dynamic movies
* Small fixes
* Version bump 3.1.19
* Fix fast sync
try/except, default back to previous behavior.
* Fix artwork
* Change settings name
To ensure it takes default value instead of previous value set in 3.0.34
* Fix transcode
flac and live tv
* Fix episodes for series pooling
* Add live tv support
* Version bump 3.1.20
* Revert "Small fixes"
This reverts commit 9ec1fa3585.
* Version bump 3.1.21
* Fix playback starting server connection instance
* Fix show update
* Fix boxsets
* Fix lastplayed
* Patch to support pre 3.6 libraries
* Fix slowness
* Plug in settings for threading
* Plug in settings for threading
* Adjust sleep behavior
* Version bump 3.1.22
* Fix server detection in monitor
* Version bump 3.1.23
* Fix potential error with checksum
* Fix missing new artists
* Fix library sync
Adjust lock, re-add screensaver deactivated during sync, prep compare sync, stop library updates from being processed before startup sync is completed
* Version bump 3.1.25
* Fix local trailers
* Adjust lock modification
* Check db version
* Prevent error from creating nodes
The addon automatically creates nodes at startup with prefilled information. Prevent errors in the event something goes wrong. It will fix itself down the line, after user has logged in.
* Version bump 3.1.26
* Revert "Version bump 3.1.26"
This reverts commit c583a69a4b.
* Fix screensaver toggle
* Fix source selection for direct stream
* Version bump 3.1.26
* Add progress for updates
* Revise progress bar
Fix typos and subsetting
* content notification
* Remove content with update library
Now remove irrelevant content as well
* Fix slowness
* Version bump 3.1.27
* Stop trying to get items if server offline
* Fix content type for dynamic music
* Fix resume sync
Now save progress, unless exited due to path validation
* Fix artwork for shortcuts on profile switch
* Add force transcode settings
* Fix audiobooks back to video type
Add shortcuts. Audiobook can't be music type otherwise it break resume behavior and it won't play the right item. Has to be video type.
* Update general info
To finish, download and installation
* Update README.md
* Move welcome message to service
* Prevent patch loop
Try once, then let it go, to avoid locking user in a restart loop
* Review library threads
* Prep for audiobook transcode
Still need to implement universal for audio transcode
* Version bump 3.1.28
* Fix emby database locked
* Fix regression to welcome message
* Version bump 3.1.29
* Adjust playback
Allow direct play for http streams
* Ensure all threads are terminated correctly
* Fix empty results due to error 500
* Fix boxset refresh
* Fix resume sync behavior
Allow to complete the startup sync in the event user backs out of resume sync
* Version bump 3.1.30
* Update patch
Move patch from cache to addon_data. No longer need to restart Kodi to apply the first patch.
* Fix inital sync leading to fast sync
* Fix user settings
Due to api change in 3.6.0.55
* krypton update
* Adjust for resume settings
With .55 the resume setting is set per library. Instead query server to see if the item is played to offer delete
* Restart service upon check for updates
To reload the new objects module.
* Fix update library
Only do the compare when user selects update library, also add a restart service option in the add-on settings > advanced
* Version bump 3.1.31
* Update dependencies
* Update FR translation
* Update DE translation
* Add translation
* Support up next
* Small service adjustment
* Krypton update to support upnext
* Add a verification onwake
Somehow, Kodi can trigger OnWake without first trigger OnSleep.
* Fix loading if special char in path
* Add logging and small fixes
Prepare userdata by date modified
* Version bump 3.1.32
* Change default behavior of startup dialog
In case it is forced closed by Kodi, allow the sync to proceed
* Ensure deliveryurl is an actual url
* Update README.md
* Fix nextup
* Fix dynamic widgets
* Detect coreelect, etc
* Fix progress report
Silent RefreshProgress in websocket
* Follow emby settings for subtitles
* Version bump 3.1.33
* Add Italian translation
* Fix playback for server 3.6.0.61
* Version bump 3.1.34a
* Add silent catch for errors
* Adjust playback progress monitor
Only track progress report if the item is an emby item
* Fix subtitles not following server settings
* Add remove libraries, fix mixed libraries
* Fix live tv
For now, use transcode since direct play returns a 127.0.0.1 unusable address as the path.
* Allow live tv to direct stream
* Fix LiveTV
* Add setting to sync during playback
* Fix updates
* Fix encoding error
* Add optional rotten tomatoes option
* Version bump 3.1.35
* Fix emby connect auth string
Was preventing proper device detection when using emby connect, play to, etc.
* Add setup RT
* Fix audio/sub change
Only for addon playback
* Add developer mode
* Update patch
Check for updates + dev = forced grab from github
* Fix RT string
* Fix patch
Allow dev mode to redownload zip
* Fix patch
ugh sleep!!
* Verify patch connection
* Version bump 3.1.36
* Fix libraries being wiped
Catch errors to prevent false positive
* Add dateutil library
* Prep convert to local time
* Fix string
* Prep for multi db version support
* Fix service restart
* Add shortcut restart addon
Add notification
* Add database discovery
* Ensure previous playback terminated
* Update translation
New: Polish, Dutch Updated: German, French, Italian
* Version bump 3.1.37
* Quick fix for new library dateutil
* Catch error for dateutil
In the event the server has some weird date that can't be converted
* Version bump 3.1.38
* Fix dateutil import
* Fix db discovery
Ignore emby.db
* Version bump 3.1.39
* Add a delay if setup not completed
Avoid crash from everything loading at once.
* Fix database discovery
Add table verification + date modified verification
* Container optional playutils
* Version bump 3.1.40
* Adjust database discovery
Compare loaded vs discovered to avoid loading old databases by accident.
* Version bump 3.1.41
* Fix discovery toggle
* Version bump 3.1.42
* Add webservice for playback prep
* Fix service restart
* Version bump 3.1.43
* Update default sync indicator
Based on overall feedback
* Fix check update
* Fix if server is selected but unavailable
* Support songs without albums
* Fix encode and params
* Increase retry timeout
* Fix update generating duplicates
* Add manage libraries
Too many entries
* Fix database discovery
* Fixed transcode via context menu
* Fix context transcode
* Quiet webservice
* Update Krypton objects
* Fix database discovery prompt
* fixed video listitem issues for krypton
* load all item details for playlists
* Fix playlist
* Version bump 3.1.44
* Fix force hi10p transcoding behavior
Fixes the "Force Hi10p transcoding" option to only apply to h264 video codecs
* Clear playlist on player.onstop
* Don't clear playlist if busy spinner is active
* Fix case sensitive issue at calling the log function
* fix db stuff (#164)
* Reload objects upon initial setup
* Fix database discovery
ignore db-journal
* Update translation
German, Italian
* Use LastConnectionMode for server test
* Fix compare sync
* Version bump 3.1.45
* Ensure widgets get updated
Container.Refresh alone doesn't seem to work
* Update database discovery
* Re-add texture to database discovery
* Add option to enable/disable service
* Remove unused strings
* Fix object reload upon restart service
* Update Krypton objects
* Update translation
Dutch, Polish
* Version bump 3.1.46
* Adjust client api
* Adjust subtitles behavior
* Fix string typo
* Only run one full sync instance
Prevent user from launching multiple syncs and freezing the add-on.
* added "playlists" to wnodes
* Disable Audiobooks
Server doesn't have a set structure yet. This feature is broken atm.
* Version bump 4.0.0
* License GPL v3
* Update readme
This commit is contained in:
parent
b8613e1e66
commit
bab67ddf9b
349 changed files with 67373 additions and 21636 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# Dummy file to make this directory a package.
|
||||
from serverconnect import ServerConnect
|
||||
from usersconnect import UsersConnect
|
||||
from loginconnect import LoginConnect
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ import os
|
|||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
from utils import window
|
||||
from helper import window, addon_id
|
||||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
addon = xbmcaddon.Addon('plugin.video.emby')
|
||||
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
|
|
@ -51,13 +49,12 @@ class ContextMenu(xbmcgui.WindowXMLDialog):
|
|||
self.getControl(USER_IMAGE).setImage(window('EmbyUserImage'))
|
||||
|
||||
height = 479 + (len(self._options) * 55)
|
||||
log.info("options: %s", self._options)
|
||||
LOG.info("options: %s", self._options)
|
||||
self.list_ = self.getControl(LIST)
|
||||
|
||||
for option in self._options:
|
||||
self.list_.addItem(self._add_listitem(option))
|
||||
|
||||
self.background = self._add_editcontrol(730, height, 30, 450)
|
||||
self.setFocus(self.list_)
|
||||
|
||||
def onAction(self, action):
|
||||
|
|
@ -70,13 +67,13 @@ class ContextMenu(xbmcgui.WindowXMLDialog):
|
|||
if self.getFocusId() == LIST:
|
||||
option = self.list_.getSelectedItem()
|
||||
self.selected_option = option.getLabel()
|
||||
log.info('option selected: %s', self.selected_option)
|
||||
LOG.info('option selected: %s', self.selected_option)
|
||||
|
||||
self.close()
|
||||
|
||||
def _add_editcontrol(self, x, y, height, width, password=0):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlImage(0, 0, 0, 0,
|
||||
filename=os.path.join(media, "white.png"),
|
||||
aspectRatio=0,
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ import os
|
|||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
from utils import language as lang
|
||||
from helper import _, addon_id, settings, dialog
|
||||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
addon = xbmcaddon.Addon('plugin.video.emby')
|
||||
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
|
|
@ -40,8 +38,10 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_connect_manager(self, connect_manager):
|
||||
self.connect_manager = connect_manager
|
||||
def set_args(self, **kwargs):
|
||||
# connect_manager, user_image, servers, emby_connect
|
||||
for key, value in kwargs.iteritems():
|
||||
setattr(self, key, value)
|
||||
|
||||
def is_logged_in(self):
|
||||
return True if self._user else False
|
||||
|
|
@ -52,9 +52,9 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def onInit(self):
|
||||
|
||||
self.user_field = self._add_editcontrol(725, 385, 40, 500)
|
||||
self.user_field = self._add_editcontrol(755, 338, 40, 415)
|
||||
self.setFocus(self.user_field)
|
||||
self.password_field = self._add_editcontrol(725, 470, 40, 500, password=1)
|
||||
self.password_field = self._add_editcontrol(755, 448, 40, 415, password=1)
|
||||
self.signin_button = self.getControl(SIGN_IN)
|
||||
self.remind_button = self.getControl(CANCEL)
|
||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||
|
|
@ -78,8 +78,8 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
if not user or not password:
|
||||
# Display error
|
||||
self._error(ERROR['Empty'], lang(30608))
|
||||
log.error("Username or password cannot be null")
|
||||
self._error(ERROR['Empty'], _('empty_user_pass'))
|
||||
LOG.error("Username or password cannot be null")
|
||||
|
||||
elif self._login(user, password):
|
||||
self.close()
|
||||
|
|
@ -99,13 +99,14 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def _add_editcontrol(self, x, y, height, width, password=0):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||
label="User",
|
||||
font="font10",
|
||||
textColor="ff525252",
|
||||
focusTexture=os.path.join(media, "button-focus.png"),
|
||||
noFocusTexture=os.path.join(media, "button-focus.png"),
|
||||
font="font13",
|
||||
textColor="FF52b54b",
|
||||
disabledColor="FF888888",
|
||||
focusTexture="-",
|
||||
noFocusTexture="-",
|
||||
isPassword=password)
|
||||
control.setPosition(x, y)
|
||||
control.setHeight(height)
|
||||
|
|
@ -116,21 +117,31 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def _login(self, username, password):
|
||||
|
||||
result = self.connect_manager.loginToConnect(username, password)
|
||||
result = self.connect_manager['login-connect'](username, password)
|
||||
if result is False:
|
||||
self._error(ERROR['Invalid'], lang(33009))
|
||||
self._error(ERROR['Invalid'], _('invalid_auth'))
|
||||
|
||||
return False
|
||||
else:
|
||||
self._user = result
|
||||
return True
|
||||
|
||||
self._user = result
|
||||
username = result['User']['Name']
|
||||
settings('connectUsername', value=username)
|
||||
settings('idMethod', value="1")
|
||||
|
||||
dialog("notification", heading="{emby}", message="%s %s" % (_(33000), username.decode('utf-8')),
|
||||
icon=result['User'].get('ImageUrl') or "{emby}",
|
||||
time=2000,
|
||||
sound=False)
|
||||
|
||||
return True
|
||||
|
||||
def _error(self, state, message):
|
||||
|
||||
self.error = state
|
||||
self.error_msg.setLabel(message)
|
||||
self.error_toggle.setVisibleCondition('True')
|
||||
self.error_toggle.setVisibleCondition('true')
|
||||
|
||||
def _disable_error(self):
|
||||
|
||||
self.error = None
|
||||
self.error_toggle.setVisibleCondition('False')
|
||||
self.error_toggle.setVisibleCondition('false')
|
||||
|
|
|
|||
|
|
@ -8,14 +8,11 @@ import os
|
|||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
import read_embyserver as embyserver
|
||||
from utils import language as lang
|
||||
from helper import _, addon_id
|
||||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
addon = xbmcaddon.Addon('plugin.video.emby')
|
||||
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
|
|
@ -23,10 +20,7 @@ SIGN_IN = 200
|
|||
CANCEL = 201
|
||||
ERROR_TOGGLE = 202
|
||||
ERROR_MSG = 203
|
||||
ERROR = {
|
||||
'Invalid': 1,
|
||||
'Empty': 2
|
||||
}
|
||||
ERROR = {'Invalid': 1, 'Empty': 2}
|
||||
|
||||
##################################################################################################
|
||||
|
||||
|
|
@ -39,19 +33,16 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
self.emby = embyserver.Read_EmbyServer()
|
||||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_args(self, **kwargs):
|
||||
# connect_manager, user_image, servers, emby_connect
|
||||
for key, value in kwargs.iteritems():
|
||||
setattr(self, key, value)
|
||||
|
||||
def is_logged_in(self):
|
||||
return True if self._user else False
|
||||
|
||||
def set_server(self, server):
|
||||
self.server = server
|
||||
|
||||
def set_user(self, user):
|
||||
self.username = user or {}
|
||||
|
||||
def get_user(self):
|
||||
return self._user
|
||||
|
||||
|
|
@ -61,10 +52,11 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
self.cancel_button = self.getControl(CANCEL)
|
||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||
self.error_msg = self.getControl(ERROR_MSG)
|
||||
self.user_field = self._add_editcontrol(725, 400, 40, 500)
|
||||
self.password_field = self._add_editcontrol(725, 475, 40, 500, password=1)
|
||||
self.user_field = self._add_editcontrol(755, 433, 40, 415)
|
||||
self.password_field = self._add_editcontrol(755, 543, 40, 415, password=1)
|
||||
|
||||
if self.username:
|
||||
|
||||
self.user_field.setText(self.username)
|
||||
self.setFocus(self.password_field)
|
||||
else:
|
||||
|
|
@ -88,8 +80,8 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
if not user:
|
||||
# Display error
|
||||
self._error(ERROR['Empty'], lang(30613))
|
||||
log.error("Username cannot be null")
|
||||
self._error(ERROR['Empty'], _('empty_user'))
|
||||
LOG.error("Username cannot be null")
|
||||
|
||||
elif self._login(user, password):
|
||||
self.close()
|
||||
|
|
@ -108,31 +100,31 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def _add_editcontrol(self, x, y, height, width, password=0):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||
label="User",
|
||||
font="font10",
|
||||
textColor="ff525252",
|
||||
focusTexture=os.path.join(media, "button-focus.png"),
|
||||
noFocusTexture=os.path.join(media, "button-focus.png"),
|
||||
font="font13",
|
||||
textColor="FF52b54b",
|
||||
disabledColor="FF888888",
|
||||
focusTexture="-",
|
||||
noFocusTexture="-",
|
||||
isPassword=password)
|
||||
control.setPosition(x, y)
|
||||
control.setHeight(height)
|
||||
control.setWidth(width)
|
||||
|
||||
self.addControl(control)
|
||||
|
||||
return control
|
||||
|
||||
def _login(self, username, password):
|
||||
|
||||
try:
|
||||
result = self.emby.loginUser(self.server, username, password)
|
||||
except Exception as error:
|
||||
log.info("Error doing login: " + str(error))
|
||||
result = None
|
||||
mode = self.connect_manager['server-mode']
|
||||
server = self.connect_manager['server-address']
|
||||
result = self.connect_manager['login'](server, username, password, False if mode == 1 and server.startswith('http://') else True)
|
||||
|
||||
if result is None:
|
||||
self._error(ERROR['Invalid'], lang(33009))
|
||||
if not result:
|
||||
self._error(ERROR['Invalid'], _('invalid_auth'))
|
||||
return False
|
||||
else:
|
||||
self._user = result
|
||||
|
|
@ -142,9 +134,9 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
self.error = state
|
||||
self.error_msg.setLabel(message)
|
||||
self.error_toggle.setVisibleCondition('True')
|
||||
self.error_toggle.setVisibleCondition('true')
|
||||
|
||||
def _disable_error(self):
|
||||
|
||||
self.error = None
|
||||
self.error_toggle.setVisibleCondition('False')
|
||||
self.error_toggle.setVisibleCondition('false')
|
||||
|
|
|
|||
58
resources/lib/dialogs/resume.py
Normal file
58
resources/lib/dialogs/resume.py
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
##################################################################################################
|
||||
|
||||
import logging
|
||||
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
##################################################################################################
|
||||
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
RESUME = 3010
|
||||
START_BEGINNING = 3011
|
||||
|
||||
##################################################################################################
|
||||
|
||||
|
||||
class ResumeDialog(xbmcgui.WindowXMLDialog):
|
||||
|
||||
_resume_point = None
|
||||
selected_option = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_resume_point(self, time):
|
||||
self._resume_point = time
|
||||
|
||||
def is_selected(self):
|
||||
return True if self.selected_option is not None else False
|
||||
|
||||
def get_selected(self):
|
||||
return self.selected_option
|
||||
|
||||
def onInit(self):
|
||||
|
||||
self.getControl(RESUME).setLabel(self._resume_point)
|
||||
self.getControl(START_BEGINNING).setLabel(xbmc.getLocalizedString(12021))
|
||||
|
||||
def onAction(self, action):
|
||||
|
||||
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
|
||||
self.close()
|
||||
|
||||
def onClick(self, controlID):
|
||||
|
||||
if controlID == RESUME:
|
||||
self.selected_option = 1
|
||||
self.close()
|
||||
|
||||
if controlID == START_BEGINNING:
|
||||
self.selected_option = 0
|
||||
self.close()
|
||||
|
|
@ -7,21 +7,18 @@ import logging
|
|||
import xbmc
|
||||
import xbmcgui
|
||||
|
||||
import connect.connectionmanager as connectionmanager
|
||||
from utils import language as lang
|
||||
from helper import _
|
||||
from emby.core.connection_manager import CONNECTION_STATE
|
||||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
|
||||
CONN_STATE = connectionmanager.ConnectionState
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
ACTION_SELECT_ITEM = 7
|
||||
ACTION_MOUSE_LEFT_CLICK = 100
|
||||
USER_IMAGE = 150
|
||||
USER_NAME = 151
|
||||
LIST = 155
|
||||
CANCEL = 201
|
||||
MESSAGE_BOX = 202
|
||||
|
|
@ -35,7 +32,6 @@ MANUAL_SERVER = 206
|
|||
|
||||
class ServerConnect(xbmcgui.WindowXMLDialog):
|
||||
|
||||
username = ""
|
||||
user_image = None
|
||||
servers = []
|
||||
|
||||
|
|
@ -49,7 +45,7 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
|
|||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_args(self, **kwargs):
|
||||
# connect_manager, username, user_image, servers, emby_connect
|
||||
# connect_manager, user_image, servers, emby_connect
|
||||
for key, value in kwargs.iteritems():
|
||||
setattr(self, key, value)
|
||||
|
||||
|
|
@ -77,13 +73,11 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
|
|||
server_type = "wifi" if server.get('ExchangeToken') else "network"
|
||||
self.list_.addItem(self._add_listitem(server['Name'], server['Id'], server_type))
|
||||
|
||||
self.getControl(USER_NAME).setLabel("%s %s" % (lang(33000), self.username.decode('utf-8')))
|
||||
|
||||
if self.user_image is not None:
|
||||
self.getControl(USER_IMAGE).setImage(self.user_image)
|
||||
|
||||
if not self.emby_connect: # Change connect user
|
||||
self.getControl(EMBY_CONNECT).setLabel("[UPPERCASE][B]"+lang(30618)+"[/B][/UPPERCASE]")
|
||||
self.getControl(EMBY_CONNECT).setLabel("[B]%s[/B]" % _(30618))
|
||||
|
||||
if self.servers:
|
||||
self.setFocus(self.list_)
|
||||
|
|
@ -107,16 +101,16 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
|
|||
if self.getFocusId() == LIST:
|
||||
server = self.list_.getSelectedItem()
|
||||
selected_id = server.getProperty('id')
|
||||
log.info('Server Id selected: %s', selected_id)
|
||||
LOG.info('Server Id selected: %s', selected_id)
|
||||
|
||||
if self._connect_server(selected_id):
|
||||
self.message_box.setVisibleCondition('False')
|
||||
self.message_box.setVisibleCondition('false')
|
||||
self.close()
|
||||
|
||||
def onClick(self, control):
|
||||
|
||||
if control == EMBY_CONNECT:
|
||||
self.connect_manager.clearData()
|
||||
self.connect_manager.clear_data()
|
||||
self._connect_login = True
|
||||
self.close()
|
||||
|
||||
|
|
@ -129,15 +123,18 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def _connect_server(self, server_id):
|
||||
|
||||
server = self.connect_manager.getServerInfo(server_id)
|
||||
self.message.setLabel("%s %s..." % (lang(30610), server['Name']))
|
||||
self.message_box.setVisibleCondition('True')
|
||||
self.busy.setVisibleCondition('True')
|
||||
result = self.connect_manager.connectToServer(server)
|
||||
server = self.connect_manager.get_server_info(server_id)
|
||||
self.message.setLabel("%s %s..." % (_(30610), server['Name']))
|
||||
|
||||
if result['State'] == CONN_STATE['Unavailable']:
|
||||
self.busy.setVisibleCondition('False')
|
||||
self.message.setLabel(lang(30609))
|
||||
self.message_box.setVisibleCondition('true')
|
||||
self.busy.setVisibleCondition('true')
|
||||
|
||||
result = self.connect_manager['connect-to-server'](server)
|
||||
|
||||
if result['State'] == CONNECTION_STATE['Unavailable']:
|
||||
self.busy.setVisibleCondition('false')
|
||||
|
||||
self.message.setLabel(_(30609))
|
||||
return False
|
||||
else:
|
||||
xbmc.sleep(1000)
|
||||
|
|
|
|||
|
|
@ -8,15 +8,12 @@ import os
|
|||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
import connect.connectionmanager as connectionmanager
|
||||
from utils import language as lang
|
||||
from helper import _, addon_id
|
||||
from emby.core.connection_manager import CONNECTION_STATE
|
||||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
addon = xbmcaddon.Addon('plugin.video.emby')
|
||||
|
||||
CONN_STATE = connectionmanager.ConnectionState
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
|
|
@ -42,8 +39,10 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_connect_manager(self, connect_manager):
|
||||
self.connect_manager = connect_manager
|
||||
def set_args(self, **kwargs):
|
||||
# connect_manager, user_image, servers, emby_connect
|
||||
for key, value in kwargs.iteritems():
|
||||
setattr(self, key, value)
|
||||
|
||||
def is_connected(self):
|
||||
return True if self._server else False
|
||||
|
|
@ -57,8 +56,8 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
self.cancel_button = self.getControl(CANCEL)
|
||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||
self.error_msg = self.getControl(ERROR_MSG)
|
||||
self.host_field = self._add_editcontrol(725, 400, 40, 500)
|
||||
self.port_field = self._add_editcontrol(725, 525, 40, 500)
|
||||
self.host_field = self._add_editcontrol(755, 433, 40, 415)
|
||||
self.port_field = self._add_editcontrol(755, 543, 40, 415)
|
||||
|
||||
self.port_field.setText('8096')
|
||||
self.setFocus(self.host_field)
|
||||
|
|
@ -79,10 +78,10 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
server = self.host_field.getText()
|
||||
port = self.port_field.getText()
|
||||
|
||||
if not server or not port:
|
||||
if not server:
|
||||
# Display error
|
||||
self._error(ERROR['Empty'], lang(30617))
|
||||
log.error("Server or port cannot be null")
|
||||
self._error(ERROR['Empty'], _('empty_server'))
|
||||
LOG.error("Server cannot be null")
|
||||
|
||||
elif self._connect_to_server(server, port):
|
||||
self.close()
|
||||
|
|
@ -101,13 +100,14 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def _add_editcontrol(self, x, y, height, width):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||
label="User",
|
||||
font="font10",
|
||||
textColor="ffc2c2c2",
|
||||
focusTexture=os.path.join(media, "button-focus.png"),
|
||||
noFocusTexture=os.path.join(media, "button-focus.png"))
|
||||
font="font13",
|
||||
textColor="FF52b54b",
|
||||
disabledColor="FF888888",
|
||||
focusTexture="-",
|
||||
noFocusTexture="-")
|
||||
control.setPosition(x, y)
|
||||
control.setHeight(height)
|
||||
control.setWidth(width)
|
||||
|
|
@ -117,12 +117,12 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def _connect_to_server(self, server, port):
|
||||
|
||||
server_address = "%s:%s" % (server, port)
|
||||
self._message("%s %s..." % (lang(30610), server_address))
|
||||
result = self.connect_manager.connectToAddress(server_address)
|
||||
server_address = "%s:%s" % (server, port) if port else server
|
||||
self._message("%s %s..." % (_(30610), server_address))
|
||||
result = self.connect_manager['manual-server'](server_address)
|
||||
|
||||
if result['State'] == CONN_STATE['Unavailable']:
|
||||
self._message(lang(30609))
|
||||
if result['State'] == CONNECTION_STATE['Unavailable']:
|
||||
self._message(_(30609))
|
||||
return False
|
||||
else:
|
||||
self._server = result['Servers'][0]
|
||||
|
|
@ -131,15 +131,15 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
def _message(self, message):
|
||||
|
||||
self.error_msg.setLabel(message)
|
||||
self.error_toggle.setVisibleCondition('True')
|
||||
self.error_toggle.setVisibleCondition('true')
|
||||
|
||||
def _error(self, state, message):
|
||||
|
||||
self.error = state
|
||||
self.error_msg.setLabel(message)
|
||||
self.error_toggle.setVisibleCondition('True')
|
||||
self.error_toggle.setVisibleCondition('true')
|
||||
|
||||
def _disable_error(self):
|
||||
|
||||
self.error = None
|
||||
self.error_toggle.setVisibleCondition('False')
|
||||
self.error_toggle.setVisibleCondition('false')
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ import xbmcgui
|
|||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
ACTION_PARENT_DIR = 9
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACK = 92
|
||||
|
|
@ -34,11 +33,10 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
|
|||
self.kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_server(self, server):
|
||||
self.server = server
|
||||
|
||||
def set_users(self, users):
|
||||
self.users = users
|
||||
def set_args(self, **kwargs):
|
||||
# connect_manager, user_image, servers, emby_connect
|
||||
for key, value in kwargs.iteritems():
|
||||
setattr(self, key, value)
|
||||
|
||||
def is_user_selected(self):
|
||||
return True if self._user else False
|
||||
|
|
@ -54,7 +52,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
self.list_ = self.getControl(LIST)
|
||||
for user in self.users:
|
||||
user_image = ("userflyoutdefault2.png" if 'PrimaryImageTag' not in user
|
||||
user_image = ("items/logindefault.png" if 'PrimaryImageTag' not in user
|
||||
else self._get_user_artwork(user['Id'], 'Primary'))
|
||||
self.list_.addItem(self._add_listitem(user['Name'], user['Id'], user_image))
|
||||
|
||||
|
|
@ -81,7 +79,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
|
|||
if self.getFocusId() == LIST:
|
||||
user = self.list_.getSelectedItem()
|
||||
selected_id = user.getProperty('id')
|
||||
log.info('User Id selected: %s', selected_id)
|
||||
LOG.info('User Id selected: %s', selected_id)
|
||||
|
||||
for user in self.users:
|
||||
if user['Id'] == selected_id:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue