#!/usr/bin/env python # ponxxl - benutzt das aktuelle Datum, um den richtigen Provider (XXL oder normal) # ueber PPP anzuwaehlen. Sonntage sowie bundeseinheitliche Feiertage werden # beruecksichtigt. # # [ choose a provider based on the current date and bring up # the ppp link. Useful in Germany where certain providers # offer free service on Sundays and holidays, if you have the # XXL telephone plan. ] # # # Usage: ponxxl [ provider-name [ options ] ] # # This script can be used in place of "pon". If a provider name is # specified explicitly, that provider is used. Any additional # options are passed to PPP. # If the program is invoked with no arguments, the xxl provider # (see setting below) will be used if the current date is a Sunday or a # national holiday (bundeseinheitlicher Feiertag), otherwise the normal # provider (see setting below) will be used. # Provider names (to be passed to ppp). Change these two lines to # correspond to providers which you have configured for ppp. # This script was written by jason@peaceworks.ca and can be downloaded # from http://www.opensky.ca/~jdhildeb/scripts # It comes with no warranties whatsoever. # This script has been placed in the Public Domain. # Version 0.9 (May 18, 2002) - Initial version. xxl_provider = 'ngixxl' normal_provider = 'ngi' ###################################################### import sys import os import time # bundeseinheitlich Feiertage with fixed dates fixedft = [ '01.01', # neujahr '01.05', # Tag der Arbeit '03.10', # Tag der deutschen Einheit '25.12', # 1. Weihnachstag '26.12' # 1. Weihnachstag ] # bundeseinheitlich Feiertage with variable dates (we've got them until 2010) varft = [ #Karfreitag Ostersonn. Ostermon. Himmelfahrt Pfingstsonn. Pfingstmon. '29.03.2002','31.03.2002','01.04.2002','09.05.2002','19.05.2002','20.05.2002', '18.04.2003','20.04.2003','21.04.2003','29.05.2003','08.06.2003','09.06.2003', '09.04.2004','11.04.2004','12.04.2004','20.05.2004','30.05.2004','31.05.2004', '25.03.2005','27.03.2005','28.03.2005','05.05.2005','15.05.2005','16.05.2005', '14.04.2006','16.04.2006','17.04.2006','25.05.2006','04.06.2006','05.06.2006', '06.04.2007','08.04.2007','09.04.2007','17.05.2007','27.05.2007','28.05.2007', '21.03.2008','23.03.2008','24.03.2008','01.05.2008','11.05.2008','12.05.2008', '10.04.2009','12.04.2009','13.04.2009','21.05.2009','31.05.2009','01.06.2009', '02.04.2010','04.04.2010','05.04.2010','13.05.2010','23.05.2010','24.05.2010' ] dayofweek = time.strftime('%w') date = time.strftime('%d.%m') datewyear = time.strftime('%d.%m.%Y') if len(sys.argv) > 1: cmd = 'pon ' + " ".join(sys.argv[1:]) elif dayofweek == "0" or date in fixedft or datewyear in varft: cmd = 'pon ' + xxl_provider else: cmd = 'pon ' + normal_provider #print cmd os.system(cmd)