-
Notifications
You must be signed in to change notification settings - Fork 3
/
RanExtDB.py
55 lines (31 loc) · 990 Bytes
/
RanExtDB.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import re
import os
import sys
import sqlite3 as lite
class FetchRanExt(object):
def grab_data(self):
set_db_in_desktop = os.path.expanduser("~/Desktop/RanExt.db")
#set_db_in_desktop = os.path.expanduser("X:\\Install\\SnowRanScan\\RanExt.db")
ext = []
con = lite.connect(set_db_in_desktop)
with con:
cur = con.cursor()
cur.execute("SELECT * FROM RanExt")
rows = cur.fetchall()
for row in rows:
ext.append(row[0])
make_re = '|'.join(ext)
known_ext = re.compile('.*\.(|{}|)$'.format(make_re.encode('utf-8')))
return known_ext
def ok_ext(self):
set_db_in_desktop = os.path.expanduser("~/Desktop/RanExt.db")
ext = []
con = lite.connect(set_db_in_desktop)
with con:
cur = con.cursor()
cur.execute("SELECT * FROM OkExt")
rows = cur.fetchall()
for row in rows:
ext.append(row[0])
return tuple(ext)
FetchRanExt().ok_ext()