Added really shoddy, probably broken git plugin
This commit is contained in:
parent
d32619063a
commit
8b1de13c8e
|
@ -45,7 +45,6 @@ def steamcalc(inp, reply=None):
|
||||||
else:
|
else:
|
||||||
name = inp.strip()
|
name = inp.strip()
|
||||||
|
|
||||||
|
|
||||||
if force_reload:
|
if force_reload:
|
||||||
try:
|
try:
|
||||||
reply("Collecting data, this may take a while.")
|
reply("Collecting data, this may take a while.")
|
||||||
|
|
|
@ -1,28 +1,10 @@
|
||||||
"""
|
|
||||||
TV information, written by Lurchington 2010
|
|
||||||
modified by rmmh 2010
|
|
||||||
"""
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from urllib2 import URLError
|
|
||||||
from zipfile import ZipFile
|
|
||||||
from cStringIO import StringIO
|
|
||||||
|
|
||||||
from lxml import etree
|
|
||||||
|
|
||||||
from util import hook, http
|
from util import hook, http
|
||||||
|
|
||||||
|
|
||||||
base_url = "http://thetvdb.com/api/"
|
base_url = "http://thetvdb.com/api/"
|
||||||
|
api_key = "469B73127CA0C411"
|
||||||
|
|
||||||
def get_zipped_xml(*args, **kwargs):
|
|
||||||
try:
|
|
||||||
path = kwargs.pop("path")
|
|
||||||
except KeyError:
|
|
||||||
raise KeyError("must specify a path for the zipped file to be read")
|
|
||||||
zip_buffer = StringIO(http.get(*args, **kwargs))
|
|
||||||
return etree.parse(ZipFile(zip_buffer, "r").open(path))
|
|
||||||
|
|
||||||
|
|
||||||
def get_episodes_for_series(series_name, api_key):
|
def get_episodes_for_series(series_name, api_key):
|
||||||
|
@ -30,7 +12,7 @@ def get_episodes_for_series(series_name, api_key):
|
||||||
# http://thetvdb.com/wiki/index.php/API:GetSeries
|
# http://thetvdb.com/wiki/index.php/API:GetSeries
|
||||||
try:
|
try:
|
||||||
query = http.get_xml(base_url + 'GetSeries.php', seriesname=series_name)
|
query = http.get_xml(base_url + 'GetSeries.php', seriesname=series_name)
|
||||||
except URLError:
|
except http.URLError:
|
||||||
res["error"] = "error contacting thetvdb.com"
|
res["error"] = "error contacting thetvdb.com"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -43,9 +25,8 @@ def get_episodes_for_series(series_name, api_key):
|
||||||
series_id = series_id[0]
|
series_id = series_id[0]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
series = get_zipped_xml(base_url + '%s/series/%s/all/en.zip' %
|
series = http.get_xml(base_url + '%s/series/%s/all/en.xml' % (api_key, series_id))
|
||||||
(api_key, series_id), path="en.xml")
|
except http.URLError:
|
||||||
except URLError:
|
|
||||||
res["error"] = "Error contacting thetvdb.com."
|
res["error"] = "Error contacting thetvdb.com."
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
from git import Repo
|
||||||
|
|
||||||
|
|
||||||
|
from util import hook, web
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def update(inp, bot=None):
|
||||||
|
repo = Repo()
|
||||||
|
git = repo.git
|
||||||
|
pull = git.pull()
|
||||||
|
if "\n" in pull:
|
||||||
|
return web.haste(pull)
|
||||||
|
else:
|
||||||
|
return pull
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def version(inp, bot=None):
|
||||||
|
repo = Repo()
|
||||||
|
|
||||||
|
# get origin and fetch it
|
||||||
|
origin = repo.remotes.origin
|
||||||
|
info = origin.fetch()
|
||||||
|
|
||||||
|
# get objects
|
||||||
|
head = repo.head
|
||||||
|
origin_head = info[0]
|
||||||
|
current_commit = head.commit
|
||||||
|
remote_commit = origin_head.commit
|
||||||
|
|
||||||
|
if current_commit == remote_commit:
|
||||||
|
in_sync = True
|
||||||
|
else:
|
||||||
|
in_sync = False
|
||||||
|
|
||||||
|
# output
|
||||||
|
return "Local {} is at commit {}, remote {} is at commit {}." \
|
||||||
|
" You {} running the latest version.".format(head, current_commit.name_rev[:7],
|
||||||
|
origin_head, remote_commit.name_rev[:7],
|
||||||
|
"are" if in_sync else "are not")
|
|
@ -1,3 +1,4 @@
|
||||||
|
GitPython==0.3.2.RC1
|
||||||
oauth2
|
oauth2
|
||||||
pygeoip
|
pygeoip
|
||||||
tweepy
|
tweepy
|
||||||
|
|
Reference in New Issue