πŸ“œ ⬆️ ⬇️

We write the plug-in for XBMC. So far without blackjack and all the rest


Hello. Speech in the topic will go about creating a plug-in (software add-on, add-on) to the wonderful program XBMC . Difficulty level: for beginners. Knowledge of HTML and a general idea of ​​how sites work; It doesn't hurt to know what Python looks like. Do not wait under the cut of unique algorithms and magic code, this is rather the starting point and a general explanation of the mechanics of the plug-ins. The code will, I hope, be visual.

Some of you may ask: β€œAfter all, there is a seppius repository that solves almost all the problems with playing online content in runet (in the context of XBMC). Why bicycles? I will give my reasons in a small preface.


')

Foreword


I started developing XBMC plugins when I got an extra laptop. It was decided not to lay a dead weight, to make multimedia set-top box for TV (TV was deprived of communication with the World Wide Web). XBMC was a smart solution to the problem, but here's the bad luck: I live in Kyrgyzstan. All traffic from IP addresses that are not related to our country is very expensive (externally, I don’t know if you have one like that? Only unlimited tariffs began to appear only a couple of months ago). But the internal traffic is practically free (many popular sites with media content are not charged at all by many providers). Invented, done. By the time of writing this article I have covered all the necessary resources. Now I am developing a PVR plugin.

I no longer write code in Python such as will be given in the article. But this was my starting point and understanding of the mechanisms of the additions.

Training


We will need:

Install the above. Your path may be different - I indicated my own in brackets: Python (C: \ Python \, hereinafter PathPython )

It will not be superfluous to know where the XBMC log file is:
Windows :% APPDATA% \ XBMC \ xbmc.log
Linux : $ HOME / .xbmc / temp / xbmc.log
Mac OS X : /Users//Library/Logs/xbmc.log

Part one. Training


I note that my knowledge of Python was virtually nil. Therefore, if you have never encountered him, it is not worth it. In the study of the functional area that we need, it is very simple. Well, at least I thought so.

The LineCinema website was selected as the guinea pig. Why? Because gladiolus I went to the topic Requests for the creation of plug-ins (XBMC Russia) and on one of the last pages (if you want accuracy, then on the 87th) I saw a request for this site. Then just a site.

So, create a new file in a text editor and write the following code:

# -*- coding: utf-8 -*- #     import urllib, urllib2, re, sys, os #      web- def GetHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urlencode({}), headers)) html = conn.read() conn.close() return html #    html = GetHTML('http://www.linecinema.org/') print html 

Save PathPython / test.py

Open the Command Prompt and go to the PathPython folder. We carry out:

python test.py

The result of its execution should be the source code of the Site page.
Visually

Now, in the browser, open the Site and climb into the source code (various web inspectors and firebug will not help us). Here you need to pay attention to the line

 <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> 

and do not forget that the page encoding is windows-1251.

We look for the links in the section β€œFilms By Genres” and find out that they look like

 <a href="/newsz/drama-online/" title="" class="mainmenu"></a><br /> 

Switch (or open, if you managed to close) on test.py. Delete row
 print html 

And in her place we write

 genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251')) #      (.+?)   url  title (    ) for url, title in genre_links: print title + ' [' + url + ']' 

Where (. +?) Is a regular expression that skips all characters (you can read about regular Python expressions in HabrΓ© ).

Save the file and repeat in the Command Line

python test.py

This time the result will be the names of the genres and the link.
Visually

But there are extra links that will be useless in XBMC: β€œHome”, β€œOrder a film”, β€œTech. Support". What to do with them? We will exclude them. For a start, it's rough, although you could use BeautifulSoup .

We will write the function isLinkUseful() , especially for the Site, isLinkUseful() "extra" links will be declared inside:

 def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] #  β€œβ€  return needle not in haystack 

and change the last lines:

 for url, title in genre_links: if isLinkUseful(url): print title + ' [' + url + ']' 

We are checking. Everything is as it should:
Visually

A little more workout. Now check one of the sections. I took the "Documentary" (/ newsz / dokumentalnyij-online /). Change the code:

 #url = 'http://www.linecinema.org/' #html = GetHTML(url) #genre_links = re.compile('<a href="(.+?)">(.+?)</a>').findall(html.decode('windows-1251')) #for url, title in genre_links: #if isLinkUseful(url): #print title + ' [' + url + ']' url = 'http://www.linecinema.org/newsz/dokumentalnyij-online/' html = GetHTML(url) genre_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251')) for url, title in genre_links: print title 

We check and see that we do not need to exclude anything here:
Visually

Here we used

(.+?)

(yes, with spaces), since in the source code, too, with spaces, and if we used just (.+?) , we would get all the links from the page. And we need it?

Part two. Adapt to XBMC


For a start, it would be nice to create a folder (where you like most). And the name could be left β€œNew folder (∞)”, but not this time. After reading the Recommendations for the development of add-ons, you can find out that the folder name is composed according to the following pattern:

