Cleaning the meteofrance backend source code
Signed-off-by: Cedric <cedric@aiur.fr>
This commit is contained in:
parent
14ac02bac5
commit
9873506dc9
3 changed files with 4 additions and 31 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010 Julien Veyssier
|
# Copyright(C) 2010 Cedric Defortis
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -26,10 +26,10 @@ __all__ = ['MeteofranceBackend']
|
||||||
|
|
||||||
class MeteofranceBackend(BaseBackend, ICapWeather):
|
class MeteofranceBackend(BaseBackend, ICapWeather):
|
||||||
NAME = 'meteofrance'
|
NAME = 'meteofrance'
|
||||||
MAINTAINER = 'Cedric D.'
|
MAINTAINER = 'Cedric Defortis'
|
||||||
EMAIL = 'cedric@aiur.fr'
|
EMAIL = 'cedric@aiur.fr'
|
||||||
VERSION = '0.1'
|
VERSION = '0.1'
|
||||||
DESCRIPTION = 'MeteoFrance'
|
DESCRIPTION = 'Get forecasts from the MeteoFrance website'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
#CONFIG = ValuesDict(Value('domain', label='Domain (example "ssl.what.cd")'),
|
#CONFIG = ValuesDict(Value('domain', label='Domain (example "ssl.what.cd")'),
|
||||||
# Value('protocol', label='Protocol to use', choices=('http', 'https')),
|
# Value('protocol', label='Protocol to use', choices=('http', 'https')),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010 Julien Veyssier
|
# Copyright(C) 2010 Cedric Defortis
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -78,30 +78,3 @@ class CityPage(BasePage):
|
||||||
city_id = children.attrib.get("href").split("/")[-1]
|
city_id = children.attrib.get("href").split("/")[-1]
|
||||||
mcity = City( city_id, city_name)
|
mcity = City( city_id, city_name)
|
||||||
yield mcity
|
yield mcity
|
||||||
|
|
||||||
def plop(self):
|
|
||||||
for div in self.document.getiterator('div'):
|
|
||||||
if div.attrib.get('id','') == 'column1':
|
|
||||||
title = div.text.strip()
|
|
||||||
elif div.attrib.get('class','') == 'download':
|
|
||||||
url = div.getchildren()[0].attrib.get('href','')
|
|
||||||
elif div.attrib.get('id','') == 'details':
|
|
||||||
size = float(div.getchildren()[0].getchildren()[5].text.split('(')[1].split('Bytes')[0])
|
|
||||||
if len(div.getchildren()) > 1 \
|
|
||||||
and div.getchildren()[1].attrib.get('class','') == 'col2' :
|
|
||||||
seed = div.getchildren()[1].getchildren()[7].text
|
|
||||||
leech = div.getchildren()[1].getchildren()[9].text
|
|
||||||
else:
|
|
||||||
seed = div.getchildren()[0].getchildren()[24].text
|
|
||||||
leech = div.getchildren()[0].getchildren()[26].text
|
|
||||||
elif div.attrib.get('class','') == 'nfo':
|
|
||||||
description = div.getchildren()[0].text
|
|
||||||
torrent = Torrent(id, title)
|
|
||||||
torrent.url = url
|
|
||||||
torrent.size = size
|
|
||||||
torrent.seeders = int(seed)
|
|
||||||
torrent.leechers = int(leech)
|
|
||||||
torrent.description = description
|
|
||||||
torrent.files = ['NYI']
|
|
||||||
|
|
||||||
return torrent
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue