source: ipk/source.sh4/epg_crossepg_0_61/var/crossepg/scripts/test.py@ 7451

Last change on this file since 7451 was 7451, checked in by BPanther, 15 years ago

[ipk] - copy source->source.sh4

File size: 1.9 KB
Line 
1#!/usr/bin/python
2# above is Python interpreter location
3
4# ambrosa 08-Jan-2011 http://www.ambrosa.net
5# this test.py program simply do nothing
6
7
8import os
9import sys
10
11# import CrossEPG module
12import crossepg
13
14# python local modules under "scripts/lib" directory
15# and add it to sys.path()
16crossepg_instroot = crossepg.epgdb_get_installroot()
17if crossepg_instroot == False:
18 print "ERROR: cannot find CrossEPG installation directory"
19 sys.exit(1)
20libdir = os.path.join(crossepg_instroot , 'scripts/lib')
21sys.path.append(libdir)
22
23# import local modules under 'scripts/lib'
24import scriptlib
25
26# -------------------------------------------------
27# this is the main function
28def main():
29
30 # log_add() print to stdout a text message
31 crossepg.log_add("---- START EXAMPLE TEST SCRIPT ----")
32
33 # get installation dir
34 instdir = crossepg.epgdb_get_installroot()
35 if instdir == False:
36 crossepg.log_add("ERROR: cannot find CrossEPG installation directory")
37 sys.exit(1)
38
39 crossepg.log_add("Installation dir : %s" % instdir)
40
41
42 # get dbroot path
43 dbroot = crossepg.epgdb_get_dbroot()
44 if dbroot == False:
45 crossepg.log_add("ERROR: cannot find CrossEPG database directory")
46 sys.exit(1)
47
48 crossepg.log_add("Database dir : %s" % dbroot)
49
50
51 # open CrossEPG internal database
52 if crossepg.epgdb_open(dbroot):
53 crossepg.log_add("EPGDB opened successfully (root = %s)" % dbroot);
54 else:
55 crossepg.log_add("Error opening EPGDB");
56 crossepg.epgdb_close();
57 sys.exit(1)
58
59 crossepg.log_add("Closing EPGDB");
60 crossepg.epgdb_close();
61
62
63 delta_timezone = scriptlib.delta_utc()
64 crossepg.log_add("GMT vs. LocalTime difference (in seconds): %d" % delta_timezone)
65 delta_daylight = scriptlib.delta_dst()
66 crossepg.log_add("DayLight Saving (DST) difference now: %d" % delta_daylight)
67
68
69
70 crossepg.log_add("---- END EXAMPLE TEST SCRIPT ----")
71
72# -------------------------------------------------
73# run main() function
74main()
75
Note: See TracBrowser for help on using the repository browser.