The branch, dharma has been updated
via 6c5a4260a68e761aa36d30e2bd9c69cabee7bd92 (commit)
from 3eda49bbbfce1f16f4d6080ce36ca18482a9e710 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=6c5a4260a68e761aa36d30e2bd9c69cabee7bd92
commit 6c5a4260a68e761aa36d30e2bd9c69cabee7bd92
Author: spiff <sp...@xbmc.org>
Date: Tue Sep 6 16:17:45 2011 +0200
[plugin.video.previewnetworks] updated to version 2.0.2
diff --git a/plugin.video.previewnetworks/addon.py
b/plugin.video.previewnetworks/addon.py
index 304ad65..9e53fbe 100644
--- a/plugin.video.previewnetworks/addon.py
+++ b/plugin.video.previewnetworks/addon.py
@@ -14,15 +14,15 @@ import xbmcgui
import cgi
import socket
import xbmcaddon
-
+
# plugin constants
__plugin__ = "plugin.video.previewnetworks"
__author__ = "nmazz64"
__url__ = "http://code.google.com/p/previewnetworks-xbmc-plugin"
__svn_url__ =
"http://previewnetworks-xbmc-plugin.googlecode.com/svn/trunk/plugin.video.previewnetworks/"
__useragent__ = "QuickTime/7.6.5 (qtver=7.6.5;os=Windows NT 5.1Service Pack 3)"
-__version__ = "2.0.1"
-__svn_revision__ = "$Revision: 3$"
+__version__ = "2.0.2"
+__svn_revision__ = "$Revision: 0$"
__XBMC_Revision__ = "31632"
url_source=None
@@ -60,7 +60,7 @@ def categories(root):
addDir(Addon.getLocalizedString(30302),baseurl+'coming-90/%s',2,next_icon)
addDir(Addon.getLocalizedString(30303),baseurl+'newest-90/%s',3,new_icon)
addDir(Addon.getLocalizedString(30300),'genre:',0,genre_icon)
-
addDir(Addon.getLocalizedString(30340),baseurl+'search-20/%s/?search_field=product_title&search_query=%s',99,search_icon)
+
addDir(Addon.getLocalizedString(30340),baseurl+'search-20/%s/?search_field=product_title&search_query=%s',99,search_icon)
else:
addDir(Addon.getLocalizedString(30304),baseurl+'CinemaAction/%s',10,icona)
addDir(Addon.getLocalizedString(30305),baseurl+'CinemaAdventure/%s',11,icona)
@@ -96,11 +96,11 @@ def addDir(name,url,item,iconimage,parametri={},info={}):
standardParams={'url':url,'item':item}
parametri.update(standardParams)
u=sys.argv[0]+"?"+urllib.urlencode(parametri)
- ok=True
+ ok=True
info.update({ "Titolo": name })
- liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
- liz.setInfo( type="Video", infoLabels=info )
-
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
+ liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
+ liz.setInfo( type="Video", infoLabels=info )
+
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok
def get(params,name):
diff --git a/plugin.video.previewnetworks/addon.xml
b/plugin.video.previewnetworks/addon.xml
index 1aa9974..81a6ef3 100644
--- a/plugin.video.previewnetworks/addon.xml
+++ b/plugin.video.previewnetworks/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.previewnetworks" name="PreviewNetworks Video Trailers"
version="2.0.1" provider-name="nmazz64">
+<addon id="plugin.video.previewnetworks" name="PreviewNetworks Video Trailers"
version="2.0.2" provider-name="nmazz64">
<requires>
<import addon="xbmc.python" version="1.0"/>
</requires>
diff --git
a/plugin.video.previewnetworks/resources/language/English/strings.xml
b/plugin.video.previewnetworks/resources/language/English/strings.xml
index aee5328..cb37f54 100644
--- a/plugin.video.previewnetworks/resources/language/English/strings.xml
+++ b/plugin.video.previewnetworks/resources/language/English/strings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<!-- settings labels -->
- <string id="30000">Trailer quality</string>
+ <string id="30000">Max trailer quality</string>
<string id="30001">small</string>
<string id="30002">medium</string>
<string id="30003">large</string>
@@ -27,7 +27,7 @@
<string id="30030">Play mode</string>
<string id="30031">Stream</string>
<string id="30032">Download</string>
- <string id="30033">Download & Save</string>
+ <string id="30033">Download & Play</string>
<string id="30040">- folder download</string>
<string id="30041">- use title</string>
<string id="30042">- Add '-trailer' to saved trailers</string>
@@ -104,7 +104,7 @@
<!-- context menu labels -->
<string id="30900">Theater Showtimes</string>
- <string id="30910">Download & Play Trailer</string>
+ <string id="30910">Download & Play</string>
<string id="30920">Play Trailer</string>
<string id="30930">Movie Information</string>
diff --git
a/plugin.video.previewnetworks/resources/language/Italian/strings.xml
b/plugin.video.previewnetworks/resources/language/Italian/strings.xml
index e019ccc..9619190 100644
--- a/plugin.video.previewnetworks/resources/language/Italian/strings.xml
+++ b/plugin.video.previewnetworks/resources/language/Italian/strings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<!-- settings labels -->
- <string id="30000">Qualità trailer</string>
+ <string id="30000">Qualità massima dei trailers</string>
<string id="30001">small</string>
<string id="30002">medium</string>
<string id="30003">large</string>
@@ -27,7 +27,7 @@
<string id="30030">Modalità Play</string>
<string id="30031">Stream</string>
<string id="30032">Download</string>
- <string id="30033">Download & Save</string>
+ <string id="30033">Download & Play</string>
<string id="30040">- cartella download</string>
<string id="30041">- usa titolo</string>
<string id="30042">- aggiungi -trailer</string>
diff --git a/plugin.video.previewnetworks/resources/lib/download.py
b/plugin.video.previewnetworks/resources/lib/download.py
index 1e6fed4..0e23de6 100644
--- a/plugin.video.previewnetworks/resources/lib/download.py
+++ b/plugin.video.previewnetworks/resources/lib/download.py
@@ -58,7 +58,7 @@ class _Info:
class Main:
#Addon = xbmcaddon.Addon( id=os.path.basename( os.getcwd() ) )
Addon = xbmcaddon.Addon( id=__plugin__)
-
+
def __init__( self ):
# parse argv
self._parse_argv()
@@ -79,10 +79,10 @@ class Main:
self.settings = {}
self.settings[ "download_path" ] = self.Addon.getSetting(
"download_path" )
self.settings[ "play_mode" ] = int( self.Addon.getSetting( "play_mode"
) )
- if ( self.settings[ "play_mode" ] == 2 and self.settings[
"download_path" ] == "" ):
- self.settings[ "play_mode" ] = 1
- self.settings[ "use_title" ] = ( self.Addon.getSetting( "use_title" )
== "true" and self.settings[ "play_mode" ] == 2 )
- self.settings[ "use_trailer" ] = ( self.Addon.getSetting(
"use_trailer" ) == "true" and self.settings[ "use_title" ] == True and
self.settings[ "play_mode" ] == 2 )
+ #if ( self.settings[ "play_mode" ] == 2 and self.settings[
"download_path" ] == "" ):
+ # self.settings[ "play_mode" ] = 1
+ self.settings[ "use_title" ] = ( self.Addon.getSetting( "use_title" )
== "true" )
+ self.settings[ "use_trailer" ] = False # ( self.Addon.getSetting(
"use_trailer" ) == "true" and self.settings[ "use_title" ] == True and
self.settings[ "play_mode" ] == 2 )
def _download_video( self ):
try:
@@ -120,17 +120,17 @@ class Main:
def _report_hook( self, count, blocksize, totalsize ):
percent = int( float( count * blocksize * 100) / totalsize )
- msg1 = self.Addon.getLocalizedString( 30500 + ( self.settings[
"play_mode" ] == 2 ) ) % ( os.path.basename( self.filepath ), )
- msg2 = ( "", self.Addon.getLocalizedString( 30502 ) % (
os.path.dirname( self.filepath ), ), )[ self.settings[ "play_mode" ] - 1 ]
+ msg1 = self.Addon.getLocalizedString( 30500 ) % ( os.path.basename(
self.filepath ), )
+ msg2 = self.Addon.getLocalizedString( 30502 ) % ( os.path.dirname(
self.filepath ), )
pDialog.update( percent, msg1, msg2 )
if ( pDialog.iscanceled() ): raise
-
+
def _finalize_download( self, tmp_path ):
try:
if ( tmp_path != self.filepath ):
# copy the trailer
- msg1 = xbmc.getLocalizedString( 30503 ) % ( os.path.split(
self.filepath )[ 1 ], )
- msg2 = xbmc.getLocalizedString( 30502 ) % ( os.path.split(
self.filepath )[ 0 ], )
+ msg1 = self.Addon.getLocalizedString( 30503 ) % (
os.path.split( self.filepath )[ 1 ], )
+ msg2 = self.Addon.getLocalizedString( 30502 ) % (
os.path.split( self.filepath )[ 0 ], )
pDialog.update( -1, msg1, msg2 )
# necessary for dialog to update
xbmc.sleep( 50 )
@@ -145,7 +145,7 @@ class Main:
f.close()
# copy the thumbnail
thumbpath = os.path.splitext( self.filepath )[ 0 ] + ".tbn"
- msg1 = xbmc.getLocalizedString( 30503 ) % ( os.path.split(
thumbpath )[ 1 ], )
+ msg1 = self.Addon.getLocalizedString( 30503 ) % (
os.path.split( thumbpath )[ 1 ], )
pDialog.update( -1, msg1, msg2 )
# necessary for dialog to update
xbmc.sleep( 50 )
diff --git a/plugin.video.previewnetworks/resources/lib/trailers.py
b/plugin.video.previewnetworks/resources/lib/trailers.py
index c4f0301..6db893a 100644
--- a/plugin.video.previewnetworks/resources/lib/trailers.py
+++ b/plugin.video.previewnetworks/resources/lib/trailers.py
@@ -21,7 +21,7 @@ from util import get_filesystem, get_legal_filepath,
test_quality
from MediaWindow import MediaWindow, DirectoryItem
__plugin__ = "plugin.video.previewnetworks"
-
+
class _urlopener( urllib.FancyURLopener ):
version = sys.modules[ "__main__" ].__useragent__
@@ -31,7 +31,7 @@ urllib._urlopener = _urlopener()
class _Parser:
Addon = xbmcaddon.Addon( id=__plugin__)
-
+
def __init__( self, xmlSource, settings, MediaWindow ):
self.success = True
self.settings = settings
@@ -40,12 +40,14 @@ class _Parser:
self.date_format = xbmc.getRegion( "datelong" ).replace( "DDDD,", ""
).replace( "MMMM", "%B" ).replace( "D", "%d" ).replace( "YYYY", "%Y" ).strip()
# get the list
self.success = self._get_current_videos( xmlSource )
-
+
def _get_current_videos( self, xmlSource ):
try:
type_filter = ""
quality_filter = ""
title_option = ""
+ #quality_target = -1
+ quality_target = int(self.Addon.getSetting( "quality" ))
# encoding
encoding = re.findall( "<\?xml version=\"[^\"]*\"
encoding=\"([^\"]*)\"\?>", xmlSource )[ 0 ]
# gather all video records <movieinfo>
@@ -117,11 +119,11 @@ class _Parser:
locations[2] = posters_url[ind]
# gallery image
elif (posters_type[ind]=='7'):
- locations[3] = posters_url[ind]
+ locations[3] = posters_url[ind]
# video still
elif (posters_type[ind]=='11'):
locations[4] = posters_url[ind]
-
+
if (locations[self.settings[ "poster" ]]):
poster = locations[self.settings[ "poster" ]]
elif (self.settings["poster"] > 0):
@@ -161,10 +163,10 @@ class _Parser:
file_type = re.findall( "format=\"(.*?)\"",
file_extract )[ 0 ]
file_size = re.findall( "size=\"(.*?)\"",
file_extract ) [ 0 ]
quality_curr = test_quality(file_size)
+ # seleziona solo i tipi opzionati
if ((self.settings[ "type" ] == "all" or
self.settings[ "type" ] == file_type )
- and (self.settings[ "quality" ] == file_size or
- (self.settings[ "quality" ] == "max" and
quality_prev < quality_curr ))):
- quality_prev = quality_curr
+ and quality_curr <= quality_target):
+ #quality_prev = quality_curr
quality = file_size
# extract url
trailers = re.findall( "<url>(.*?)</url>",
file_extract )
@@ -193,10 +195,7 @@ class _Parser:
title_option = ' (' + file_type + '/' +
file_size + ')'
else:
title_option = ''
- #if ( titles ):
- # title_trailer = unicode( unescape( titles
[ 0 ]+' - '+ trailer_name[ 0 ] + title_option), encoding, "replace" )
- #else:
- # title_trailer = trailer_name[ 0 ]
+ #
if (self.settings[ "originaltitle" ]==True):
title_trailer = original_titles[ 0 ] + '
[' + trailer_name[ 0 ] + '] ' + title_option
else:
@@ -206,12 +205,15 @@ class _Parser:
title_trailer = re.sub(""", '"',
title_trailer)
title_trailer = re.sub("&", '&',
title_trailer)
#
- if self.settings[ "quality" ]<>'max':
+ # print "quality curr %s, target %s, selected
%s" % (quality_curr,quality_target, quality_curr-quality_target)
+ if (quality_curr == quality_target):
+ quality_prev = quality_target
ok = self._add_video( { "title":
title_trailer, "runtime": runtime, "studio": studio, "postdate": postdate,
"releasedate": releasedate, "copyright": copyright, "director": director,
"plot": plot, "cast": actors, "genre": genre, "poster": poster, "trailer":
trailer, "size": size, "fanart": fanart, "quality": quality }, 0 )
# if user cancels, call raise to exit loop
if ( not ok ): raise
# -- exit from loop
- if self.settings[ "quality" ]=='max' and title_trailer
<> '':
+ #if self.settings[ "quality" ]=='max' and
title_trailer <> '' and quality_curr <> quality_target:
+ if title_trailer <> '' and quality_prev <>
quality_target:
ok = self._add_video( { "title": title_trailer,
"runtime": runtime, "studio": studio, "postdate": postdate, "releasedate":
releasedate, "copyright": copyright, "director": director, "plot": plot,
"cast": actors, "genre": genre, "poster": poster, "trailer": trailer, "size":
size, "fanart": fanart, "quality": quality }, 0 )
# if user cancels, call raise to exit loop
if ( not ok ): raise
@@ -293,12 +295,12 @@ class Main:
# base paths
BASE_CURRENT_URL = ""
ITEM_CURRENT_URL = ""
- BASE_DATA_PATH = os.path.join( xbmc.translatePath( "special://profile/" ),
"addon_data", os.path.basename( Addon.getAddonInfo('path') ), "cache" )
+ BASE_DATA_PATH = os.path.join( xbmc.translatePath( "special://profile/" ),
"addon_data", os.path.basename( Addon.getAddonInfo('path') ), "cache" )
BASE_CURRENT_SOURCE_PATH = os.path.join( xbmc.translatePath(
"special://profile/" ), "addon_data", os.path.basename(
Addon.getAddonInfo('path')), "cache" , "trailer_%s.xml" )
title_option = ""
type_filter = ""
quality_filter = ""
-
+
def __init__( self , url_source, item):
# get users preference
self.BASE_CURRENT_URL = url_source
@@ -334,7 +336,7 @@ class Main:
self.settings[ "play_mode" ] = int( self.Addon.getSetting( "play_mode"
) )
if ( self.settings[ "play_mode" ] == 2 and self.settings[
"download_path" ] == "" ):
self.settings[ "play_mode" ] = 1
- self.settings[ "use_title" ] = ( self.settings[ "download_path" ] !=
"" )
+ self.settings[ "use_title" ] = ( self.Addon.getSetting( "use_title" )
== "true")
self.settings[ "use_trailer" ] = ( self.settings[ "download_path" ] !=
"" )
self.settings[ "play_existing" ] = ( self.Addon.getSetting(
"play_existing" ) == "true" and self.settings[ "download_path" ] != "" )
self.settings[ "extra" ] = ( self.Addon.getSetting( "extra" ) ==
"true" )
@@ -350,7 +352,7 @@ class Main:
kboard.doModal()
if kboard.isConfirmed():
return urllib.quote_plus(kboard.getText())
- return ''
+ return ''
def get_videos( self ):
ok = False
@@ -377,8 +379,7 @@ class Main:
base_url = self.BASE_CURRENT_URL % (self.settings[ "region"
],self.settings[ "product" ],self.settings[ "channel_id" ],search_phrase)
else:
base_url = self.BASE_CURRENT_URL % (self.settings[ "region"
],self.settings[ "product" ],self.settings[ "channel_id" ])
-
- # print base_url
+ #
# get the source files date if it exists
try: date = os.path.getmtime( base_path )
except: date = 0
diff --git a/plugin.video.previewnetworks/resources/lib/util.py
b/plugin.video.previewnetworks/resources/lib/util.py
index 23ef571..00f70ec 100644
--- a/plugin.video.previewnetworks/resources/lib/util.py
+++ b/plugin.video.previewnetworks/resources/lib/util.py
@@ -12,12 +12,12 @@ def get_filesystem( download_path ):
def test_quality( quality ):
# test if the quality of new video is best than previous
- v_qual = [ "small", "medium", "large", "xlarge", "xxlarge", "HD 480p", "HD
720p", "HD 1080p", ]
- Indice = 0
- while Indice < len(v_qual):
- if v_qual[Indice] == quality:
- return Indice
- Indice = Indice + 1
+ v_qual = [ "small", "medium", "large", "xlarge", "xxlarge", "HD 480p", "HD
720p", "HD 1080p", "max" ]
+ Indice = 0
+ while Indice < len(v_qual):
+ if v_qual[Indice] == quality:
+ return Indice
+ Indice = Indice + 1
return False
@@ -27,37 +27,35 @@ def get_legal_filepath( title, url, mode, download_path,
use_title, use_trailer
illegal_characters = { "xbox": '\\/,*=|<>?;:\"+', "win32": '\\/*|<>?:\"',
"Linux": "/", "OS X": "/:" }
# get the flavor of XBMC
environment = os.environ.get( "OS", "xbox" )
- # get the filesystem the trailer will be saved to
- filesystem = get_filesystem( download_path )
# create our temp save path
tmp_path = xbmc.translatePath( "special://temp/%s" % ( os.path.basename(
url ), ) )
- # if play_mode is temp download to cache folder
- if ( mode < 2 ):
- filepath = tmp_path
+ # get the filesystem the trailer will be saved to
+ if ( download_path == '' ):
+ download_path = tmp_path
+ filesystem = get_filesystem( download_path )
+ # get a valid filepath
+ if ( use_title ):
+ # append trailer if user preference
+ trailer = ( "", "-trailer", )[ use_trailer ]
+ # add trailer extension to trailer title
+ title = title + trailer + os.path.splitext( url )[ 1 ]
else:
- # get a valid filepath
- if ( use_title ):
- # append trailer if user preference
- trailer = ( "", "-trailer", )[ use_trailer ]
- # add trailer extension to trailer title
- title = title + trailer + os.path.splitext( url )[ 1 ]
- else:
- # we use the urls trailer name
- title = os.path.basename( url )
- # clean the filename
- filename = re.sub( '[%s]' % ( illegal_characters[ filesystem ], ),
"_", title )
- # we need to handle xbox special
+ # we use the urls trailer name
+ title = os.path.basename( url )
+ # clean the filename
+ filename = re.sub( '[%s]' % ( illegal_characters[ filesystem ], ), "_",
title )
+ # we need to handle xbox special
+ if ( filesystem == "xbox" ):
+ # set the length to 37 if filepath isn't a smb share for the .conf file
+ if( len( filename ) > 37 and not download_path.startswith( "smb://" )
):
+ name, ext = os.path.splitext( filename )
+ filename = name[ : 37 - len( ext ) ].strip() + ext
+ # replace any characters whose ord > 127 for xbox filesystem
if ( filesystem == "xbox" ):
- # set the length to 37 if filepath isn't a smb share for the .conf
file
- if( len( filename ) > 37 and not download_path.startswith(
"smb://" ) ):
- name, ext = os.path.splitext( filename )
- filename = name[ : 37 - len( ext ) ].strip() + ext
- # replace any characters whose ord > 127 for xbox filesystem
- if ( filesystem == "xbox" ):
- for char in filename:
- if ( ord( char ) > 127 ):
- filename = filename.replace( char, "_" )
- # make our filepath
- filepath = os.path.join( xbmc.translatePath( download_path ), filename
)#, "utf-8", "replace" )
+ for char in filename:
+ if ( ord( char ) > 127 ):
+ filename = filename.replace( char, "_" )
+ # make our filepath
+ filepath = os.path.join( xbmc.translatePath( download_path ), filename )#,
"utf-8", "replace" )
# return results
return tmp_path, filepath
diff --git a/plugin.video.previewnetworks/resources/settings.xml
b/plugin.video.previewnetworks/resources/settings.xml
index 434e6bd..58a0098 100644
--- a/plugin.video.previewnetworks/resources/settings.xml
+++ b/plugin.video.previewnetworks/resources/settings.xml
@@ -12,11 +12,11 @@
<setting id="poster" type="enum" lvalues="30011|30012|30013|30014|30015"
label="30010" default="1" />
<--setting id="product" type="enum" lvalues="30061|30062|30063|30064"
label="30060" default="0" enable="False"/>
<setting type="sep" />
- <setting id="play_mode" type="enum" lvalues="30031|30032|30033"
label="30030" default="0" />
- <setting id="download_path" type="folder" source="files" enable="eq(-1,2)"
option="writeable" label="30040" default="" />
- <--setting id="use_title" type="bool" enable="eq(-2,2) + !eq(-1,)"
label="30041" default="true" />
+ <setting id="play_mode" type="enum" lvalues="30031|30033" label="30030"
default="0" />
+ <setting id="download_path" type="folder" source="files"
option="writeable" label="30040" default="" />
+ <setting id="use_title" type="bool" label="30041" default="true" />
<--setting id="use_trailer" type="bool" enable="eq(-3,2) + !eq(-2,) +
eq(-1,true)" label="30042" default="true" />
- <setting id="play_existing" type="bool" enable="eq(-2,2)" label="30043"
default="true" />
+ <setting id="play_existing" type="bool" enable="eq(-3,1)" label="30043"
default="true" />
<--setting type="sep" />
<--setting id="fanart_image" type="pictures" label="30090" default=""
enable="False"/>
</settings>
-----------------------------------------------------------------------
Summary of changes:
plugin.video.previewnetworks/addon.py | 16 +++---
plugin.video.previewnetworks/addon.xml | 2 +-
.../resources/language/English/strings.xml | 6 +-
.../resources/language/Italian/strings.xml | 4 +-
.../resources/lib/download.py | 22 +++---
.../resources/lib/trailers.py | 41 ++++++------
plugin.video.previewnetworks/resources/lib/util.py | 66 ++++++++++----------
.../resources/settings.xml | 8 +-
8 files changed, 82 insertions(+), 83 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Xbmc-addons mailing list
Xbmc-addons@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xbmc-addons