-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prepared addition of custom viewtypes via GUI
- Loading branch information
Showing
45 changed files
with
4,501 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import xbmc | ||
from xbmcgui import Window | ||
import re | ||
import sys | ||
import os | ||
import zipfile | ||
|
||
def unzip( filename, destination=None, report=False ): | ||
from zipfile import ZipFile | ||
base_dir = "" | ||
|
||
zip = ZipFile( filename, "r" ) | ||
namelist = zip.namelist() | ||
total_items = len( namelist ) or 1 | ||
diff = 100.0 / total_items | ||
percent = 0 | ||
|
||
if os.path.isdir( base_dir ): | ||
shutil2.rmtree( base_dir ) | ||
os.makedirs( base_dir ) | ||
for count, item in enumerate( namelist ): | ||
percent += diff | ||
if report: | ||
if DIALOG_PROGRESS.iscanceled(): | ||
break | ||
DIALOG_PROGRESS.update( int( percent ), _( 188 ) % ( count + 1, total_items ), item, _( 110 ) ) | ||
#print round( percent, 2 ), item | ||
if not item.endswith( "/" ): | ||
root, name = os.path.split( item ) | ||
directory = os.path.normpath( os.path.join( destination, root ) ) | ||
if not os.path.isdir( directory ): os.makedirs( directory ) | ||
file( os.path.join( directory, name ), "wb" ).write( zip.read( item ) ) | ||
zip.close() | ||
del zip | ||
return base_dir, True | ||
|
||
return "", False | ||
|
||
class Main: | ||
def __init__( self ): | ||
#self.ZipSource = sys.argv[1] | ||
fz="C:\Documents and Settings\trioual\Desktop\ProtoVue.zip","r" | ||
ListView = ['1001','1002','1003','1004','1005','1006','1007','1008','1009','1010'] | ||
for v in ListView: | ||
print v; | ||
if xbmc.getCondVisibility("!Skin.HasSetting(ViewCustom%s_IsThere)" % (v) ): | ||
#-- Cette vue n'est pas installée | ||
unzip(fz,xbmc.translatePath( "special://skin/" )) | ||
SrcView=open('special://skin/720p/View_Custom.xml','r') | ||
NewView=open('special://skin/720p/View_Custom%s.xml' % (v),'w') | ||
f=NewView.readlines() | ||
SrcView.close | ||
for l in f: | ||
NewView.write(l.replace("##@@##",v)) | ||
NewView.close | ||
break | ||
|
||
if ( __name__ == "__main__" ): | ||
Main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import re | ||
import sys | ||
import os | ||
|
||
class Main: | ||
def __init__( self ): | ||
self.NumView = sys.argv[1] | ||
os.remove('special://skin/720p/Custom_View%s.xml' % self.NumView) | ||
os.rmdir('special://skin/media/Custom_Media%s' % self.NumView) | ||
|
||
if ( __name__ == "__main__" ): | ||
Main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<addon id="script.glassview" | ||
name="glassview" | ||
version="1.0.0" | ||
provider-name="Frost (passion-xbmc.org)"> | ||
<requires> | ||
<import addon="xbmc.python" version="1.0"/> | ||
</requires> | ||
<extension point="xbmc.python.library" | ||
library="default.py" /> | ||
<extension point="xbmc.addon.metadata"> | ||
<summary>Simple addon installer for skinner</summary> | ||
<description>Simple addon installer for skinner</description> | ||
<platform>all</platform> | ||
</extension> | ||
</addon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
""" | ||
Simple addon installer for skinner | ||
""" | ||
|
||
|
||
#Modules General | ||
import os | ||
import sys | ||
import urllib | ||
from traceback import print_exc | ||
|
||
#Modules XBMC | ||
import xbmc | ||
import xbmcgui | ||
from xbmcaddon import Addon | ||
|
||
# addon constants | ||
__addonID__ = "skin.glass.svn" # get addon id | ||
__settings__ = Addon( __addonID__ ) # get Addon object | ||
__localize__ = __settings__.getLocalizedString | ||
|
||
|
||
REPO_PACKAGE_DIR = "special://home/addons/packages/" | ||
|
||
SILENT = True | ||
DIALOG_PROGRESS = xbmcgui.DialogProgress() | ||
|
||
|
||
def download( url, destination=REPO_PACKAGE_DIR ): | ||
try: | ||
if not SILENT: | ||
DIALOG_PROGRESS.create( __settings__.getAddonInfo( "name" ) ) | ||
destination = xbmc.translatePath( destination ) + os.path.basename( url ) | ||
def _report_hook( count, blocksize, totalsize ): | ||
if not SILENT: | ||
percent = int( float( count * blocksize * 100 ) / totalsize ) | ||
DIALOG_PROGRESS.update( percent, "Downloading: %s " % url, "to: %s" % destination ) | ||
fp, h = urllib.urlretrieve( url, destination, _report_hook ) | ||
print fp, h | ||
return fp | ||
except: | ||
print_exc() | ||
if not SILENT: | ||
DIALOG_PROGRESS.close() | ||
return "" | ||
|
||
|
||
def install( filename ): | ||
from resources.lib.extractor import extract | ||
return extract( filename, xbmc.translatePath( "special://skin" ) ) | ||
|
||
|
||
def notification( header="", message="", sleep=5000, icon=__settings__.getAddonInfo( "icon" ) ): | ||
""" Will display a notification dialog with the specified header and message, | ||
in addition you can set the length of time it displays in milliseconds and a icon image. | ||
""" | ||
xbmc.executebuiltin( "XBMC.Notification(%s,%s,%i,%s)" % ( header, message, sleep, icon ) ) | ||
|
||
|
||
if ( __name__ == "__main__" ): | ||
try: testurl = sys.argv[ 1 ] | ||
except: print_exc() | ||
else: | ||
try: | ||
NAME = sys.argv[ 2 ] | ||
SILENT = sys.argv[ 3 ] != "false" | ||
except: print_exc() | ||
print "LE SCRIPT EST RENDU A FAIRE CECI 'download' " + testurl | ||
|
||
newaddon = download( testurl ) | ||
print "resultat de newaddon " + newaddon | ||
|
||
if newaddon: | ||
fp, ok = install( newaddon ) | ||
print fp, ok | ||
if newaddon: | ||
ListView = ['1001','1002','1003','1004','1005','1006','1007','1008','1009','1010','1011','1012','1013','1014','1015','1016','1017','1018','1019','1020'] | ||
print ListView | ||
ViewOK=False | ||
for v in ListView: | ||
print v; | ||
if xbmc.getCondVisibility("!Skin.HasSetting(ViewCustom%s_IsInstall)" % (v) ) or os.access(xbmc.translatePath('special://skin/1080i/View_Custom%s.xml' % v),os.F_OK)==False: | ||
print testurl | ||
fp, ok = install( testurl ) | ||
SrcView=open(xbmc.translatePath('special://skin/720p/View_Custom.xml'),'r') | ||
NewView=open(xbmc.translatePath('special://skin/1080i/View_Custom%s.xml' % (v)),'w') | ||
SaveView=open(xbmc.translatePath('special://masterprofile/View_Custom%s.xml' % (v)),'w') | ||
f=SrcView.readlines() | ||
SrcView.close | ||
for l in f: | ||
NewView.write(l.replace("##@@##",v)) | ||
SaveView.write(l.replace("##@@##",v)) | ||
NewView.close | ||
SaveView.close | ||
ViewOK=True | ||
xbmc.executebuiltin( "Skin.SetBool(ViewCustom%s_IsInstall)" % ( v ) ) | ||
xbmc.executebuiltin( "Skin.SetString(ViewCustom%s_Name,%s)" % ( v, NAME ) ) | ||
try: os.remove(xbmc.translatePath('special://skin/720p/View_Custom.xml')) | ||
except: print "erreur os.remove(%s)" % xbmc.translatePath('special://skin/720p/View_Custom.xml') | ||
break | ||
try: os.remove(xbmc.translatePath('special://masterprofile/720p/View_Custom.xml')) | ||
except: print "erreur os.remove(%s)" % xbmc.translatePath('special://masterprofile/720p/View_Custom.xml') | ||
break | ||
|
||
if ViewOK: | ||
#xbmcgui.Dialog().ok( "View %s installed and save in userdata" % (v), "XBMC requires restart!" ) | ||
xbmcgui.Dialog().ok( xbmc.getLocalizedString(31152) %v, xbmc.getLocalizedString(31153) ) | ||
else: | ||
#xbmcgui.Dialog().ok( "Error","No more custom view available." ) | ||
xbmcgui.Dialog().ok( xbmc.getLocalizedString(257),xbmc.getLocalizedString(31154) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Dummy file to make this directory a package. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Dummy file to make this directory a package. |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.