Skip to content

Commit

Permalink
Last Aracnoz release
Browse files Browse the repository at this point in the history
  • Loading branch information
phate89 committed Apr 20, 2016
0 parents commit 959038b
Show file tree
Hide file tree
Showing 11 changed files with 1,190 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

Empty file added README
Empty file.
18 changes: 18 additions & 0 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.videomediaset" name="Video Mediaset" provider-name="aracnoz" version="1.1.0">
<requires>
<import addon="xbmc.python" version="2.1.0" />
<import addon="script.module.beautifulsoup4" version="4.3.2" />
</requires>
<extension library="default.py" point="xbmc.python.pluginsource">
<provides>video audio</provides>
</extension>
<extension point="xbmc.addon.metadata">
<language>it</language>
<platform>all</platform>
<summary lang="it">I programmi delle reti Mediaset</summary>
<description lang="it">Tutti i tuoi programmi preferiti sono disponibili per te il giorno dopo la messa in onda Tv. Ieri sera ti sei perso la tua fiction preferita? Nessun problema finalmente puoi rivederla comodamente su KODI ogni volta che vuoi.</description>
<summary lang="en">The broadcasts of Mediaset channels</summary>
<description lang="en">All your favorite shows are available to you the day after the airing Tv. Last night you missed your favorite TV drama? No problem, you can finally see her comfortably on KODI whenever you want.</description>
</extension>
</addon>
37 changes: 37 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[B]1.1.0[/B]
- added section "Canali Live"

[B]1.0.9[/B]
- updated plugin to work with the new videomediaset website

[B]1.0.8[/B]
- added section <season> in Episode List to show old episodes

[B]1.0.7[/B]
- updated all sections "Ultime puntate" and "Ultime Sport Mediaset" to work with latest change in videomediaset website

[B]1.0.6[/B]
- updated plugin to work with the latest change in videomediaset website

[B]1.0.5[/B]
- updated plugin to work with the new videomediaset website

[B]1.0.4[/B]
- fix error "Remote share: Could not connect to network server" with XBMC 13 Gotham

[B]1.0.3[/B]
- moved previous root into "Elenco programmi"
- general speed optimization for section "Elenco programmi"
- added sections with shortcuts to the latest full videos
- added sections with shortcuts to the most viewed clips
- added sections with shortcuts to latest clips of SportMediaset
- cleanup code

[B]1.0.2[/B]
- added search text

[B]1.0.1[/B]
- added import addon beautifulsoup in requires

[B]1.0[/B]
- first release
225 changes: 225 additions & 0 deletions default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
# -*- coding: utf-8 -*-
import os
import sys
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import urllib
import urlparse
from resources.lib.mediaset import Mediaset

# plugin constants
__plugin__ = "plugin.video.videomediaset"
__author__ = "aracnoz"

Addon = xbmcaddon.Addon(id=__plugin__)

# plugin handle
handle = int(sys.argv[1])

# utility functions
def parameters_string_to_dict(parameters):
paramDict = dict(urlparse.parse_qsl(parameters[1:]))
return paramDict

def pulisci_cerca(s):
s = s.lower()
s = s.replace("à","a")
s = s.replace("è","e")
s = s.replace("é","e")
s = s.replace("ì","i")
s = s.replace("ò","o")
s = s.replace("ù","u")
s = s.replace(" ","-")
s = s.replace("'","-")
return s

def parameters (p):
return sys.argv[0] + '?' + urllib.urlencode(p)

def addDir (s,p):
item = xbmcgui.ListItem(s)
return xbmcplugin.addDirectoryItem(handle=handle, url=parameters(p), listitem=item, isFolder=True)

def addDir_ep (s,t,p):
item = xbmcgui.ListItem("[COLOR blue]"+s+"[/COLOR]",thumbnailImage=t)
return xbmcplugin.addDirectoryItem(handle=handle, url=parameters(p), listitem=item, isFolder=False)

def stamp_ep(ep):
addDir_ep(ep["titolo"],ep["thumbs"],{'mode':'playMediaset','title':ep["titolo"],'stream_id':ep["id"],'thumbs':ep["thumbs"],'desc':ep["desc"]})

def stamp_live(ch):
addDir_ep(ch["titolo"],ch["thumbs"],{'mode':'playLive','title':ch["titolo"],'stream_url':ch["url"],'thumbs':ch["thumbs"],'desc':ch["desc"]})

def endDir():
return xbmcplugin.endOfDirectory(handle=handle, succeeded=True)

# UI builder functions

def root():
addDir("Canali Live",{'mode':'canali_live'})
addDir("Elenco programmi",{'mode':'elenco_programmi'})
addDir("Ultime puntate News",{'mode':'ultime_puntate','prog_tipo':'news'})
addDir("Ultime puntate Sport",{'mode':'ultime_puntate','prog_tipo':'sport'})
addDir("Ultime puntate Intrattenimento",{'mode':'ultime_puntate','prog_tipo':'intrattenimento'})
addDir("Ultime puntate Fiction",{'mode':'ultime_puntate','prog_tipo':'fiction'})
addDir("Ultime puntate Elenco canali",{'mode':'ultime_puntate_canali'})
addDir("Ultime Sport Mediaset",{'mode':'sportmediaset'})
addDir("Più visti Ieri",{'mode':'piuvisti','range_visti':'ieri'})
addDir("Più visti Settimana",{'mode':'piuvisti','range_visti':'settimana'})
addDir("Più visti Mese",{'mode':'piuvisti','range_visti':'mese'})
addDir("Cerca...",{'mode':'cerca'})
endDir()

