The branch, dharma-pre has been updated
via 7892f1a2c34ee88929ff43452f7a766dea8d88dd (commit)
from c1f67182c8cdb30b780b50f4cbcadf682ee0e5a4 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=7892f1a2c34ee88929ff43452f7a766dea8d88dd
commit 7892f1a2c34ee88929ff43452f7a766dea8d88dd
Author: beenje <[email protected]>
Date: Sat Nov 13 23:51:48 2010 +0100
[plugin.video.arretsurimages] updated to version 1.0.2
diff --git a/plugin.video.arretsurimages/addon.xml
b/plugin.video.arretsurimages/addon.xml
index 134a065..d1aa2d9 100644
--- a/plugin.video.arretsurimages/addon.xml
+++ b/plugin.video.arretsurimages/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.arretsurimages"
name="Arrêt Sur Images"
- version="1.0.1"
+ version="1.0.2"
provider-name="Beenje">
<requires>
<import addon="xbmc.python" version="1.0"/>
diff --git a/plugin.video.arretsurimages/changelog.txt
b/plugin.video.arretsurimages/changelog.txt
index eb4c45e..9aa521a 100644
--- a/plugin.video.arretsurimages/changelog.txt
+++ b/plugin.video.arretsurimages/changelog.txt
@@ -1,3 +1,7 @@
+[B]Version 1.0.2[/B]
+
+- Use notification instead of dialog when downloading video
+
[B]Version 1.0.1[/B]
- New icon with official logo
diff --git a/plugin.video.arretsurimages/default.py
b/plugin.video.arretsurimages/default.py
index d2a7d7d..b418a12 100644
--- a/plugin.video.arretsurimages/default.py
+++ b/plugin.video.arretsurimages/default.py
@@ -11,18 +11,19 @@ import urllib
# plugin constants
__author__ = "beenje"
__url__ = "http://github.com/beenje/plugin.video.arretsurimages"
-__settings__ = xbmcaddon.Addon(id='plugin.video.arretsurimages')
-__plugin__ = __settings__.getAddonInfo('name')
-__version__ = __settings__.getAddonInfo('version')
+__addon__ = xbmcaddon.Addon(id='plugin.video.arretsurimages')
+# Force plugin name to avoid unicode problem
+__plugin__ = 'Arret Sur Images'
+__version__ = __addon__.getAddonInfo('version')
print "[PLUGIN] '%s: version %s' initialized!" % (__plugin__, __version__)
if __name__ == "__main__":
import resources.lib.asi as asi
- if not __settings__.getSetting('alreadyrun'):
- __settings__.openSettings()
- __settings__.setSetting('alreadyrun', '1')
+ if not __addon__.getSetting('alreadyrun'):
+ __addon__.openSettings()
+ __addon__.setSetting('alreadyrun', '1')
if not sys.argv[2]:
asi.Main()
diff --git a/plugin.video.arretsurimages/resources/language/English/strings.xml
b/plugin.video.arretsurimages/resources/language/English/strings.xml
index 4597e49..a61b6c8 100644
--- a/plugin.video.arretsurimages/resources/language/English/strings.xml
+++ b/plugin.video.arretsurimages/resources/language/English/strings.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<string id="30000">Arrêt Sur Images</string>
@@ -37,6 +37,10 @@
<string id="30100">Download Video</string>
<!--Download Menu-->
- <string id="32023">Saving</string>
- <string id="32024">as</string>
+ <string id="30200">Download in progress</string>
+ <string id="30201">Download complete</string>
+ <string id="30202">Download failed</string>
+ <string id="30203">Download cancelled</string>
+ <string id="30204">exists</string>
+ <string id="30205">No file to download</string>
</strings>
diff --git a/plugin.video.arretsurimages/resources/language/French/strings.xml
b/plugin.video.arretsurimages/resources/language/French/strings.xml
index be2c180..8295086 100644
--- a/plugin.video.arretsurimages/resources/language/French/strings.xml
+++ b/plugin.video.arretsurimages/resources/language/French/strings.xml
@@ -37,6 +37,10 @@
<string id="30100">Télécharger la vidéo</string>
<!--Download Menu-->
- <string id="32023">Enregistre</string>
- <string id="32024">sous</string>
+ <string id="30200">Téléchargement en cours</string>
+ <string id="30201">Téléchargement terminé</string>
+ <string id="30202">Erreur de téléchargement</string>
+ <string id="30203">Téléchargement annulé</string>
+ <string id="30204">existe</string>
+ <string id="30205">Pas de fichier à télécharger</string>
</strings>
diff --git a/plugin.video.arretsurimages/resources/lib/asi.py
b/plugin.video.arretsurimages/resources/lib/asi.py
index a22cc49..401f899 100644
--- a/plugin.video.arretsurimages/resources/lib/asi.py
+++ b/plugin.video.arretsurimages/resources/lib/asi.py
@@ -6,7 +6,6 @@ import asi_scraper
import xbmc
import xbmcplugin
import xbmcgui
-import xbmcaddon
from videoDownloader import Download
# Main URLs and sort method list
@@ -16,10 +15,10 @@ SORTMETHOD = ['date_publication', 'nb_vues', 'nb_comments']
ASI = asi_scraper.ArretSurImages()
-__settings__ = xbmcaddon.Addon(id='plugin.video.arretsurimages')
+__addon__ = sys.modules['__main__'].__addon__
def getLS(i):
- return __settings__.getLocalizedString(i).encode('utf-8')
+ return __addon__.getLocalizedString(i).encode('utf-8')
class updateArgs:
@@ -154,19 +153,19 @@ class Main:
def getSettings(self):
self.settings = dict()
- self.settings['username'] = __settings__.getSetting('username')
- self.settings['password'] = __settings__.getSetting('password')
- self.settings['sortMethod'] =
int(__settings__.getSetting('sortMethod'))
- self.settings['downloadMode'] = __settings__.getSetting('downloadMode')
- self.settings['downloadPath'] = __settings__.getSetting('downloadPath')
+ self.settings['username'] = __addon__.getSetting('username')
+ self.settings['password'] = __addon__.getSetting('password')
+ self.settings['sortMethod'] = int(__addon__.getSetting('sortMethod'))
+ self.settings['downloadMode'] = __addon__.getSetting('downloadMode')
+ self.settings['downloadPath'] = __addon__.getSetting('downloadPath')
def downloadVideo(self, url):
- video = ASI.getVideoDownloadLink(url)
if self.settings['downloadMode'] == 'true':
- downloadPath = xbmcgui.Dialog().browse(3, getLS(30090), 'files')
+ downloadPath = xbmcgui.Dialog().browse(3, getLS(30090), 'video')
else:
downloadPath = self.settings['downloadPath']
if downloadPath:
+ video = ASI.getVideoDownloadLink(url)
Download(video['Title'], video['url'], downloadPath)
def checkMode(self):
diff --git a/plugin.video.arretsurimages/resources/lib/videoDownloader.py
b/plugin.video.arretsurimages/resources/lib/videoDownloader.py
index 54b48a2..846c543 100644
--- a/plugin.video.arretsurimages/resources/lib/videoDownloader.py
+++ b/plugin.video.arretsurimages/resources/lib/videoDownloader.py
@@ -1,67 +1,61 @@
+# -*- coding: utf-8 -*-
import urllib
import os.path
import sys
import xbmc
-import xbmcgui
-#enable localization
-import xbmcaddon
-
-__settings__ = xbmcaddon.Addon(id='plugin.video.arretsurimages')
-getLS = __settings__.getLocalizedString
+__addon__ = sys.modules['__main__'].__addon__
pluginName = sys.modules['__main__'].__plugin__
+def getLS(i):
+ return __addon__.getLocalizedString(i).encode('utf-8')
class Download:
def __init__(self, title, videoURL, downloadPath):
- self.pDialog = xbmcgui.DialogProgress()
- self.pDialog.create(getLS(30000))
-
- downloadPath = xbmc.translatePath(downloadPath)
- self.url = videoURL
- self.title = title
- #unicode causes problems here, convert to standard str
- self.filename = self.getLegalFilename(self.title.title().replace(' ',
''))
- self.fullDownloadPath = os.path.join(downloadPath, self.filename)
- print '[%s] %s : Attempting to download\n%s --> %s' % (pluginName,
__name__, self.url, self.fullDownloadPath)
-
- if self.checkPath(downloadPath, self.filename):
- try:
- re = urllib.urlretrieve(self.url, self.fullDownloadPath,
reporthook = self.showdlProgress)
- print '[%s] Download Success!' % (pluginName)
- except IOError, e:
- print e
- self.pDialog.close()
- dialog = xbmcgui.Dialog()
- dialog.ok('Error', str(i)+' of
'+str(len(photos))+'\n'+self.url, e.__str__())
- if self.pDialog.iscanceled():
- self.pDialog.close()
- #close the progress dialog
- self.pDialog.close()
-
- def showdlProgress(self, count, blockSize, totalSize):
- percent = int(count*blockSize*100/totalSize)
- self.pDialog.update(percent, '%s %s' % (getLS(32023), self.url), '%s
%s' % (getLS(32024), self.fullDownloadPath))
- #print percent, '% ',
- if self.pDialog.iscanceled():
- self.pDialog.close()
+ if title is None or videoURL is None:
+ print '[%s] No file to download!' % (pluginName)
+ self.showNotification(getLS(30202), getLS(30205))
+ else:
+ downloadPath = xbmc.translatePath(downloadPath)
+ self.url = videoURL
+ self.title = title
+ #unicode causes problems here, convert to standard str
+ self.filename = self.getLegalFilename(self.title.title().replace('
', ''))
+ self.fullDownloadPath = os.path.join(downloadPath, self.filename)
+ print '[%s] %s : Attempting to download\n%s --> %s' % (pluginName,
__name__, self.url, self.fullDownloadPath)
+ if self.checkPath(downloadPath, self.filename):
+ self.showNotification(getLS(30200), self.filename)
+ try:
+ urllib.urlretrieve(self.url, self.fullDownloadPath)
+ except IOError, e:
+ print e
+ self.showNotification(getLS(30202), e.__str__())
+ else:
+ print '[%s] Download complete!' % (pluginName)
+ self.showNotification(getLS(30201), self.filename)
+
+ def showNotification(self, header, message):
+ xbmc.executebuiltin('XBMC.Notification("%s", "%s")' % (header,
message))
def checkPath(self, path, filename):
if os.path.isdir(path):
if os.path.isfile(os.path.join(path, filename)):
- if not os.path.getsize(os.path.join(path, filename))>0:
+ if os.path.getsize(os.path.join(path, filename))>0:
+ self.showNotification(getLS(30203), '%s %s' % (filename,
getLS(30204)))
+ else:
return True #overwrite empty files, #skip others.
else:
return True
+ return False
def getLegalFilename(self, filename, illegalChars = '=?:;\'"*+,/|\\'):
for c in illegalChars:
filename = filename.replace(c, '')
#xbox needs file name trunicated to 42 characters including extension.
if os.environ.get("OS", "xbox") == 'xbox':
- #at some point in writing the file xbmc+windows pukes on unicode,
so convert to retular string.
+ #at some point in writing the file xbmc+windows pukes on unicode,
so convert to regular string.
return str(os.path.splitext(filename)[:-1][0][:38] +
os.path.splitext(filename)[-1])
else:
- #at some point in writing the file xbmc+windows pukes on unicode,
so convert to retular string.
+ #at some point in writing the file xbmc+windows pukes on unicode,
so convert to regular string.
return str(filename)
-----------------------------------------------------------------------
Summary of changes:
plugin.video.arretsurimages/addon.xml | 2 +-
plugin.video.arretsurimages/changelog.txt | 4 +
plugin.video.arretsurimages/default.py | 13 ++--
.../resources/language/English/strings.xml | 10 ++-
.../resources/language/French/strings.xml | 8 ++-
plugin.video.arretsurimages/resources/lib/asi.py | 19 +++---
.../resources/lib/videoDownloader.py | 74 +++++++++-----------
7 files changed, 68 insertions(+), 62 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons