The branch, frodo has been updated
       via  ed8a56ca15903d76daa0e2ddc98b2725d3c84ab0 (commit)
      from  f3a25ac4ad898f5db221537426ab67b28b963267 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=ed8a56ca15903d76daa0e2ddc98b2725d3c84ab0

commit ed8a56ca15903d76daa0e2ddc98b2725d3c84ab0
Author: beenje <[email protected]>
Date:   Wed Aug 14 22:10:39 2013 +0200

    [plugin.video.attactv] updated to version 1.1.3

diff --git a/plugin.video.attactv/addon.xml b/plugin.video.attactv/addon.xml
index 8253ee3..4d160df 100644
--- a/plugin.video.attactv/addon.xml
+++ b/plugin.video.attactv/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.attactv" name="attac tv" version="1.1.2" 
provider-name="Jose Antonio Montes (jamontes)">
+<addon id="plugin.video.attactv" name="attac tv" version="1.1.3" 
provider-name="Jose Antonio Montes (jamontes)">
     <requires>
         <import addon="xbmc.python" version="2.1.0"/>
         <import addon="plugin.video.youtube" version="4.4.1"/>
diff --git a/plugin.video.attactv/changelog.txt 
b/plugin.video.attactv/changelog.txt
index 5d8ff9c..bf46d14 100644
--- a/plugin.video.attactv/changelog.txt
+++ b/plugin.video.attactv/changelog.txt
@@ -1,3 +1,6 @@
+1.1.3 (2013.08.14)
+- Added Search option for videos.
+- Improve navigation through video lists.
 1.1.2 (2013.07.21)
 - Modified video parser due to Dailymotion site changes.
 1.1.1
diff --git a/plugin.video.attactv/default.py b/plugin.video.attactv/default.py
index 6dc20a0..825c4a6 100644
--- a/plugin.video.attactv/default.py
+++ b/plugin.video.attactv/default.py
@@ -71,25 +71,91 @@ def run():
     params = lutil.get_plugin_parms()
     
     if params.get("action") is None:
-        main_list(params)
+        create_index(params)
     else:
         action = params.get("action")
         exec action+"(params)"
     
 
