Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit ca37bed3429814eeda65feade9d9e0b6291dda7f @furk committed Feb 16, 2011
Showing with 1,007 additions and 0 deletions.
  1. +674 −0 LICENSE.txt
  2. +1 −0 README
  3. +26 −0 addon.xml
  4. +2 −0 changelog.txt
  5. +86 −0 default.py
  6. BIN icon.png
  7. +7 −0 resources/language/English/strings.xml
  8. +1 −0 resources/lib/__init__.py
  9. +91 −0 resources/lib/getter.py
  10. +111 −0 resources/lib/printer.py
  11. +8 −0 resources/settings.xml

Large diffs are not rendered by default.

Oops, something went wrong.
1 README
@@ -0,0 +1 @@
+Furk.net player.
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<addon id="plugin.video.furk" version="1.0.4" name="Furk.net BitTorrent Proxy" provider-name="Furk.net">
+ <requires/>
+ <extension point="xbmc.python.pluginsource"
+ library="default.py">
+ <provides>video</provides>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <summary>
+ Plays video torrents from 'My Files :: Finished'. Check www.furk.net/text/mc for more info.
+ </summary>
+ <description>
+ Furk.net is a free file hosting with one special feature - a BitTorrent proxy.
+ It can act as a regular BitTorrent client and download torrents on your behalf. You provide .torrent files - you get direct http links.
+ For most torrents you get torrents faster then using a desktop BitTorrent client.
+ Furk.net has developed extended content verification. For every video torrent you get 9 screenshots (thumbnails and full-size), 2 audio samples, detailed codec info and antivirus check (by Kaspersky). Fakes are contantly detected by various filters and either are removed or marked with a warning.
+ This plugin allows your to play instantly video torrents.
+ </description>
+ <platform>all</platform>
+ <minversion>29000</minversion>
+ <disclaimer>
+ You must have a premium account at www.furk.net for this addon to function.
+ </disclaimer>
+ </extension>
+</addon>
+
@@ -0,0 +1,2 @@
+[B]1.0.0[/B]
+- Initial version
@@ -0,0 +1,86 @@
+'''
+ Furk.net player for XBMC
+ Copyright (C) 2010 Gpun Yog
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import sys, urllib
+import xbmc, xbmcaddon, xbmcgui
+
+# Plugin constants
+__plugin__ = 'Furk.net'
+__author__ = 'Gpun Yog'
+__url__ = 'http://www.furk.net/t/xbmc'
+__version__ = '1.0.4'
+__settings__ = xbmcaddon.Addon(id='plugin.video.furk')
+
+print "[PLUGIN] '%s: version %s' initialized!" % (__plugin__, __version__)
+
+def parse_qs(u):
+ params = '?' in u and dict(p.split('=') for p in u[u.index('?') + 1:].split('&')) or {}
+
+ return params;
+
+if __name__ == "__main__":
+ from resources.lib import getter, printer
+
+
+ xbmc.log('params_str=%s' % sys.argv[2])
+ params = parse_qs(sys.argv[2])
+ if not params:
+ params['action'] = 'dirs'
+ xbmc.log('_params=%s' % params)
+
+ if __settings__.getSetting('login') == '' or __settings__.getSetting('password') == '':
+ resp = xbmcgui.Dialog().yesno("No username/password set!","Furk.net requires you to be logged in to view", \
+ "videos. Would you like to log-in now?")
+ if resp:
+ __settings__.openSettings()
+
+ elif(params['action'] == 'files'):
+ # Enter a directory | open torrent and list files
+ files = getter.getFiles(params['did'])
+ printer.printFiles(files)
+
+ elif(params['action'] == 'play'):
+ # Play a file
+ printer.playFile(params['url'])
+
+ elif(params['action'] == 'recent_queries'):
+ # Show previous searches
+ printer.printRecentQueries()
+
+ elif(params['action'] == 'search_test'):
+ # Search
+ dirs = getter.searchDirs('xxx')
+ printer.printDirs(dirs)
+
+ elif(params['action'] == 'search'):
+ # Search
+ keyboard = xbmc.Keyboard(urllib.unquote(params['query']), 'Search')
+ keyboard.doModal()
+
+ if keyboard.isConfirmed():
+ query = keyboard.getText()
+ dirs = getter.searchDirs(query)
+ printer.printDirs(dirs)
+
+ else:
+ # torrents a root Directories
+ xbmc.log('argv=%s' % sys.argv)
+ dirs = getter.getDirs()
+ printer.printDirs(dirs)
+
+sys.modules.clear()
BIN icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<strings>
+ <string id="20001">Login</string>
+ <string id="20002">Password</string>
+ <string id="20003">Recent search queries</string>
+</strings>
+
@@ -0,0 +1 @@
+# Dummy file to make this directory a package.
@@ -0,0 +1,91 @@
+'''
+ Furk.net player for XBMC
+ Copyright (C) 2010 Gpun Yog
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import sys, os, time, urllib, urllib2, codecs, xml.dom.minidom
+import md5
+import xbmc, xbmcplugin, xbmcgui
+
+__settings__ = sys.modules[ "__main__" ].__settings__
+
+__mc_url = 'https://www.furk.net/mc/'
+
+def searchDirs(query):
+ recent = __settings__.getSetting('recent_queries').split('|')
+ recent = [ urllib.unquote(r) for r in recent ]
+ if query in recent:
+ recent.remove(query)
+ recent.insert(0, query)
+ recent = [ urllib.quote(r) for r in recent ]
+ __settings__.setSetting(id='recent_queries', value='|'.join(recent))
+
+ xbmc.log('recent=%s' % recent)
+
+ list_xml = fetch('search', { 'q': urllib.quote(query), 'filter': 'instant', 'sort': 'relevance' })
+ dirs = list_xml.getElementsByTagName('dir')
+
+ return(dirs)
+
+def getDirs():
+ list_xml = fetch('dirs', {})
+ dirs = list_xml.getElementsByTagName('dir')
+
+ return(dirs)
+
+def getFiles(did):
+ list_xml = fetch('files', { 'did': did })
+ files = list_xml.getElementsByTagName('file')
+
+ return(files)
+
+
+
+def fetch(action, params):
+ params['login'] = urllib.quote(__settings__.getSetting("login"))
+ params['password'] = md5.new(__settings__.getSetting("password")).hexdigest()
+
+ query_string = '&'.join([k+'='+v for (k,v) in params.items()])
+ url = __mc_url + action + '?' + query_string
+
+ xbmc.log('params=%s; url=%s' % (params, url))
+
+ req = urllib2.Request(url)
+ req.add_header('User-Agent', "%s %s" % (sys.modules[ "__main__" ].__plugin__, sys.modules[ "__main__" ].__version__))
+
+ try:
+ response = urllib2.urlopen(req)
+ except urllib2.HTTPError, e:
+ xbmcgui.Dialog().ok('Error', 'Error: %s' % e.read())
+ raise
+ except urllib2.URLError, e:
+ xbmcgui.Dialog().ok('Error', 'Error: %s' % e.reason)
+ raise
+
+ page = response.read()
+ response.close()
+ #xbmc.log('page=%s' % page)
+
+ resp_xml = xml.dom.minidom.parseString(page)
+
+ msg = resp_xml.getElementsByTagName("message").item(0)
+ if msg:
+ xbmc.log('msg=%s' % msg.firstChild.data)
+ xbmcgui.Dialog().ok("Message from server", "%s" % msg.firstChild.data)
+
+ return resp_xml;
+
+
@@ -0,0 +1,111 @@
+'''
+ Furk.net player for XBMC
+ Copyright (C) 2010 Gpun Yog
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import sys, re, time
+import xbmc, xbmcgui, xbmcplugin
+import urllib
+
+__settings__ = sys.modules[ "__main__" ].__settings__
+
+def printRecentQueries():
+ # search
+
+ recent = __settings__.getSetting('recent_queries').split('|')
+ if '' in recent:
+ recent.remove('')
+ total = len(recent) + 1
+
+ name = '@Search...'
+ url = sys.argv[0] + '?action=search&query='
+ listitem = xbmcgui.ListItem()
+ listitem.setLabel(name)
+ xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True, totalItems=total)
+
+ for r in recent:
+ url = sys.argv[0] + '?action=search&query=' + r
+
+ r = urllib.unquote(r)
+ listitem = xbmcgui.ListItem()
+ listitem.setLabel(r)
+ xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True, totalItems=total)
+
+
+ xbmcplugin.endOfDirectory(int(sys.argv[1]))
+
+
+def printDirs(dirs):
+ xbmcplugin.setContent(int(sys.argv[1]), 'videos')
+ xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
+ xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
+
+ total = len(dirs)
+
+ # search
+ total = total + 1
+ name = '@Search'
+ date = '1970-01-01'
+ url = sys.argv[0] + '?action=recent_queries&query='
+ listitem = xbmcgui.ListItem()
+ listitem.setLabel(name)
+ listitem.setLabel2(date)
+ listitem.setThumbnailImage('http://www.furk.net/img/logo.png')
+ listitem.setInfo('video', {'date': date, 'title': name})
+ xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True, totalItems=total)
+
+
+ for d in dirs:
+ id = d.getElementsByTagName('id').item(0).firstChild.data
+ name = d.getElementsByTagName('name').item(0).firstChild.data
+ date = d.getElementsByTagName('date').item(0).firstChild.data
+ thumb = d.getElementsByTagName('thumb').item(0).firstChild.data
+
+ url = sys.argv[0] + '?action=files&did=' + id
+
+ listitem = xbmcgui.ListItem()
+ listitem.setLabel(name)
+ listitem.setLabel2(date)
+ listitem.setThumbnailImage(thumb)
+ listitem.setInfo('video', {'date': date, 'title': name})
+ xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=True, totalItems=total)
+
+ xbmcplugin.endOfDirectory(int(sys.argv[1]))
+
+def printFiles(files):
+ xbmcplugin.setContent(int(sys.argv[1]), 'videos')
+ xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
+
+ total = len(files)
+ for f in files:
+ id = f.getElementsByTagName('id').item(0).firstChild.data
+ name = f.getElementsByTagName('name').item(0).firstChild.data
+ play_url = f.getElementsByTagName('url').item(0).firstChild.data
+
+ url = sys.argv[0] + '?action=play&url=' + urllib.quote(play_url)
+
+ listitem = xbmcgui.ListItem()
+ listitem.setLabel(name)
+ listitem.setInfo('video', {'title': name})
+ xbmcplugin.addDirectoryItem(int(sys.argv[1]), url, listitem, isFolder=False, totalItems=total)
+ #xbmc.log('f=%s' % name)
+
+ xbmcplugin.endOfDirectory(int(sys.argv[1]))
+
+
+
+def playFile(play_url):
+ xbmc.Player().play(urllib.unquote(play_url))
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<settings>
+ <setting id="login" type="text" label="20001" default=""/>
+ <setting id="password" type="text" label="20002" default="" option="hidden"/>
+ <setting type="sep" />
+ <setting id="recent_queries" type="text" label="20003" default=""/>
+</settings>
+

0 comments on commit ca37bed

Please sign in to comment.