def sportmediaset_root():
addDir("Highlights",{'mode':'sportmediaset','progsport_tipo':'tutti_i_gol'})
addDir("Calcio",{'mode':'sportmediaset','progsport_tipo':'calcio'})
addDir("Champions League",{'mode':'sportmediaset','progsport_tipo':'champions_league'})
addDir("Europa League",{'mode':'sportmediaset','progsport_tipo':'europa_league'})
addDir("Altri sport",{'mode':'sportmediaset','progsport_tipo':'altrisport'})
addDir("Motori",{'mode':'sportmediaset','progsport_tipo':'motori'})
endDir()

def puntate_canali_root():
addDir("Italia 1",{'mode':'ultime_puntate','prog_tipo':' i1 '})
addDir("Canale 5",{'mode':'ultime_puntate','prog_tipo':' c5 '})
addDir("Rete 4",{'mode':'ultime_puntate','prog_tipo':' r4 '})
addDir("Italia 2",{'mode':'ultime_puntate','prog_tipo':' i2 '})
addDir("La 5",{'mode':'ultime_puntate','prog_tipo':' ka '})
endDir()

def canali_live_root():
mediaset = Mediaset()
for ch in mediaset.get_canali_live():
stamp_live(ch)
endDir()

def elenco_programmi_root():
mediaset = Mediaset()
for lettera in mediaset.get_prog_root():
addDir(lettera["index"],{'mode':'elenco_programmi','prog_id':lettera["index"]})
endDir()

def elenco_programmi_list(progId):
mediaset = Mediaset()
for lettera in mediaset.get_prog_root():
if lettera['index'] == progId:
for programma in lettera["program"]:
addDir(programma["label"],{'mode':'elenco_programmi','prog_id':lettera["index"],'prog_url':programma["url"].replace("archivio-news.shtml","archivio-video.shtml")})
endDir()

def elenco_programmi_epList(progId,progUrl):
mediaset = Mediaset()
for ep in mediaset.get_prog_epList(progUrl):
stamp_ep(ep)
for season in mediaset.get_prog_seasonList(progUrl):
addDir(season["titolo"],{'mode':'elenco_programmi','prog_id':progId,'prog_url':season["url"]})
endDir()

def sportmediaset_epList(progsportTipo):
mediaset = Mediaset()
for ep in mediaset.get_sport_epList():
if (ep["tipo"].lower().find(progsportTipo) > 0): stamp_ep(ep)
endDir()

def puntate_epList(progTipo):
mediaset = Mediaset()
for ep in mediaset.get_global_epList(0,0):
if (ep["tipo"].lower().find(progTipo) > 0): stamp_ep(ep)
endDir()

def piuvisti_epList(rangeVisti):
mediaset = Mediaset()
for ep in mediaset.get_global_epList(1,rangeVisti):
stamp_ep(ep)
endDir()

def cerca():
kb = xbmc.Keyboard()
kb.setHeading("Cerca un programma")
kb.doModal()
if kb.isConfirmed():
text = kb.getText()
text = pulisci_cerca(text)
mediaset = Mediaset()
for lettera in mediaset.get_prog_root():
for programma in lettera["program"]:
if (programma["mc"].find(text) > 0):
addDir(programma["label"],{'mode':'elenco_programmi','prog_id':lettera["index"],'prog_url':programma["url"].replace("archivio-news.shtml","archivio-video.shtml")})
endDir()

def playMediaset(title,streamId,thumbs,desc):
mediaset = Mediaset()
url = mediaset.get_stream(streamId)

# Play the item
item=xbmcgui.ListItem(title, thumbnailImage=thumbs)
item.setInfo(type="Video", infoLabels={"Title": title, "Plot":desc})

if (url["mp4"] != ""): stream = url["mp4"]
else: stream = url["wmv"]

print "videomediaset: play %s" % stream
xbmc.Player().play(stream,item)

def playLive(title,streamUrl,thumbs,desc):
# Play the item
item=xbmcgui.ListItem(title, thumbnailImage=thumbs)
item.setInfo(type="Video", infoLabels={"Title": title, "Plot":desc})

print "videomediaset: play %s" % streamUrl
xbmc.Player().play(streamUrl,item)

# parameter values
params = parameters_string_to_dict(sys.argv[2])
mode = str(params.get("mode", ""))
progId = str(params.get("prog_id", ""))
progUrl = str(params.get("prog_url", ""))
progTipo = str(params.get("prog_tipo", ""))
progsportTipo = str(params.get("progsport_tipo", ""))
title = str(params.get("title", ""))
streamId = str(params.get("stream_id", ""))
streamUrl = str(params.get("stream_url", ""))
thumbs = str(params.get("thumbs", ""))
desc = str(params.get("desc", ""))
rangeVisti = str(params.get("range_visti", ""))

if mode == "canali_live":
canali_live_root()

elif mode == "elenco_programmi":
if progId == "":
elenco_programmi_root()
elif progUrl == "":
elenco_programmi_list(progId)
else:
elenco_programmi_epList(progId,progUrl)

elif mode == "sportmediaset":
if progsportTipo == "":
sportmediaset_root()
else:
sportmediaset_epList(progsportTipo)

elif mode == "ultime_puntate":
puntate_epList(progTipo)

elif mode == "ultime_puntate_canali":
puntate_canali_root()

elif mode == "piuvisti":
piuvisti_epList(rangeVisti)

elif mode == "cerca":
cerca()

elif mode == "playMediaset":
playMediaset(title, streamId, thumbs, desc)

elif mode == "playLive":
playLive(title, streamUrl, thumbs, desc)

else:
root()

Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added resources/__init__.py
Empty file.
Empty file added resources/lib/__init__.py
Empty file.
Loading

0 comments on commit 959038b

Please sign in to comment.