![]() |
2010-03-15
, 09:10
|
Posts: 29 |
Thanked: 1 time |
Joined on Dec 2009
|
#31
|
![]() |
2010-03-15
, 18:22
|
|
Posts: 111 |
Thanked: 74 times |
Joined on Feb 2010
@ Germany
|
#32
|
![]() |
2010-03-15
, 18:34
|
|
Posts: 100 |
Thanked: 240 times |
Joined on Feb 2010
@ The South Pole O.o
|
#33
|
Since I'm using Python and programming in general is not at all versed a few questions about it.
Have so far only rootsh installed. I need something else for this and if so what exactly?
And if I script in X-terminal type will then automatically creates a program that I can later uninstall again without problems? Or you put it to Donwload anzubiten still in the program catalog for later updates?
import sgmllib class MyParser(sgmllib.SGMLParser): def parse(self, s): self.feed(s) self.close() def __init__(self, verbose=0): sgmllib.SGMLParser.__init__(self, verbose) self.hyperlinks = [] self.descriptions = [] self.inside_a_element = 0 self.starting_description = 0 def start_a(self, attributes): for name, value in attributes: if name == "href": self.hyperlinks.append(value) self.inside_a_element = 1 self.starting_description = 1 def end_a(self): self.inside_a_element = 0 def handle_data(self, data): if self.inside_a_element: if self.starting_description: self.descriptions.append(data) self.starting_description = 0 else: self.descriptions[-1] += data def get_hyperlinks(self): return self.hyperlinks def get_descriptions(self): return self.descriptions import urllib, sgmllib events=['UEFA Champions League', 'main.aspx?c=4723', 'UEFA Europa League', 'main.aspx?c=4724', 'FA Cup', 'main.aspx?c=5235', 'Norway Super Cup', 'main.aspx?c=5018', 'Russian League Division 1', 'main.aspx?c=5164', 'Swedish Super Cup', 'main.aspx?c=5412', 'Russia Super Cup', 'main.aspx?c=873', 'European Championship QualifiersDraw results', 'main.aspx?c=5705', 'Latvia 1 Division', 'main.aspx?c=5304', 'Italian Calcio League A', 'main.aspx?c=4616', 'Spanish League Primera Div. 1', 'main.aspx?c=4848', 'English Premier League', 'main.aspx?c=4730', 'German Bundesliga 1st Div.', 'main.aspx?c=4821', 'French League 1st Div.', 'main.aspx?c=4727', 'Portugal SuperLiga', 'main.aspx?c=4852', 'Holland Eredivisie League', 'main.aspx?c=4735', 'Turkey Super Ligi', 'main.aspx?c=4851', 'Scotland Premier League', 'main.aspx?c=4810', 'Russian Premier League', 'main.aspx?c=5015', 'Greek National League A', 'main.aspx?c=4853', 'Croatia 1.NHL League', 'main.aspx?c=4858', 'Czech Gambrinus League', 'main.aspx?c=4814', 'Belgium Exqi League', 'main.aspx?c=4816', 'Romania Divizia A', 'main.aspx?c=4855', 'Italian Calcio League B', 'main.aspx?c=4646', 'Swiss Super League', 'main.aspx?c=4699', 'German Bundesliga 2nd Div.', 'main.aspx?c=4822', 'French League 2nd Div.', 'main.aspx?c=4728', 'English League Div. 1', 'main.aspx?c=4736', 'Baltic League', 'main.aspx?c=5029', 'Austria Bundesliga', 'main.aspx?c=4722', 'Slovenia - 1. Liga', 'main.aspx?c=4783', 'Wales Premier League', 'main.aspx?c=4833', 'Cyprus 1st Div. League', 'main.aspx?c=4856', 'Bosnia & Herzegovina Premier League', 'main.aspx?c=4857', 'German Bundesliga 3rd Div.', 'main.aspx?c=4826', 'Denmark SAS-Ligaen', 'main.aspx?c=4747', 'Hungary NB1 League', 'main.aspx?c=4854', 'Finland Ykkonen League Div. 1', 'main.aspx?c=5163', 'Ukraine Vischaya League', 'main.aspx?c=4813', 'Estonia Meistriliiga', 'main.aspx?c=5740', 'Belgium League 2e Klasse', 'main.aspx?c=4817', 'Bulgaria Premier League', 'main.aspx?c=4887', 'Scotland Division 2', 'main.aspx?c=4831', 'Slovenia - 2. Liga', 'main.aspx?c=4909', 'Serbia 1.SFL', 'main.aspx?c=4815', 'Montenegro First League', 'main.aspx?c=4888', 'Poland I Liga', 'main.aspx?c=4872', 'Ireland Premier League', 'main.aspx?c=5805', 'Ireland 1st Division League', 'main.aspx?c=5806', 'Belarus Premier League', 'main.aspx?c=5741', 'French League National', 'main.aspx?c=4898', 'Italian League C1A', 'main.aspx?c=4941', 'Italian League C1 B', 'main.aspx?c=4942', 'Scotland Division 3', 'main.aspx?c=4832', 'Germany Regional League - North', 'main.aspx?c=4823', 'Germany Regional League - West', 'main.aspx?c=4824', 'Germany Regional League - South', 'main.aspx?c=4825', 'English Football League Trophy', 'main.aspx?c=5273', 'English League Division 4', 'main.aspx?c=4910', 'Spanish League 2nd Div.', 'main.aspx?c=4901', 'English League Div. 2', 'main.aspx?c=4737', 'English League Div. 3', 'main.aspx?c=4738', 'Denmark Division 2 West League', 'main.aspx?c=5176', 'Denmark Division 2 East League', 'main.aspx?c=5177', 'Denmark Division 1 League', 'main.aspx?c=4748', 'Finland Veikkausliiga League', 'main.aspx?c=5698', 'Greek National League B', 'main.aspx?c=5067', 'Swiss Challenge League', 'main.aspx?c=4829', 'Austria Erste Division', 'main.aspx?c=4729', 'Albania Super League', 'main.aspx?c=5030', 'Turkey Super Ligi 2', 'main.aspx?c=4891', 'Scotland Division 1', 'main.aspx?c=4830', 'Slovakia 1. Liga', 'main.aspx?c=4779', 'Iceland Premier League', 'main.aspx?c=5699', 'Italy Serie A - Futsal', 'main.aspx?c=4933', 'Macedonia First League', 'main.aspx?c=4889', 'Holland League 2nd Div.', 'main.aspx?c=4850', 'Norway Tippeligaen', 'main.aspx?c=5688', 'Norway Division 1 League', 'main.aspx?c=5689', 'Portugal 2.Liga', 'main.aspx?c=4902', 'Swedish League Superettan', 'main.aspx?c=5686', 'Swedish League Allsvenskan', 'main.aspx?c=5687', 'Swedish League Division 1 South', 'main.aspx?c=5720', 'Swedish League Division 1 North', 'main.aspx?c=5721', 'FA Womens Cup', 'main.aspx?c=5730', 'German DFB Pokal', 'main.aspx?c=4819', 'French League Cup', 'main.aspx?c=4849', 'Spain Copa del Rey', 'main.aspx?c=4978', 'Italian Cup', 'main.aspx?c=4883', 'FA of Ireland Cup', 'main.aspx?c=4689', 'UEFA European U-21 Qualifiers', 'main.aspx?c=4313', 'UEFA European U-19 Qualifiers', 'main.aspx?c=5162', 'UEFA Women Champions League', 'main.aspx?c=4759', 'French Cup', 'main.aspx?c=5381', 'Scotland - FA Cup', 'main.aspx?c=5316', 'Turkey Cup', 'main.aspx?c=5260', 'Wales FA Cup', 'main.aspx?c=5315', 'Bulgaria Cup', 'main.aspx?c=5425', 'Cyprus Cup', 'main.aspx?c=5429', 'English FA Trophy', 'main.aspx?c=5317', 'Futsal Spanish League', 'main.aspx?c=5148', 'UEFA European U-17 Qualifiers', 'main.aspx?c=5149', 'Czech Cup', 'main.aspx?c=4998', 'KNVB Beker', 'main.aspx?c=5000', 'Romania Cup', 'main.aspx?c=5045', 'Portugal Cup', 'main.aspx?c=5170', 'Portugal League Cup', 'main.aspx?c=4879', 'Futsal Portugish League', 'main.aspx?c=5673', 'Poland Cup', 'main.aspx?c=5002', 'Macedonia Cup', 'main.aspx?c=5261', 'Wales Loosemores Challenge Cup', 'main.aspx?c=5040', 'Ukraine Cup', 'main.aspx?c=4929', 'Serbia and Montenegro Cup', 'main.aspx?c=5175', 'Slovakia Cup', 'main.aspx?c=5046', 'Scottish League Cup', 'main.aspx?c=4880', 'Russian Kubok Cup', 'main.aspx?c=4721', 'Slovenia Cup', 'main.aspx?c=5236', 'Switzerland Cup', 'main.aspx?c=5053', 'Belarus Cup', 'main.aspx?c=4930', 'Womens World Cup European Qualifiers', 'main.aspx?c=2686', 'Setanta Cup Ireland', 'main.aspx?c=5035', 'Belgium Cup', 'main.aspx?c=4956', 'Austrian Cup', 'main.aspx?c=4928', 'UEFA Futsal Cup', 'main.aspx?c=5669', 'Baltic Cup', 'main.aspx?c=5696', 'Finland League Cup', 'main.aspx?c=5658', 'Greece Cup', 'main.aspx?c=5258', 'Hungary League Cup', 'main.aspx?c=4890', 'Hungary Cup', 'main.aspx?c=5237', 'Croatia Cup', 'main.aspx?c=5001', 'Futsal Spanish Cup', 'main.aspx?c=5717', 'Denmark Cup', 'main.aspx?c=4961'] def plugin_core(): global content_strings global content_links global content_links global date_index global team_index global times_index global times_strings global teams_by_date teams_by_date=[] content_strings=myparser.get_descriptions() content_links=myparser.get_hyperlinks() content_links=content_links[2:] date_index=[] team_index=[] times_index=[] times_strings=[] unwanted=["GMT"] for i, it in enumerate(content_strings): for dn in unwanted: if dn in it: content_links.insert(i,"") for i, it in enumerate(content_links): if ("main.aspx?team=" in it): team_index.append(i) if ("?obo=true&obc=" in it): content_strings.insert(i,"") days_strings=["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"] for i, it in enumerate(content_strings): for dn in days_strings: if dn in it: date_index.append(i) i=0 j=0 while i<s.count("<td class=t>"): j=s.find("<td class=t>",j)+1 times_index.append(j+11) i+=1 i=0 while i<len(times_index): times_strings.append((s[times_index[i]:times_index[i]+5]).replace("<","")) i+=1 i=0 j=0 k=0 l="" while i < len(team_index)-1 : if (j<len(date_index)): if team_index[i]>date_index[j] : teams_by_date.append(i) j+=1 i+=2 k+=1 plugin_status=0 plugin_selector=0 ticker_started=0 timer_timeout=50000 import gtk import hildondesktop import hildon class SoccerSuckerDialog(gtk.Dialog): def __init__(self): global content_strings global content_links global content_links global date_index global team_index global times_index global times_strings gtk.Dialog.__init__(self, "Options", None, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) self.table=gtk.Table(3,4,True) self.selector=selector = populate_selector() button1 = gtk.Button("event") button2 = gtk.Button("match") button3 = gtk.Button("date") button1.connect("clicked",self.selected_event) button2.connect("clicked",self.selected_match) button3.connect("clicked",self.selected_date) self.table.attach(self.selector,0,3,0,3) self.table.attach(button1,3,4,0,1) self.table.attach(button3,3,4,1,2) self.table.attach(button2,3,4,2,3) self.set_size_request(800,300) self.vbox.add(self.table) self.show_all() def selected_event(self,*args): global plugin_status self.table.remove(self.selector) plugin_status=2 self.selector=populate_selector() self.table.attach(self.selector,0,3,0,3) self.table.show_all() self.show_all() def selected_match(self,*args): global plugin_status self.table.remove(self.selector) plugin_status=4 self.selector=populate_selector() self.table.attach(self.selector,0,3,0,3) self.table.show_all() self.show_all() def selected_date(self,*args): global plugin_status self.table.remove(self.selector) plugin_status=3 self.selector=populate_selector() self.table.attach(self.selector,0,3,0,3) self.table.show_all() self.show_all() def selection_changed(selector, user_data): global plugin_selector global myparser global current_teams global current_date global current_event current_selection = selector.get_active(0) if plugin_status==2: global s global f plugin_selector=current_selection current_event=current_selection f = urllib.urlopen("http://www.goalzz.com/"+events[plugin_selector*2+1]) s = f.read() myparser = MyParser() myparser.parse(s) plugin_core() if (plugin_status==3): i=0 current_teams=[] current_date=current_selection j=teams_by_date[current_selection] if current_selection==len(date_index)-1: while j < len(team_index)-1: current_teams.append(content_strings[team_index[j]]+" V.S. "+content_strings[team_index[j+1]]) j+=2 else : while j < teams_by_date[current_selection+1]-1: current_teams.append(content_strings[team_index[j]]+" V.S. "+content_strings[team_index[j+1]]) j+=2 if plugin_status==4: plugin_selector=current_selection*2+teams_by_date[current_date] obj.set_button() def populate_selector(): selector = hildon.TouchSelector(text = True) selector.connect("changed", selection_changed) i=0 if plugin_status==1: False elif plugin_status==2: while i < len(events)-1 : selector.append_text(events[i]) i+=2 elif plugin_status==3: while i < len(date_index) : selector.append_text(content_strings[date_index[i]]) i+=1 elif plugin_status==4: while i < len(current_teams) : selector.append_text(current_teams[i]) i+=1 selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_SINGLE) return selector def SoccerSuckerDialog_show(button): dialog = SoccerSuckerDialog() dialog.run() dialog.destroy() class SoccerSuckerPlugin(hildondesktop.HomePluginItem): def __init__(self): hildondesktop.HomePluginItem.__init__(self) self.button = gtk.Button() self.set_button() self.button.connect("clicked", SoccerSuckerDialog_show) self.add(self.button) def ticker(self): self.button.hide_all() print "Refreshed" global s global myparser global f f = urllib.urlopen("http://www.goalzz.com/"+events[current_event*2+1]) s = f.read() myparser = MyParser() myparser.parse(s) plugin_core() self.set_button() if plugin_status > 1: self.maintimer = gobject.timeout_add(timer_timeout, self.ticker) def set_button(self,*args): global plugin_status global ticker_started if plugin_status==0: label=gtk.Label("Options") self.button.add(label) plugin_status=1 else : if ticker_started==0 : self.maintimer = gobject.timeout_add(timer_timeout, self.ticker) ticker_started=1 self.remove(self.button) self.button = gtk.Button() self.button.connect("clicked", SoccerSuckerDialog_show) self.add(self.button) self.button.show_all() table=gtk.Table(1,3,False) label=gtk.Label(times_strings[plugin_selector/2]+" ") label.modify_fg("normal",gtk.gdk.Color(red=0, green=0, blue=0, pixel=0)) table.attach(label,0,1,0,1) label=gtk.Label(content_strings[team_index[plugin_selector]]+" V.S. "+content_strings[team_index[plugin_selector+1]]) table.attach(label,1,2,0,1) label=gtk.Label(" score: "+content_strings[team_index[plugin_selector+1]-1]) label.modify_fg("normal",gtk.gdk.Color(red=30000, green=0, blue=0, pixel=0)) table.attach(label,2,3,0,1) self.button.add(table) self.button.show_all() hd_plugin_type = SoccerSuckerPlugin if __name__ == "__main__": import gobject gobject.type_register(hd_plugin_type) obj = gobject.new(hd_plugin_type, plugin_id="plugin_id") obj.show_all() gtk.main()
![]() |
2010-03-15
, 19:06
|
Posts: 20 |
Thanked: 2 times |
Joined on Feb 2010
@ UK, Birmingham
|
#34
|
![]() |
2010-03-15
, 19:48
|
|
Posts: 100 |
Thanked: 240 times |
Joined on Feb 2010
@ The South Pole O.o
|
#35
|
Brilliant little widget. If it's not asking too much, is it possible to expand this and view more than 1 match?
Also is it possible to get some live commentary feed. Brief commentary from livegoals.com or even better the commentary from goal.com. I know the commentary might be a hassle so the priority would be to view more than 1 match. I mean it already works so why not make it better.
Thanks a lot again mate!
![]() |
2010-03-15
, 20:36
|
|
Posts: 111 |
Thanked: 74 times |
Joined on Feb 2010
@ Germany
|
#36
|
![]() |
2010-03-16
, 12:25
|
Posts: 1 |
Thanked: 0 times |
Joined on Mar 2010
|
#37
|
![]() |
2010-03-17
, 17:28
|
Posts: 115 |
Thanked: 12 times |
Joined on Oct 2009
|
#38
|
![]() |
2010-03-17
, 21:33
|
Posts: 115 |
Thanked: 12 times |
Joined on Oct 2009
|
#39
|
![]() |
2010-03-18
, 00:38
|
|
Posts: 733 |
Thanked: 249 times |
Joined on Jan 2010
@ UK
|
#40
|