[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
  [.]. 

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .

[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .

[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .
[.].

( , - ) :

plugin.video.linecinema


. // add-on' ( , -) , :

addon.py
addon.xml
changelog.txt
fanart.jpg
icon.png
LICENSE.txt
/resources
settings.xml
/language/
/lib/
/media/

addon.py – . , ( addon.xml). default.py addon.xml – XBMC: (, , , ); ( *.py); ; , . . changelog.txt , LICENSE.txt – , . fanart.jpg – . . icon.png – "" . . /resources/settings.xml – (, , / ), .. , addon.py. , , . . /resources/language/ - . , , . /resources/lib/ - Python. /resources/media/ - , , . .

: addon.py, addon.xml … . , .

addon.xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <addon id="plugin.video.linecinema" name="LineCinema" version="0.0.1" provider-name="noname"> <requires> <import addon="xbmc.python" version="1.0"/> </requires> <extension point="xbmc.python.pluginsource" provides="video" library="addon.py"> <provides>video</provides> </extension> <extension point="xbmc.addon.metadata"> <summary>LineCinema.org</summary> <description> , . LineCinema.org </description> <platform>all</platform> </extension> </addon>
. XBMC , "plugin.video.linecinema", "LineCinema", 0.0.1, "noname".

/>
, xbmc.python 1.0.

video – "addon.py". " ".

, addon.xml .

addon.py:

# -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param
xbmcplugin xbmcgui – xbmc.python.

get_params() – , , . , , . , . , , .

:

def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)

addDir(title, url, mode) – . Mode – , ( ).

addLink(title, url) – , url . url // ..

:

params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))
" ". xbmcplugin.endOfDirectory(int(sys.argv[1])) XBMC, "" .

. getHTML(url) isLinkUseful(needle) addon.py :
addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass xbmcplugin.endOfDirectory(int(sys.argv[1]))

? , .

: ; ; . . : Categories() – , Movies() – , Videos() – . :

def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20)

addDir(title, url + link, 20) print title + ' [' + url + ']' . Categories() - url . , – link .

20 – , Movies(url) . , xbmcplugin.endOfDirectory(int(sys.argv[1])) , :

if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title)
? ? , . , , , . .

:

def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30)
. title[:-12] ? [:-12], , " / Magnificent movie (2013) HDRip ". ""? !

. . , ! :

<script language="javascript"> flashvars = { uid: "player_uppod", bufferproc2 :1, bufferproc_reloadsec :10, st: "/templates/linecinema-dle90/swf/video30-365.txt", file: "http://st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv" }; params = {bgcolor:"#ffffff", allowFullScreen:"true", allowScriptAccess:"always",wmode:"opaque"}; attributes = { id: "player_uppod", name: "player_uppod" }; swfobject.embedSWF("/templates/linecinema-dle90/swf/uppod.swf", "player_uppod", "570", "440", "10.0.0",false,flashvars,params,attributes); </script>
: st7.linecinema.org/s/820e31e7cbe3e8c362785b733db56c57/film10/Druzea.navek.DVDRip.flv ( ). :

def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link)
. :

addon.py # -*- coding: utf-8 -*- import urllib, urllib2, re, sys import xbmcplugin, xbmcgui def getHTML(url): headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', 'Content-Type':'application/x-www-form-urlencoded'} conn = urllib2.urlopen(urllib2.Request(url, urllib.urlencode({}), headers)) html = conn.read() conn.close() return html def isLinkUseful(needle): haystack = ['/index.php', '/newsz/Televydenye/100432-2008-3-11-432.html', '/newsz/500183-tex-podderzhka.html'] return needle not in haystack def Categories(): url = 'http://www.linecinema.org' html = getHTML(url) genre_links = re.compile('<a href="(.+?)" title="" class="mainmenu">(.+?)</a><br />').findall(html.decode('windows-1251').encode('utf-8')) for link, title in genre_links: if isLinkUseful(link): addDir(title, url + link, 20) def Movies(url): html = getHTML(url) movie_links = re.compile('<h1> <a href="(.+?)">(.+?)</a> </h1>').findall(html.decode('windows-1251').encode('utf-8')) for link, title in movie_links: addDir(title[:-12], link, 30) def Videos(url, title): html = getHTML(url) link = re.compile('file: "(.+?)"').findall(html.decode('windows-1251').encode('utf-8'))[0] addLink(title, link) def get_params(): param=[] paramstring=sys.argv[2] if len(paramstring)>=2: params=sys.argv[2] cleanedparams=params.replace('?','') if (params[len(params)-1]=='/'): params=params[0:len(params)-2] pairsofparams=cleanedparams.split('&') param={} for i in range(len(pairsofparams)): splitparams={} splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] return param def addLink(title, url): item = xbmcgui.ListItem(title, iconImage='DefaultVideo.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=item) def addDir(title, url, mode): sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode)) item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='') item.setInfo( type='Video', infoLabels={'Title': title} ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True) params = get_params() url = None title = None mode = None try: title = urllib.unquote_plus(params['title']) except: pass try: url = urllib.unquote_plus(params['url']) except: pass try: mode = int(params['mode']) except: pass if mode == None: Categories() elif mode == 20: Movies(url) elif mode == 30: Videos(url, title) xbmcplugin.endOfDirectory(int(sys.argv[1]))

-, . : ZIP. . ZIP (!) . XBMC, () > > ZIP . , " ", > > LineCinema .







ZIP : HOW-TO:Write plugins for XBMC (wiki) XBMC Addon Developers Guide (pdf) : 3rd party add-on repositories XBMC Russia XBMC Community Forum

. … . , , .

PS , .

Source: https://habr.com/ru/post/166097/


All Articles