
Airdate
Source (link to git-repo or to original if based on someone elses unmodified work):
Description:
A plasmoid, which is written in python, that displays when TV shows air the next time and when they aired previously.
You need the following packages to run it:
python-beautifulsoup
python-kde4
python-qt4
Install the plasmoid by calling
plasmapkg -i airdate.zip
in the folder where you placed airdate.zip
(update the plasmoid to a newer version with plasmapkg -u airdate.zip)
You can also change the source code and whatever you like by unpacking it...
Once you installed the plasmoid you can simply add it to our desktop.
Add a ty series by pressing the edit button (button on the very right), typing the showname into the editbox and finally pressing the "+" button. Last changelog:
You need the following packages to run it:
python-beautifulsoup
python-kde4
python-qt4
Install the plasmoid by calling
plasmapkg -i airdate.zip
in the folder where you placed airdate.zip
(update the plasmoid to a newer version with plasmapkg -u airdate.zip)
You can also change the source code and whatever you like by unpacking it...
Once you installed the plasmoid you can simply add it to our desktop.
Add a ty series by pressing the edit button (button on the very right), typing the showname into the editbox and finally pressing the "+" button.
Oct/05/2011:
* fixed a bug that occured if the locale settings wasn't en_US (thanks to SWaN for the import locale solution)
* added the requested weekday
* changed all the stuff that anthon38 suggested, thanks!
* noticed a small bug, when adding a series that is already in the list
Oct/10/2011:
* bug fixes
* new feature: day offset
Ratings & Comments
21 Comments
Hi, Thank you for your plasmoid, it's very useful. I have some comments about it though, I hope you don't mind ;) -I think you included the wrong main.py in the package, as it doesn't contains the import locale fix. -You should put your plasmoid in the category "plasmoid script" instead of "plasmoid binary", so that it can be downloaded directly with KGHNS, instead of having to be installed manually. -To fix the visual glitch mentioned in the comments, you can use setFlag(QGraphicsItem.ItemClipsChildrenToShape) on the scrollwidget. -Instead of shipping your own icons with the plasmoid, you can use those shipped with KDE, since the plasmoid requires Plasma to run anyway, right? ;) So instead of this: icon23 = QIcon() icon23.addPixmap(QPixmap(self.applet.package().filePath("ui","add.png")), QIcon.Normal, QIcon.Off) self.addButton.setIcon(icon23) You can do this: self.addButton.setIcon(KIcon("list-add")) -Using the "list-remove" icon would be more consistent than the "edit-delete" icon. -Same goes for "view-refresh" instead of "edit-redo". I think that's all, thanks again!
thank you very much for your comment. I changed the stuff and uploaded the new version.
btw, you may have noticed that this is my first plasmoid and I am not very familiar with qt either, so I am really happy for all comments and suggestions I can get. thanks again
Thank you both! Anyway I suggested to fix the plasmoid without changing locale because in this way the user will see the date in his language.
I see your point and changed that part.
I don't know if it's a KDE issue or not, but when the list is too long and a scrollbar appears, if you put a plasmoid below airdate-plasmoid you'll see the rest of the list over this one. I couldn't reproduce the same behavior with other plasmoids, like opendesktop_activities.
I can't reproduce your issue, sorry. I'm running KDE 4.7.1.
I also noticed that this occurs sometime, but I do not know how to fix this issue as it does not appear if I simply use plasmoidviewer. I believe that this either a bug in plasma or a driver issue. what kind of graphicscard do you use? I'm using a ati 4850 with the r600 open source driver
I get this error instead: Quote:File "/home/xxx/.kde4/share/apps/plasma/plasmoids/airdate-plasmoid/contents/code/main.py", line 272, in fetchedInfo
self.ntime = time.strptime(datestring,"%b %d %Y")
File "/usr/lib/python2.7/_strptime.py", line 454, in _strptime_time
return _strptime(data_string, format)[0]
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data 'Sep 29 2011' does not match format '%b %d %Y'
My system's locale is it_IT, can this affect the parsing of the date?
Nice and useful app, btw ;)
I guess that the output of the website that I am parsing depends on your local settings. I'll patch this as soon as possible, thanks for your comment! (could take a week as I am not at home right now)
no, you were right, it is because %b uses your locale's month name... I'll fix it soon
Same problem here. However 'time.strptime("Sep 10 2011","%b %d %Y")' in the python console gives no errors. I'm using KDE 4.6.5, locales it_IT
Same problem here. However 'time.strptime("Sep 10 2011","%b %d %Y")' in the python console gives no errors. I'm using KDE 4.6.5, locales it_IT
Sorry for the (double) useless post. When I wrote it there was no answer, even if it was sent an hour earlier. Thanks anyway.
Python failing parsing the %b was my first thought indeed, but you're right. I tried your code as well, and works in python console both with version 2.7.2 and 3.2.2. locale.getdefaultlocale() gives ('it_IT', 'UTF-8'). KDE version is 4.7.1.
Yes, locale is the problem. I don't know why in python console works. I tried to fix it: http://pastebin.com/0kT2BL7F See lines: 264, 270 and 279 (I noticed that what is called day actually is the month)
It works this way, thank you. So, maybe the problem resides in Qt or KDE Python bindings. Just guessing...
A somewhat cleaner and portable solution: import locale locale.setlocale(6, 'en_US')
BTW, it would be great if you could add the week day to the date string. It would help keeping a weekly "plan"!
BeautifulSoup's parsing is somewhat slow. I'd suggest you try lxml as an alternative (html module) which is likely faster.
didn't know that, thanks for the suggestion