Skip to content
Extraits de code Groupes Projets
Valider 97b2ae6e rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

support sueurdemetal.com

parent 9ebddf0f
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -10,6 +10,7 @@ use Sam::commands::add;
use Sam::commands::edit;
use Sam::sites::residentadvisor;
use Sam::sites::sueurdemetal;
my $nick;
my $irc;
......@@ -33,6 +34,9 @@ sub exec {
if ($msg =~ /^Sam(?:,|:) +https?:\/\/(?:www.residentadvisor.net\/event.aspx\?)([0-9]+)/) {
eval { %content = Sam::sites::residentadvisor::get($1) };
}
elsif ($msg =~ /^Sam(?:,|;) +https?:\/\/(?:www.sueurdemetal.com\/detail-concert-metal.php\?c=)([0-9]+)/) {
eval { %content = Sam::sites::sueurdemetal::get($1) };
}
else {
return 0;
}
......
package Sam::sites::sueurdemetal;
use Inline Python => 'DATA';
sub get {
my $id = shift;
my $content = weboob_get($id);
return %{$content};
}
1;
__DATA__
__Python__
from weboob.core import Weboob
from weboob.capabilities.calendar import CapCalendarEvent
def weboob_get(id):
w = Weboob()
backends = w.load_backends(CapCalendarEvent)
event = backends['sueurdemetal'].get_event(id)
result = {'title': event.summary,
'day': event.start_date.strftime('%d'),
'month': event.start_date.strftime('%m'),
'year': event.start_date.strftime('%Y'),
'place': event.location,
'url': event.url}
if event.price:
result['desc'] = '%i euros' % event.price
return result
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter