I set up a stock market ticker and am wondering what I should set the refresh rate to as I don't want Google to block me.
#!/usr/bin/env python
import feedparser, urllib2
from xml.etree import ElementTree as ET
# =========== CONFIG =============
# Insert your account id here. You can find it at
# the bottom of your account settings page on thetvdb.com
ACCOUNTID = 'C2920FF6804FD948'
# ================================
new_shows = feedparser.parse('http://thetvdb.com/rss/newtoday.php')
favorites_feed = urllib2.urlopen('http://thetvdb.com/api/User_Favorites.php?accountid='+ACCOUNTID)
favorites = ET.XML(favorites_feed.read())
shows_list = []
for new_show in new_shows.entries:
new_show_series = new_show.links[0].href
new_show_series_id = new_show_series[new_show_series.find("seriesid=")+9:new_show_series.find("&seasonid")]
for favorite in favorites:
if(favorite.text == new_show_series_id):
shows_list.append(new_show.title)
print "New episodes of favorite shows airing today:"
if (len(shows_list)>0):
for shows in shows_list:
print "* "+shows
else:
print "* No new shows today"
Can someone pleas tell me how i can rotate Shells.. Do u need to script it, or is there some way i just can select how much i wanna rotate the shell?
Thanks to anyone who can help metrying to get my desktop finished, but just need the rotation..
Don't think you can rotate the shells. What I do for my month (it's rotated) is create an image with the text of each month and then have a Python script control copying the correct month file to a temporary image file that Nerdtool/Geektool can display.
I set up a stock market ticker and am wondering what I should set the refresh rate to as I don't want Google to block me.
Hi all...
I've been trying to put a RSS feed of my Dropbox folder in geektool, but I have something weird happening... here's [
#!/usr/bin/env python
""" DROPBOX_FEED_GRABBER
ROBERT WOLTERMAN (xtacocorex) - 2010
PULLS THE CURRENT FEED FROM YOUR DROPBOX ACCOUNT
"""
# DROPBOX FEED - VERSION 1
# ROBERT WOLTERMAN - 2011
# PULLS THE CURRENT FEED FROM YOUR DROPBOX ACCOUNT
# CHANGELOG
# 08 SEPTEMBER 2011:
# - INITIAL WRITE
# MODULE IMPORTS
import xml.dom.minidom
import re
import urllib
# DEFINE URL HERE
FEEDURL = ""
# CLASS TO HOLD THE DATA FOR A TO DO GROUP
class dboxItem():
def __init__(self):
self.title = ""
self.link = ""
self.desc = ""
self.pubdate = ""
# GET THE FEED - UPDATE TO CMD LINE ARGUMENT
dom = xml.dom.minidom.parse(urllib.urlopen(FEEDURL))
# LIST TO HOLD ALL THE TASKS (toDo CLASS)
dboxFeedItems = []
# THE FOLLOWING TWO FUNCTIONS ARE FROM:
# http://love-python.blogspot.com/2008/07/strip-html-tags-using-python.html
# THEY WORK PERFECTLY
def remove_html_tags(data):
p = re.compile(r'<.*?>')
return p.sub('', data)
def remove_extra_spaces(data):
p = re.compile(r'\s+')
return p.sub(' ', data)
# INLINE FUNCTIONS - DON'T FEEL LIKE CLASSING THIS UP
def getText(nodelist):
rc = []
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
rc.append(node.data)
return ''.join(rc)
def handleFeed(feed,dboxFeedItems):
items = feed.getElementsByTagName("item")
handleNewsItem(items,dboxFeedItems)
def handleNewsItem(items,dboxFeedItems):
for item in items:
# CREATE TEMPORARY TODO
tmpCls = dboxItem()
# GET THE DATA FROM THE CURRENT ITEM
title = item.getElementsByTagName("title")[0]
link = item.getElementsByTagName("link")[0]
pubdate = item.getElementsByTagName("pubDate")[0]
# DESCRIPTION USES CDATA INSIDE TO CONTAIN HTML ELEMENTS
desc = item.getElementsByTagName("description")[0].firstChild.wholeText
# GET THE VALUES FROM THE TAGS
tmpCls.title = getText(title.childNodes).strip()
tmpCls.link = getText(link.childNodes).strip()
tmpCls.pubdate = getText(pubdate.childNodes).strip()
# DESCRIPTION IS DIFFERENT BECAUSE OF THE CDATA USE
tmpCls.desc = remove_extra_spaces(remove_html_tags(desc))
# APPEND TEMP DROPBOX NEWS CLASS TO DROP BOX NEWS LIST
dboxFeedItems.append(tmpCls)
# HANDLE THE XML
handleFeed(dom,dboxFeedItems)
# PRINT OUT THE DROPBOX NEWS
# THIS IS CUSTOMIZABLE
for i in range(len(dboxFeedItems)):
# PRINT OUT THE DATA HOWEVER YOU WANT
# DATA STORED IN EACH dboxFeedItems SEGMENT
# dboxFeedItems[i].title = TITLE OF THE NEWS ITEM
# dboxFeedItems[i].desc = DESCRIPTION OF THE NEWS ITEM
# dboxFeedItems[i].link = NEWS ITEM LINK
# dboxFeedItems[i].pubdate = DATE THE NEWS ITEM WAS PUBLISHED
print dboxFeedItems[i].desc
I have mine update every hour since I don't really care about the minute to minute details of the stock market, but then again, I'm never home during the day, so it only updates when I get my MacBook out of sleep mode.
ok...i've just downloaded geektool and i've tried typing some simple code like this:
date +%A
and geektool just keep showing me nothing but the failure image...
i've tried to google for some answer, but after 2 hours i gave up. it was completely useless! Please help me!!!! i'm going a little crazy....
i'm running geektool v3.0 on a mac osx 10.6.
ps: since english is not my mother language, also any grammatical help will be fully appreciated!!!thanks a lot!!!
#!/bin/sh
#
# These variables have been commented out because you need to get the correct zip code of where you live for this to work if you are in the states
# otherwise you will have to get the correct yahoo weather xml link with corresponding Fahrenheit and Celsius parts of the URL.
# Once you have those URLS correctly placed inside this script, you must then uncomment the script by removing the hash symbols (#) from infront
# of the three lines below. Then your script should work properly.
forecast=`curl --silent "http://xml.weather.yahoo.com/forecastrss?p=USNJ0165&u=f" | grep -E '(High:)' | sed -e 's/<BR \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<br \/>//'`
myweather=`curl --silent "http://xml.weather.yahoo.com/forecastrss?p=USNJ0165&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/
<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//'
-e 's/<\/description>//'`
#myweatherc=`curl --silent "http://xml.weather.yahoo.com/forecastrss?p=USNJ0165&u=f" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' | sed -e '/^$/d' | cut -d "," -f 2`
echo "$forecast"
$myweather -$myweatherc"
Do you have the encoding for the shell properly? Are you using a shell geeklet? What is the refresh rate? If the refresh rate is too large, it won't automatically populate the geeklet with text.
I believe a refresh rate of 0 means never. Try 1 second to get it to update the first time then set it to something more reasonable.
Marry me?Got a script for you that works for me, all you have to do is put your feed url in between the quotes in the FEEDURL variable in the script.
Can any1 post here wallpaper from post #3152?
Maybe the classic mistake of black text on a black background. Been there done that, oops.i've tried changing from 0 to 1...but never happened...other ideas???
curl --silent -o /tmp/weather.html http://weather.yahoo.com/united-states/oregon/portland-23424682/;
curl --silent -o /tmp/weather.png $(grep "div\ class=\"forecast-icon\"\ style=\"background:url" /tmp/weather.html| awk -F"'" '{ printf $2 }');for NUM in $(grep -n "<li><strong>.*\n" /tmp/weather.html|cut -d":" -f1); do TARGET=$((NUM+1)) ; sed -n "$NUM"p /tmp/weather.html|sed 's|<li><strong>||g'|sed 's|</strong>||g'| sed 's/^[\t]*//'; sed -n "$TARGET"p /tmp/weather.html ;
The following Geeklet produces funky html characters among the proper info. Can someone please fix it and remove the problem? Thanks. Original code by Ryan Knapper.
It's a small world... long time no chat, fellow hackintosher![]()
@ flo90p
Maybe the classic mistake of black text on a black background. Been there done that, oops.![]()
Do you have the encoding for the shell properly? Are you using a shell geeklet? What is the refresh rate? If the refresh rate is too large, it won't automatically populate the geeklet with text.
i've tried the simple command :
echo "ciao" and it works...i tried again with date +%A and it came back to the annoying red failure image.
i read quite every post or tutorial on the subject. no one was even a little bit helpful! maybe i don't really have the right encoding for shell command, but i don't know how to check...
Marry me?
Works perfect. Only one little modification, if you have time and you actually can, would be to be able to change the number of lines...
Thank you!