The branch, dharma has been updated
via 4acf5bf114d0ed21ef9aa46020e79105b22290ed (commit)
from 1bd810f01e673bb48d5d2c0b4acd0343aa6d048a (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=4acf5bf114d0ed21ef9aa46020e79105b22290ed
commit 4acf5bf114d0ed21ef9aa46020e79105b22290ed
Author: amet <[email protected]>
Date: Sat Jan 28 00:13:30 2012 +0400
[script.image.bigpictures] -v 1.5.3
Added: New Scraper "TotallyCoolPix.com"
Added: New Scraper "Time.com: LightBox - Closeup"
Changed: How using 'keep' as default aspect-ratio (press 0 or set in
settings to change)
Fixed: html codes in title from some "Atlantic in focus" albums
Changed: The spinning loading animation logic
Fixed: ATV2-Remote Keymaps
diff --git a/script.image.bigpictures/addon.xml
b/script.image.bigpictures/addon.xml
index 5835c5b..f6af67f 100644
--- a/script.image.bigpictures/addon.xml
+++ b/script.image.bigpictures/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.image.bigpictures" name="The Big Picture" version="1.5.2"
provider-name="sphere">
+<addon id="script.image.bigpictures" name="The Big Picture" version="1.5.3"
provider-name="sphere">
<requires>
<import addon="xbmc.python" version="1.0"/>
<import addon="script.module.beautifulsoup" version="3.0.8"/>
diff --git a/script.image.bigpictures/changelog.txt
b/script.image.bigpictures/changelog.txt
index b88025c..d316436 100644
--- a/script.image.bigpictures/changelog.txt
+++ b/script.image.bigpictures/changelog.txt
@@ -1,3 +1,14 @@
+1.5.3
+ Added: New Scraper "TotallyCoolPix.com"
+ Added: New Scraper "Time.com: LightBox - Closeup"
+ Changed: How using 'keep' as default aspect-ratio (press 0 or set in
settings to change)
+ Fixed: html codes in title from some "Atlantic in focus" albums
+ Changed: The spinning loading animation logic
+ Fixed: ATV2-Remote Keymaps
+
+1.5.2
+ Fixed import error
+
1.5.1
New plugin-way for scrapers
Fixed: Wallstreetjournal Scraper
diff --git a/script.image.bigpictures/resources/lib/gui.py
b/script.image.bigpictures/resources/lib/gui.py
index d3a54c2..a51e58f 100644
--- a/script.image.bigpictures/resources/lib/gui.py
+++ b/script.image.bigpictures/resources/lib/gui.py
@@ -16,42 +16,38 @@ openSettings = Addon.openSettings
class GUI(xbmcgui.WindowXML):
# Controls
CONTROL_MAIN_IMAGE = 100
+ IMAGE_LOADING = 101
+ LABEL_VISIBLE = 102
# Actions
ACTION_CONTEXT_MENU = [117]
ACTION_MENU = [122]
- ACTION_PREVIOUS_MENU = [9]
+ ACTION_PREVIOUS_MENU = [9, 92, 10]
ACTION_SHOW_INFO = [11]
- ACTION_EXIT_SCRIPT = [10, 13]
+ ACTION_EXIT_SCRIPT = [13]
ACTION_DOWN = [4]
ACTION_UP = [3]
- ACTION_0 = [58]
+ ACTION_0 = [58, 18]
+ ACTION_PLAY = [79]
def __init__(self, xmlFilename, scriptPath, defaultSkin, defaultRes):
self.getScraper()
def getScraper(self):
addon_path = xbmc.translatePath(Addon.getAddonInfo('path'))
- print 'TBP: addon_path: %s' % repr(addon_path)
res_path = os.path.join(addon_path, 'resources', 'lib')
- print 'TBP: res_path: %s' % repr(res_path)
scrapers_path = os.path.join(res_path, 'scrapers')
- print 'TBP: scrapers_path: %s' % repr(scrapers_path)
scrapers = [f[:-3] for f in os.listdir(scrapers_path) \
if f.endswith('.py')]
- print 'TBP: scrapers: %s' % repr(scrapers)
sys.path.insert(0, res_path)
sys.path.insert(0, scrapers_path)
- print 'TBP: path: %s' % repr(sys.path)
imported_modules = [__import__(scraper) for scraper in scrapers]
- print 'TBP: imported_modules: %s' % repr(imported_modules)
self.SOURCES = [m.register() for m in imported_modules]
def onInit(self):
- self.show_info = 'true'
+ self.show_info = True
self.active_source_id = 0
- aspect_ratio_id = int(getSetting('aspect_ratio'))
- aspect_ratios = ('scale', 'keep')
- self.default_aspect = aspect_ratios[aspect_ratio_id]
+ aspect_ratio_id = int(getSetting('aspect_ratio2'))
+ self.default_aspect = ('scale', 'keep')[aspect_ratio_id]
self.setSource()
self.showAlbums()
self.setFocus(self.getControl(self.CONTROL_MAIN_IMAGE))
@@ -84,6 +80,8 @@ class GUI(xbmcgui.WindowXML):
self.showAlbums()
elif action in self.ACTION_0:
self.toggleAspect()
+ elif action in self.ACTION_PLAY:
+ pass
def onClick(self, controlId):
if controlId == self.CONTROL_MAIN_IMAGE:
@@ -98,17 +96,13 @@ class GUI(xbmcgui.WindowXML):
return control.getSelectedItem().getProperty(property)
def toggleInfo(self):
- selectedControl = self.getControl(self.CONTROL_MAIN_IMAGE)
- if self.getProperty('show_info') == 'false':
- for i in range(selectedControl.size()):
- selectedControl.getListItem(i).setProperty('show_info',
- 'true')
- self.show_info = 'true'
+ selectedControl = self.getControl(self.LABEL_VISIBLE)
+ if self.show_info:
+ selectedControl.setVisible(False)
+ self.show_info = False
else:
- for i in range(selectedControl.size()):
- selectedControl.getListItem(i).setProperty('show_info',
- 'false')
- self.show_info = 'false'
+ selectedControl.setVisible(True)
+ self.show_info = True
def toggleAspect(self):
selectedControl = self.getControl(self.CONTROL_MAIN_IMAGE)
@@ -140,20 +134,23 @@ class GUI(xbmcgui.WindowXML):
imageDownloader.Download(photos, downloadPath)
def showPhotos(self):
+ self.getControl(self.IMAGE_LOADING).setVisible(True)
link = self.getProperty('link')
self.getControl(self.CONTROL_MAIN_IMAGE).reset()
photos = self.Source.getPhotos(link)
self.showItems(photos, 'photo')
+ self.getControl(self.IMAGE_LOADING).setVisible(False)
def showAlbums(self):
+ self.getControl(self.IMAGE_LOADING).setVisible(True)
self.getControl(self.CONTROL_MAIN_IMAGE).reset()
albums = self.Source.getAlbums()
self.showItems(albums, 'album')
+ self.getControl(self.IMAGE_LOADING).setVisible(False)
def showItems(self, itemSet, type):
total = len(itemSet)
for i, item in enumerate(itemSet):
- item['show_info'] = self.show_info
item['type'] = type
item['album'] = self.Source.NAME
item['title'] = item['title']
@@ -189,4 +186,4 @@ class GUI(xbmcgui.WindowXML):
def showHelp(self):
if not getSetting('help_already_shown'):
openSettings()
- setSetting('help_already_shown', 'yes')
+ setSetting('help_already_shown', 'yes')
\ No newline at end of file
diff --git a/script.image.bigpictures/resources/lib/scrapers/1_tbp.py
b/script.image.bigpictures/resources/lib/scrapers/1_tbp.py
index b0bb35f..b7bc801 100644
--- a/script.image.bigpictures/resources/lib/scrapers/1_tbp.py
+++ b/script.image.bigpictures/resources/lib/scrapers/1_tbp.py
@@ -41,7 +41,7 @@ class Scraper(ScraperPlugin):
def getPhotos(self, url):
referer = 'http://www.boston.com/bigpicture/'
tree = self.getCachedTree(url, referer)
- title = tree.find('div', 'headDiv2').h2.a.string
+ title = tree.find('h2').a.string
self.photos = list()
photoNodes = tree.findAll('div', {'class':
re.compile('bpImageTop|bpBoth')})
diff --git a/script.image.bigpictures/resources/lib/scrapers/2_aif.py
b/script.image.bigpictures/resources/lib/scrapers/2_aif.py
index 8e1cd21..bccdcda 100644
--- a/script.image.bigpictures/resources/lib/scrapers/2_aif.py
+++ b/script.image.bigpictures/resources/lib/scrapers/2_aif.py
@@ -10,18 +10,17 @@ class Scraper(ScraperPlugin):
url = 'http://www.theatlantic.com/infocus/'
tree = self.getCachedTree(url)
self.albums = list()
- storyNodes = tree.findAll('div', 'articleContent')
- imgNodes = tree.findAll('span', 'if1280')
- for i, node in enumerate(storyNodes):
- title = node.find('a').string
- link = node.find('a')['href']
- desc_raw = node.find('div',
- attrs={'class': 'entry_body'}).p.contents
+ section = tree.find('div', attrs={'class': 'middle'})
+
+ headlines = section.findAll('h1', attrs={'class': 'headline'})
+ descriptions = section.findAll('div', attrs={'class': 'dek'})
+ images = section.findAll('span', 'if1280')
+ for i, node in enumerate(headlines):
+ title = self.cleanHTML(node.a.string)
+ link = headlines[i].a['href']
+ desc_raw = descriptions[i].p.contents
description = self.cleanHTML(desc_raw)
- try:
- pic = imgNodes[i].find('img')['src']
- except:
- pic = ''
+ pic = images[i].find('img')['src']
self.albums.append({'title': title,
'pic': pic,
'description': description,
@@ -30,7 +29,7 @@ class Scraper(ScraperPlugin):
def getPhotos(self, url):
tree = self.getCachedTree(url)
- title = tree.find('h1', 'headline').string
+ title = self.cleanHTML(tree.find('h1', 'headline').string)
self.photos = list()
photoNodes = tree.findAll('span', {'class': 'if1024'})
for node in photoNodes:
@@ -45,3 +44,5 @@ class Scraper(ScraperPlugin):
def register():
return Scraper()
+
+
\ No newline at end of file
diff --git a/script.image.bigpictures/resources/settings.xml
b/script.image.bigpictures/resources/settings.xml
index 7a7fa75..636825d 100644
--- a/script.image.bigpictures/resources/settings.xml
+++ b/script.image.bigpictures/resources/settings.xml
@@ -9,6 +9,6 @@
<setting type="lsep" label="32032" />
</category>
<category label="32061">
- <setting id="aspect_ratio" type="enum" label="32050" default="0"
lvalues="32051|32052"/>
+ <setting id="aspect_ratio2" type="enum" label="32050" default="1"
lvalues="32051|32052"/>
</category>
</settings>
\ No newline at end of file
diff --git a/script.image.bigpictures/resources/skins/default/720p/script-The
Big Picture-main.xml
b/script.image.bigpictures/resources/skins/default/720p/script-The Big
Picture-main.xml
index f65aabb..ef8012a 100644
--- a/script.image.bigpictures/resources/skins/default/720p/script-The Big
Picture-main.xml
+++ b/script.image.bigpictures/resources/skins/default/720p/script-The Big
Picture-main.xml
@@ -10,7 +10,14 @@
<height>720</height>
<texture>black.png</texture>
</control>
- <control type="image">
+ <control type="label" id="102">
+ <description>Visibility-Placeholder</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>0</width>
+ <height>0</height>
+ </control>
+ <control type="image" id="101">
<description>The spinning animation in the
background</description>
<posx>607</posx>
<posy>327</posy>
@@ -18,18 +25,6 @@
<height>66</height>
<texture>loader.gif</texture>
</control>
- <control type="label" id="102">
- <description>"Loading may take a while"</description>
- <posx>20</posx>
- <posy>60</posy>
- <width>1200</width>
- <height>60</height>
- <align>left</align>
- <aligny>top</aligny>
- <label>$LOCALIZE[SCRIPT32001]</label>
- <textcolor>FFAAAAAA</textcolor>
- <font>font13</font>
- </control>
<control type="list" id="100">
<description>Main list of Images</description>
<posx>0</posx>
@@ -40,6 +35,14 @@
<orientation>horizontal</orientation>
<preloaditems>10</preloaditems>
<itemlayout width="1280" height="720">
+ <control type="image">
+ <description>The spinning animation in the
background</description>
+ <posx>607</posx>
+ <posy>327</posy>
+ <width>66</width>
+ <height>66</height>
+ <texture>loader.gif</texture>
+ </control>
<control type="largeimage">
<description>The Picture in ratio scale</description>
<posx>0</posx>
@@ -72,7 +75,7 @@
<aligny>center</aligny>
<label>$INFO[ListItem.Property(Album)]</label>
<textcolor>FFDDDDDD</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<font>font13</font>
</control>
<control type="label">
@@ -85,7 +88,7 @@
<aligny>center</aligny>
<label>$INFO[ListItem.Label]</label>
<textcolor>FFDDDDDD</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<font>font13</font>
</control>
<control type="label">
@@ -98,11 +101,19 @@
<aligny>center</aligny>
<label>($INFO[ListItem.Property(duration)])</label>
<textcolor>FFDDDDDD</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<font>font13</font>
</control>
</itemlayout>
<focusedlayout width="1280" height="720">
+ <control type="image">
+ <description>The spinning animation in the
background</description>
+ <posx>607</posx>
+ <posy>327</posy>
+ <width>66</width>
+ <height>66</height>
+ <texture>loader.gif</texture>
+ </control>
<control type="largeimage">
<description>The Picture in ratio scale</description>
<posx>0</posx>
@@ -133,7 +144,7 @@
<height>64</height>
<texture border="0,0,20,0">HeaderBack.png</texture>
<colordiffuse>AAFFFFFF</colordiffuse>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
<control type="label">
@@ -146,7 +157,7 @@
<aligny>center</aligny>
<label>$INFO[ListItem.Property(Album)]</label>
<textcolor>FFDDDDDD</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<font>font13</font>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
@@ -160,7 +171,7 @@
<aligny>center</aligny>
<label>$INFO[ListItem.Label]</label>
<textcolor>FFDDDDDD</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<font>font13</font>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
@@ -174,12 +185,12 @@
<aligny>center</aligny>
<label>($INFO[ListItem.Property(duration)])</label>
<textcolor>FFDDDDDD</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<font>font13</font>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
<control type="image">
- <description>Arrow
left</description>
+ <description>Arrow left</description>
<animation type="Focus">
<effect type="slide" start="-50,0" end="0"
time="100" delay="2000"/>
<effect type="fade" start="0" end="100" time="100"
delay="2000"/>
@@ -189,11 +200,11 @@
<width>80</width>
<height>80</height>
<texture>left.png</texture>
- <visible>$INFO[ListItem.Property(show_info)] +
Container(100).HasPrevious</visible>
+ <visible>ListItem.Property(show_info) +
Container(100).HasPrevious</visible>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
<control type="image">
- <description>Arrow
right</description>
+ <description>Arrow right</description>
<animation type="Focus">
<effect type="slide" start="50,0" end="0"
time="100" delay="2000"/>
<effect type="fade" start="0" end="100" time="100"
delay="2000"/>
@@ -203,7 +214,7 @@
<width>80</width>
<height>80</height>
<texture>right.png</texture>
- <visible>$INFO[ListItem.Property(show_info)] +
Container(100).HasNext</visible>
+ <visible>ListItem.Property(show_info) +
Container(100).HasNext</visible>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
<control type="image">
@@ -216,7 +227,7 @@
<width>1280</width>
<height>270</height>
<texture>DescriptionBack.png</texture>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
<control type="textbox">
@@ -235,7 +246,7 @@
<wrapmultiline>true</wrapmultiline>
<label>$INFO[ListItem.Label2]</label>
<textcolor>white</textcolor>
- <visible>$INFO[ListItem.Property(show_info)]</visible>
+ <visible>Control.IsVisible(102)</visible>
<animation effect="fade"
time="200">VisibleChange</animation>
</control>
</focusedlayout>
-----------------------------------------------------------------------
Summary of changes:
script.image.bigpictures/addon.xml | 2 +-
script.image.bigpictures/changelog.txt | 11 ++++
script.image.bigpictures/resources/lib/gui.py | 47 +++++++--------
.../resources/lib/scrapers/1_tbp.py | 2 +-
.../resources/lib/scrapers/2_aif.py | 25 ++++----
.../resources/lib/scrapers/5_tcp.py | 46 ++++++++++++++
.../resources/lib/scrapers/6_time.py | 58 ++++++++++++++++++
script.image.bigpictures/resources/settings.xml | 2 +-
.../default/720p/script-The Big Picture-main.xml | 63 ++++++++++++--------
9 files changed, 190 insertions(+), 66 deletions(-)
create mode 100644 script.image.bigpictures/resources/lib/scrapers/5_tcp.py
create mode 100644 script.image.bigpictures/resources/lib/scrapers/6_time.py
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons