added reset settings - still needs a bit of work

This commit is contained in:
im85288 2015-04-02 20:47:06 +01:00
parent be07c1125d
commit 6b6f77dbff
3 changed files with 197 additions and 33 deletions

View File

@ -17,15 +17,19 @@ WINDOW = xbmcgui.Window( 10000 )
import Utils as utils import Utils as utils
from PlaybackUtils import PlaybackUtils from PlaybackUtils import PlaybackUtils
# get the actions... try:
params=utils.get_params(sys.argv[2]) params=utils.get_params(sys.argv[2])
mode = params.get('mode',"")
id = params.get('id',"")
except:
params={}
mode=None
id=None
mode = params.get('mode',"") if mode != None and mode == "play":
id = params.get('id',"")
if mode == "play":
PlaybackUtils().PLAY(id) PlaybackUtils().PLAY(id)
elif sys.argv[1] == "reset":
utils.reset()
else: else:
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)') xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')

View File

@ -72,7 +72,7 @@ def checkAuthentication():
try: try:
downloadUtils.authenticate() downloadUtils.authenticate()
except Exception, e: except Exception, e:
logMsg("MB3 Syncer authentication failed",e) logMsg("Emby authentication failed",e)
pass pass
def prettifyXml(elem): def prettifyXml(elem):
@ -148,3 +148,178 @@ def removeDirectory(path):
xbmcvfs.delete(os.path.join(path,file)) xbmcvfs.delete(os.path.join(path,file))
xbmcvfs.rmdir(path) xbmcvfs.rmdir(path)
def reset():
# clear video database
connection = KodiSQL()
cursor = connection.cursor()
try:
cursor.execute("DROP TABLE episode;")
except:
pass
try:
cursor.execute("DROP TABLE movie;")
except:
pass
try:
cursor.execute("DROP TABLE tvshow;")
except:
pass
try:
cursor.execute("DROP TABLE actors;")
except:
pass
try:
cursor.execute("DROP TABLE actorlinkepisode;")
except:
pass
try:
cursor.execute("DROP TABLE actorlinkmovie;")
except:
pass
try:
cursor.execute("DROP TABLE actorlinktvshow;")
except:
pass
try:
cursor.execute("DROP TABLE art;")
except:
pass
try:
cursor.execute("DROP TABLE artistlinkmusicvideo;")
except:
pass
try:
cursor.execute("DROP TABLE countrylinkmovie;")
except:
pass
try:
cursor.execute("DROP TABLE directorlinkepisode;")
except:
pass
try:
cursor.execute("DROP TABLE directorlinkmovie;")
except:
pass
try:
cursor.execute("DROP TABLE directorlinkmusicvideo;")
except:
pass
try:
cursor.execute("DROP TABLE directorlinktvshow;")
except:
pass
try:
cursor.execute("DROP TABLE files;")
except:
pass
try:
cursor.execute("DROP TABLE genre;")
except:
pass
try:
cursor.execute("DROP TABLE genrelinkmovie;")
except:
pass
try:
cursor.execute("DROP TABLE genrelinkmusicvideo;")
except:
pass
try:
cursor.execute("DROP TABLE genrelinktvshow;")
except:
pass
try:
cursor.execute("DROP TABLE movielinktvshow;")
except:
pass
try:
cursor.execute("DROP TABLE musicvideo;")
except:
pass
try:
cursor.execute("DROP TABLE path;")
except:
pass
try:
cursor.execute("DROP TABLE seasons;")
except:
pass
try:
cursor.execute("DROP TABLE sets;")
except:
pass
try:
cursor.execute("DROP TABLE stacktimes;")
except:
pass
try:
cursor.execute("DROP TABLE streamdetails;")
except:
pass
try:
cursor.execute("DROP TABLE studio;")
except:
pass
try:
cursor.execute("DROP TABLE studiolinkmovie;")
except:
pass
try:
cursor.execute("DROP TABLE studiolinkmusicvideo;")
except:
pass
try:
cursor.execute("DROP TABLE studiolinktvshow;")
except:
pass
try:
cursor.execute("DROP TABLE tag;")
except:
pass
try:
cursor.execute("DROP TABLE taglinks;")
except:
pass
try:
cursor.execute("DROP TABLE tvshowlinkepisode;")
except:
pass
try:
cursor.execute("DROP TABLE tvshowlinkpath;")
except:
pass
try:
cursor.execute("DROP TABLE version;")
except:
pass
try:
cursor.execute("DROP TABLE writerlinkepisode;")
except:
pass
try:
cursor.execute("DROP TABLE writerlinkmovie;")
except:
pass
try:
connection.commit()
logMsg("Emby","Removed tables from kodi database")
finally:
cursor.close()
# check for old library folder and delete if present
addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
dataPath = os.path.join(addondir,"library" + os.sep)
removeDirectory(dataPath)
# remove old entries from sources.xml
# reset addon settings values
addon.setSetting("SyncInstallRunDone", "false")
addon.setSetting("SyncFirstCountsRunDone", "false")
dialog = xbmcgui.Dialog()
dialog.ok('Emby Reset', 'Reset of Emby has completed, please restart.')

