Skip to content

Commit

Permalink
v1.3.2: patched Places; Featured cams extended
Browse files Browse the repository at this point in the history
  • Loading branch information
idleloop-github committed Jan 8, 2019
1 parent 6972a97 commit e704dff
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 23 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ EarthCam.com is the premiere network of scenic webcams and offers a complete dat

### Installation

* [download released zip](https://github.com/idleloop-github/xbmc-earthcam/releases/download/v1.3.1/plugin.video.earthcam-1.3.1.zip)
* [download released zip](https://github.com/idleloop-github/xbmc-earthcam/releases/download/v1.3.2/plugin.video.earthcam-1.3.2.zip)
* Kodi/XBMC: System / Add-ons / Install from zip file /
* or Kodi 17: Add-ons / Download / ".." / Install from zip file /
* select [earthcam's zip file](https://github.com/idleloop-github/xbmc-earthcam/releases/download/v1.3.1/plugin.video.earthcam-1.3.1.zip)
* select [earthcam's zip file](https://github.com/idleloop-github/xbmc-earthcam/releases/download/v1.3.2/plugin.video.earthcam-1.3.2.zip)
* Note that Kodi will complain about installing from "Unknown sources": in this case, activate this option, and repeat the installation steps.

From version 1.2.0 on, this add-on can play [HLS streams](https://en.wikipedia.org/wiki/HTTP_Live_Streaming), and this mode is more stable than [RTMP](https://en.wikipedia.org/wiki/Real-Time_Messaging_Protocol).
Expand All @@ -28,7 +28,7 @@ Steps to install an **inputstream.rtmp** add-on from [kodinerds repo](https://gi
* Download the appropriate *repository.kodinerds_X.zip* zip file for your platform [from here](https://github.com/kodinerds/binary-repo).
* Install this repository on Kodi: Add-ons / Download / .. / Install from zip file / *and select kodiners' zip file*. Previously, "Unknown Sources" must have been activated on: Settings / System / Add-ons / Unknown sources
* Install *inputstream.rtmp* add-on: Add-ons / Download / .. / Install from repository / kodinerds / VideoPlayer InputStream / RTMP Input
* and then, install *plugin.video.earthcam*: Add-ons / Download / .. / Install from zip file / select [earthcam's zip file](https://github.com/idleloop-github/xbmc-earthcam/releases/download/v1.3.1/plugin.video.earthcam-1.3.1.zip).
* and then, install *plugin.video.earthcam*: Add-ons / Download / .. / Install from zip file / select [earthcam's zip file](https://github.com/idleloop-github/xbmc-earthcam/releases/download/v1.3.2/plugin.video.earthcam-1.3.2.zip).

##### Enable HLS playing
From version 1.2.0 on, this add-on can play [HLS streams](https://en.wikipedia.org/wiki/HTTP_Live_Streaming).
Expand Down
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.earthcam"
name="EarthCam"
version="1.3.1"
version="1.3.2"
provider-name="idleloop, (forked from xbmchub.com)">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.3.2
(2019, Jan)
patched Places; Featured cams extended

v1.3.1
(2019, Jan)
patched Search
Expand Down
55 changes: 37 additions & 18 deletions channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def isGeneric():


def mainlist(item):
logger.info("[channel.py] mainlist")
if (DEBUG): ("[channel.py] mainlist")
itemlist=[]
itemlist.append( Item(action="cams", title="Featured Cams" , url=URL ) )
itemlist.append( Item(action="cams", title="Featured Cams" , url=PLACES_URL ) )
itemlist.append( Item(action="places", title="Places" , url=PLACES_URL ) )
itemlist.append( Item(action="searching", title="Search" , url='' ) )
return itemlist
Expand Down Expand Up @@ -107,16 +107,16 @@ def _get_category(item, category):
divs = parseDOM( html, 'div', attrs={'class': r'[^\'"]*?col\-xs\-12' } )
zone = parseDOM( html, 'p', attrs={ 'class': 'pageTitle' } )[0].replace(':', '')
for _id, div in enumerate( divs ):
thumbnail = parseDOM( div, 'img', ret='src' )[0].replace('256x144', '512x288').replace('128x72', '256x144')
url = parseDOM( div, 'a', ret='href' )[0]
title = parseDOM( div, 'span', attrs={'class': 'featuredTitle'} )[0]
location = parseDOM( div, 'div', attrs={ 'class': 'featuredCity' } )[0] + ', ' + zone
plot = title + "\n(" + location + ')'
if plot == None: plot=''
if (DEBUG): logger.info("%s, %s, %s, %s, %s" % (title, thumbnail, url, location, plot))
item=Item(action="play", title=title, url=url, thumbnail=thumbnail,
fanart=thumbnail, plot=plot )
itemlist.append( item )
thumbnail = parseDOM( div, 'img', ret='src' )[0].replace('256x144', '512x288').replace('128x72', '256x144')
url = parseDOM( div, 'a', ret='href' )[0]
title = parseDOM( div, 'span', attrs={'class': 'featuredTitle'} )[0]
location = parseDOM( div, 'div', attrs={ 'class': 'featuredCity' } )[0] + ', ' + zone
plot = title + "\n(" + location + ')'
if plot == None: plot=''
if (DEBUG): logger.info("%s, %s, %s, %s, %s" % (title, thumbnail, url, location, plot))
item=Item(action="play", title=title, url=url, thumbnail=thumbnail,
fanart=thumbnail, plot=plot )
itemlist.append( item )

try:
links = parseDOM( parseDOM( html, 'div', attrs={'id': 'pagination_bottom'} ), 'a', ret='href' )
Expand All @@ -129,7 +129,7 @@ def _get_category(item, category):
category = 'search_results'
else:
url = URL + PREFIX_PATCH + url[1:]
logger.info(url)
if (DEBUG): (url)
item=Item(action=category, title='Next >>' , url=url, thumbnail='',
fanart='', plot='' )
itemlist.append( item )
Expand All @@ -140,17 +140,17 @@ def _get_category(item, category):


def search_results(item):
logger.info("[channel.py] search_results")
if (DEBUG): ("[channel.py] search_results")
return _get_category( item, 'search_results' )


def place(item):
logger.info("[channel.py] place")
if (DEBUG): ("[channel.py] place")
return _get_category( item, 'place' )


def places(item):
logger.info("[channel.py] places")
if (DEBUG): ("[channel.py] places")
itemlist = []
html = _get_html( item.url )
places = parseDOM( html, 'a', attrs={'class': 'locationLink'} )
Expand All @@ -166,12 +166,31 @@ def places(item):

# featured cams
def cams(item):
logger.info("[channel.py] cams")
if (DEBUG): ("[channel.py] cams")
itemlist = []

if (DEBUG): logger.info("url=" + item.url)

html = _get_html( item.url )
divs = parseDOM( html, 'div', attrs={'class': r'[^\'"]*?col\-xs\-12' } )
for _id, div in enumerate( divs ):
thumbnail = parseDOM( div, 'img', ret='src' )[0].replace('256x144', '512x288').replace('128x72', '256x144')
url = parseDOM( div, 'a', ret='href' )[0]
if 'www.earthcam.com' not in url or 'alexa' in url or 'myearthcam' in url:
continue
title = parseDOM( div, 'span', attrs={'class': 'featuredTitle'} )[0]
location = parseDOM( div, 'div', attrs={ 'class': 'featuredCity' } )[0]
plot = title + "\n(" + location + ')'
if plot == None: plot=''
if (DEBUG): logger.info("%s, %s, %s, %s, %s" % (title, thumbnail, url, location, plot))
item=Item(action="play", title=title, url=url, thumbnail=thumbnail,
fanart=thumbnail, plot=plot )
itemlist.append( item )

# more cameras from front page
if (DEBUG): logger.info("url=" + URL)

html = _get_html( URL )
divs = parseDOM( html, 'div', attrs={ 'class': '[^\'"]*?camera_block[^\'"]*?' } )

for _id, div in enumerate(divs):
Expand Down Expand Up @@ -232,7 +251,7 @@ def previous_play(item, just_check=False):
itemlist.append( new_item )
return itemlist
except Exception, e:
logger.info("[earthcam] channel.py " + str(e))
if (DEBUG): ("[earthcam] channel.py " + str(e))
return []
if (DEBUG): logger.info("json_text="+json_text)
if json_text.startswith('%'):
Expand Down
2 changes: 1 addition & 1 deletion core/scrapertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def cache_page(url,post=None,headers=[['User-Agent', 'Mozilla/5.0 (Macintosh; U;
# TODO: (3.1) Quitar el parámetro modoCache (ahora se hace por configuración)
# TODO: (3.2) Usar notación minusculas_con_underscores para funciones y variables como recomienda Python http://www.python.org/dev/peps/pep-0008/
def cachePage(url,post=None,headers=[['User-Agent', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12']],modoCache=CACHE_ACTIVA, timeout=socket.getdefaulttimeout()):
url = urllib2.quote(url, safe='/:?=&') # :-o
url = urllib2.quote(url, safe='/:?=&%+') # :-o
if (DEBUG==True): logger.info("[scrapertools.py] cachePage url="+url)
modoCache = config.get_setting("cache.mode")

Expand Down

0 comments on commit e704dff

Please sign in to comment.