Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding support to exclude specific calendars that are specified in an…

… excludes file
  • Loading branch information...
commit e5fd43b98b06a935b2eb4f8823a644fe4a08fad7 1 parent b482978
Jesse Griffin authored
Showing with 19 additions and 1 deletion.
  1. +3 −0  README
  2. +2 −0  excludes-example
  3. +14 −1 gnome-shell-google-calendar.py
View
3  README
@@ -29,6 +29,9 @@
Once logged in, events from all your calendars should appear in
GNOME Shell's calendar.
+
+ To exclude calendars, create a file named "excludes" and put one calendar
+ title per line.
~ Future
View
2  excludes-example
@@ -0,0 +1,2 @@
+Title of Excluded Calendar 1
+Title of Excluded Calendar 2
View
15 gnome-shell-google-calendar.py
@@ -13,6 +13,7 @@
import iso8601
import keyring
import calendar
+import os
# change to "True" to get debugging messages
@@ -57,7 +58,6 @@ def get_month_key(date, first_day_of_week=7):
return ( int(mktime(start_date.timetuple())),
int(mktime(end_date.timetuple())) )
-
class MonthEvents(object):
"""
Caches events of month
@@ -225,9 +225,20 @@ def scheduler(self, timeout):
else:
print 'No need for update'
+ def get_excludes(self, filename):
+ '''Gets a list of calendars to exclude'''
+ excludes = []
+ if os.access(filename, os.F_OK):
+ for line in open(filename, 'r'):
+ excludes.append(line.strip())
+ return excludes
+
def get_calendars(self):
feed = self.client.GetAllCalendarsFeed()
+ # Load excluded calendars from excludes file
+ excludes = self.get_excludes('%s/excludes' % os.getcwd())
+
calendars = []
urls = set()
@@ -237,6 +248,8 @@ def get_calendars(self):
title = calendar.title.text
url = calendar.content.src
+ if title in excludes: continue
+
if not url in urls:
print ' ', title
if debug: print ' ', url
Please sign in to comment.
Something went wrong with that request. Please try again.