+# Main index menu
+def create_index(params):
+    lutil.log("attactv.create_index "+repr(params))
+
+    # All Videos entry
+    action = 'main_list'
+    url = entry_url[language]
+    title = translation(30014)
+    lutil.log('attactv.create_index action=["%s"] title=["All the Videos"] 
url=["%s"]' % (action, url))
+    lutil.addDir(action=action, title=title, url=url)
+
+    # Search
+    action = 'search'
+    url   = ''
+    title = translation(30015)
+    lutil.log('attactv.create_index action=["%s"] title=["Search"] url=["%s"]' 
% (action, url))
+    lutil.addDir(action=action, title=title, url=url)
+
+    lutil.close_dir(pluginhandle, updateListing=False)
+
+# This function performs a search through all the videos catalogue.
+def search(params):
+    search_string = lutil.get_keyboard_text(translation(30015))
+    if search_string:
+        if language == 'es':
+            params['url'] = 'http://www.attac.tv/?s=%s&lang=%s' % 
(lutil.get_url_encoded(search_string), language)
+        else:
+            params['url'] = 'http://www.attac.tv/%s/?s=%s&lang=%s' % 
(language, lutil.get_url_encoded(search_string), language)
+        lutil.log("attactv.search Value of search url: %s" % params['url'])
+        return main_list(params)
+    else:
+        return lutil.close_dir(pluginhandle)
+
+
 # Main menu
 def main_list(params):
     lutil.log("attactv.main_list "+repr(params))
 
-    # On the first page, pagination parameters are fixed per language with the 
"all the videos" list.
-    if params.get('url') is None:
-        params['url'] = entry_url[language] 
-
     # Loads the web page from attac.tv with the video list.
-    buffer_web = lutil.carga_web(params.get("url"))
-    
-    # Extract video items from the html content
+    page_url = params.get("url")
+    reset_cache = params.get("reset_cache")
+
+    buffer_web = lutil.carga_web(page_url)
+
     pattern_videos = '<a href="([^"]*?)" rel="bookmark" title="Permanent Link: 
([^"]*?)"><img width="[^"]*?" height="[^"]*?" src="([^"]*?)" 
class="attachment-miniatura wp-post-image" alt="[^"]*?" title="[^"]*?" /></a>'
+    pattern_video_excerpt = '<div id="feature-video-excerpt">'
+    pattern_page_num = '/page/([0-9]+)'
+    pattern_prevpage = '<a class="prev page-numbers" href="([^"]*?)">'
+    pattern_nextpage = '<a class="next page-numbers" href="([^"]*?)">'
+    pattern_lastpage_num = "<a class='page-numbers' href='[^']*?'>([^<]*?)</a>"
+    pattern_featured = '<h1><a href="([^"]*?)" 
rel="bookmark">([^<]*?)</a></h1>'
+
+    # We check that there is no empty search result:
+    if lutil.find_first(buffer_web, pattern_video_excerpt):
+        lutil.log("attactv.main_list We have found an empty search result page 
page_url: %s" % page_url)
+        lutil.close_dir(pluginhandle)
+        return
+        
+    # We must setup the previous page entry from the second page onwards.
+    prev_page_url  = lutil.find_first(buffer_web, pattern_prevpage)
+    if prev_page_url:
+        prev_page_url = prev_page_url.replace('&#038;', '&') # Fixup prev_page 
on search.
+        prev_page_num = lutil.find_first(prev_page_url, pattern_page_num)
+        reset_cache = "yes"
+        lutil.log("attactv.main_list Value of prev_page_url: %s" % 
prev_page_url)
+        lutil.addDir(action="main_list", title="<< %s (%s)" % 
(translation(30013), prev_page_num), url=prev_page_url, reset_cache=reset_cache)
+
+    # This is to force ".." option to go back to main index instead of 
previous page list.
+    updateListing = reset_cache == "yes"
+
+    # Check for featured video in search result as first video in list.
+    for featured_video, featured_title in lutil.find_multiple(buffer_web, 
pattern_featured):
+        title = featured_title.replace('&quot;', '"').replace('&#039;', 
'´').replace('&amp;', '&')  # Cleanup the title.
+        url = featured_video
+        lutil.log('Featured video in search result: URL: "%s" Title: "%s"' % 
(url, title))
+        lutil.addLink(action="play_video", title=title, url=url)
+
+
+    # Extract video items from the html content
     videolist = lutil.find_multiple(buffer_web,pattern_videos)
 
     for url, title, thumbnail in videolist:
@@ -101,13 +167,15 @@ def main_list(params):
         lutil.addLink(action="play_video", title=title, plot=plot, 
url=url,thumbnail=thumbnail)
  
     # Here we get the next page URL to add it at the end of the current video 
list page.
-    pattern_nextpage = '<a class="next page-numbers" href="([^"]*?)">'
     next_page_url = lutil.find_first(buffer_web, pattern_nextpage)
     if next_page_url:
-        lutil.log("Value of next_page_url: %s" % next_page_url)
-        lutil.addDir(action="main_list", title=">> %s" % translation(30010), 
url=next_page_url)
+        next_page_num = lutil.find_first(next_page_url, pattern_page_num)
+        last_page = lutil.find_multiple(buffer_web, pattern_lastpage_num)[-1]
+        next_page_url = next_page_url.replace('&#038;', '&') # Fixup next_page 
on search.
+        lutil.log('Value of next page: "(%s/%s)" next_page_url: "%s"' % 
(next_page_num, last_page, next_page_url))
+        lutil.addDir(action="main_list", title=">> %s (%s/%s)" % 
(translation(30010), next_page_num, last_page), url=next_page_url, 
reset_cache=reset_cache)
 
-    lutil.close_dir(pluginhandle)
+    lutil.close_dir(pluginhandle, updateListing=updateListing)
 
 
 # This funtion search into the URL link to get the video link from the 
different sources.
diff --git a/plugin.video.attactv/lutil.py b/plugin.video.attactv/lutil.py
index d537017..88fd1dd 100644
--- a/plugin.video.attactv/lutil.py
+++ b/plugin.video.attactv/lutil.py
@@ -19,7 +19,7 @@
 
    Description:
    These funtions are called from the main plugin module, aimed to ease and 
simplify the plugin development process.
-   Release 0.1.3
+   Release 0.1.4
 '''
 
 # First of all We must import all the libraries used for plugin development.
@@ -70,11 +70,32 @@ def get_plugin_parms():
     _log("get_plugin_parms " + repr(options))
     return options
 
+
 # This function returns the URL decoded.
 def get_url_decoded(url):
     _log('get_url_decoded URL: "%s"' % url)
     return urllib.unquote_plus(url)
 
+
+# This function returns the URL encoded.
+def get_url_encoded(url):
+    _log('get_url_encoded URL: "%s"' % url)
+    return urllib.quote_plus(url)
+
+
+# This function gets an input text from the keyboard.
+def get_keyboard_text(prompt):
+    _log('get_keyboard_text prompt: "%s"' % prompt)
+
+    keyboard = xbmc.Keyboard('', prompt)
+    keyboard.doModal()
+    if keyboard.isConfirmed() and keyboard.getText():
+        _log("get_keyboard_text input text: '%s'" % keyboard.getText())
+        return keyboard.getText()
+    else:
+        return ""
+
+
 # This function loads the html code from a webserver and returns it into a 
string.
 def carga_web(url):
     _log("carga_web " + url)
@@ -136,10 +157,10 @@ def find_first(text,pattern):
 
 
 # This function adds a directory entry into the XBMC GUI throught the API
-def addDir(action = "", title = "", url = "", thumbnail = ""):
-    _log("addDir action = [" + action + "] title = [" + title + "] url = [" + 
url + "] thumbnail = [" + thumbnail + "]")
+def addDir(action = "", title = "", url = "", thumbnail = "", reset_cache = 
"no"):
+    _log('addDir action = "%s" url = "%s" thumbnail = "%s" reset_cache = "%s"' 
% (action, url, thumbnail, reset_cache))
 
-    dir_url = '%s?action=%s&url=%s' % (sys.argv[0], action, 
urllib.quote_plus(url))
+    dir_url = '%s?action=%s&reset_cache=%s&url=%s' % (sys.argv[0], action, 
reset_cache, urllib.quote_plus(url))
     dir_item = xbmcgui.ListItem(title, iconImage = "DefaultFolder.png", 
thumbnailImage = thumbnail)
     dir_item.setInfo(type = "Video", infoLabels = {"Title": title})
     return xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = 
dir_url, listitem = dir_item, isFolder = True)
@@ -147,7 +168,7 @@ def addDir(action = "", title = "", url = "", thumbnail = 
""):
 
 # This function adds a video link entry into the XBMC GUI throught the API
 def addLink(action = "", title = "", plot = "", url = "", thumbnail = ""):
-    _log("addDir action = [" + action + "] title = [" + title + "] plot = [" + 
plot + "] url = [" + url + "] thumbnail = [" + thumbnail + "]")
+    _log("addLink action = [" + action + "] title = [" + title + "] plot = [" 
+ plot + "] url = [" + url + "] thumbnail = [" + thumbnail + "]")
 
     link_url = '%s?action=%s&url=%s' % (sys.argv[0], action, 
urllib.quote_plus(url))
     link_item = xbmcgui.ListItem(title, iconImage = "DefaultVideo.png", 
thumbnailImage = thumbnail)
@@ -157,9 +178,9 @@ def addLink(action = "", title = "", plot = "", url = "", 
thumbnail = ""):
 
 
 # This function closes the directory created with all the item list previously 
added.
-def close_dir(pluginhandle):
-    _log("close_dir pluginhadle: %s" % pluginhandle)
-    xbmcplugin.endOfDirectory(pluginhandle)
+def close_dir(pluginhandle, succeeded=True, updateListing=False, 
cacheToDisc=True):
+    _log("close_dir pluginhadle: %s updateListing: %s cacheToDisc: %s" % 
(pluginhandle, updateListing, cacheToDisc))
+    xbmcplugin.endOfDirectory(pluginhandle, succeeded=succeeded, 
updateListing=updateListing, cacheToDisc=cacheToDisc)
 
 
 # This funtion shows a popup window with a notices message through the XBMC 
GUI during 5 secs.
diff --git a/plugin.video.attactv/resources/language/English/strings.xml 
b/plugin.video.attactv/resources/language/English/strings.xml
index b4aaca9..8d060e8 100644
--- a/plugin.video.attactv/resources/language/English/strings.xml
+++ b/plugin.video.attactv/resources/language/English/strings.xml
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
-  <string id="30010">Next Page</string>
+  <string id="30010">Next page</string>
   <string id="30011">Video type not supported</string>
   <string id="30012">Couldn't locate video url</string>
+  <string id="30013">Previous page</string>
+  <string id="30014">All videos</string>
+  <string id="30015">Search</string>
   <string id="30101">Language (for videos)</string>
   <string id="30102">Debug (enable logs)</string>
 </strings>
diff --git a/plugin.video.attactv/resources/language/French/strings.xml 
b/plugin.video.attactv/resources/language/French/strings.xml
index f01ae8a..d7ad8d3 100644
--- a/plugin.video.attactv/resources/language/French/strings.xml
+++ b/plugin.video.attactv/resources/language/French/strings.xml
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
-  <string id="30010">Page Suivant</string>
+  <string id="30010">Page suivant</string>
   <string id="30011">Type de video non supporte</string>
   <string id="30012">Adresse video non trouvee</string>
+  <string id="30013">Page précédente</string>
+  <string id="30014">Toutes les vidéos</string>
+  <string id="30015">Recherchez</string>
   <string id="30101">Langue (pour le vidéos)</string>
   <string id="30102">Debug (logs)</string>
 </strings>
diff --git a/plugin.video.attactv/resources/language/German/strings.xml 
b/plugin.video.attactv/resources/language/German/strings.xml
index 0cad1f0..5659866 100644
--- a/plugin.video.attactv/resources/language/German/strings.xml
+++ b/plugin.video.attactv/resources/language/German/strings.xml
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
-  <string id="30010">Nachste Seite</string>
+  <string id="30010">Nachste seite</string>
   <string id="30011">Video-Typ nicht unterstutzt</string>
   <string id="30012">Konnte Video-URL nicht finden</string>
+  <string id="30013">Vorherige seite</string>
+  <string id="30014">Alle videos</string>
+  <string id="30015">Suchen</string>
   <string id="30101">Sprache (Videos)</string>
   <string id="30102">Debug (logs)</string>
 </strings>
diff --git a/plugin.video.attactv/resources/language/Spanish/strings.xml 
b/plugin.video.attactv/resources/language/Spanish/strings.xml
index fa346fa..7945d6f 100644
--- a/plugin.video.attactv/resources/language/Spanish/strings.xml
+++ b/plugin.video.attactv/resources/language/Spanish/strings.xml
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
-  <string id="30010">Siguiente Pagina</string>
+  <string id="30010">Siguiente página</string>
   <string id="30011">Tipo de video no soportado</string>
   <string id="30012">No se ha podido localizar la url de video</string>
+  <string id="30013">Página anterior</string>
+  <string id="30014">Todos los vídeos</string>
+  <string id="30015">Buscar</string>
   <string id="30101">Lenguaje de los vídeos</string>
   <string id="30102">Debug (activa los logs)</string>
 </strings>

-----------------------------------------------------------------------

Summary of changes:
 plugin.video.attactv/addon.xml                     |    2 +-
 plugin.video.attactv/changelog.txt                 |    3 +
 plugin.video.attactv/default.py                    |   92 +++++++++++++++++---
 plugin.video.attactv/lutil.py                      |   37 ++++++--
 .../resources/language/English/strings.xml         |    5 +-
 .../resources/language/French/strings.xml          |    5 +-
 .../resources/language/German/strings.xml          |    5 +-
 .../resources/language/Spanish/strings.xml         |    5 +-
 8 files changed, 129 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to