View File

@ -1,47 +1,32 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings> <settings>
<category label="30014"> <!-- Emby --> <category label="30014"> <!-- Emby -->
<setting id="ipaddress" type="text" label="30000" default="" visible="true" enable="true" /> <setting id="ipaddress" type="text" label="30000" default="" visible="true" enable="true" />
<setting id="port" type="text" label="30030" default="8096" visible="true" enable="true" /> <setting id="port" type="text" label="30030" default="8096" visible="true" enable="true" />
<setting id="https" type="bool" label="Enable HTTPS" visible="true" enable="true" /> <setting id="https" type="bool" label="Enable HTTPS" visible="true" enable="true" />
<setting type="sep" /> <setting type="sep" />
<setting id="username" type="text" label="30024" /> <setting id="username" type="text" label="30024" />
<setting type="sep" /> <setting type="sep" />
<setting id="deviceName" type="text" label="30016" default="Kodi"/> <setting id="deviceName" type="text" label="30016" default="Kodi" />
</category> </category>
<!-- <category label="Manual sync"> <setting label="Run manual full sync now" type="action" action="RunScript(plugin.video.mbsync, fullsync)" /> <setting label="Run manual incremental sync now" type="action" action="RunScript(plugin.video.mbsync, incrementalsync)" /> <setting label="Reset entire local library" type="action" action="RunScript(plugin.video.mbsync, reset)" /> </category> -->
<!--
<category label="Manual sync">
<setting label="Run manual full sync now" type="action" action="RunScript(plugin.video.mbsync, fullsync)" />
<setting label="Run manual incremental sync now" type="action" action="RunScript(plugin.video.mbsync, incrementalsync)" />
<setting label="Reset entire local library" type="action" action="RunScript(plugin.video.mbsync, reset)" />
</category>
-->
<category label="Sync Options"> <category label="Sync Options">
<!-- thememusic and extrafanart sync no longer needed when we use the native playback --> <!-- thememusic and extrafanart sync no longer needed when we use the native playback -->
<setting id="syncThemeMusic" type="bool" label="30236" default="false" visible="false" enable="true" /> <setting id="syncThemeMusic" type="bool" label="30236" default="false" visible="false" enable="true" />
<setting id="syncExtraFanart" type="bool" label="30237" default="false" visible="false" enable="true" /> <setting id="syncExtraFanart" type="bool" label="30237" default="false" visible="false" enable="true" />
<setting id="syncMovieBoxSets" type="bool" label="30238" default="false" visible="true" enable="true" /> <setting id="syncMovieBoxSets" type="bool" label="30238" default="false" visible="true" enable="true" />
<setting id="enablePlayCountSync" type="bool" label="Enable watched/resume status sync" default="true" visible="true" enable="true" /> <setting id="enablePlayCountSync" type="bool" label="Enable watched/resume status sync" default="true" visible="true" enable="true" />
<setting id="dbSyncIndication" type="labelenum" label="DB Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" /> <setting id="dbSyncIndication" type="labelenum" label="DB Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" />
<setting id="playCountSyncIndication" type="labelenum" label="Play Count Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" /> <setting id="playCountSyncIndication" type="labelenum" label="Play Count Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" />
</category> </category>
<category label="Playback"> <!-- Extra Sync options --> <category label="Playback"> <!-- Extra Sync options -->
<!-- addExtraPlaybackArt no longer needed when we use the native playback --> <!-- addExtraPlaybackArt no longer needed when we use the native playback -->
<setting id="addExtraPlaybackArt" type="bool" label="Add extra playback art" default="true" visible="false" enable="true" /> <setting id="addExtraPlaybackArt" type="bool" label="Add extra playback art" default="true" visible="false" enable="true" />
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" /> <setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" /> <setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
</category> </category>
<category label="30022"> <category label="30022">
<setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" /> <setting id="logLevel" type="enum" label="30004" values="None|Info|Debug" default="0" />
<setting label="Reset entire local library" type="action" action="RunScript(plugin.video.emby, reset)" />
</category> </category>
</settings> </settings>