-
Notifications
You must be signed in to change notification settings - Fork 0
/
HubwardsData.py
371 lines (305 loc) · 14.1 KB
/
HubwardsData.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
'''
MIT License
Copyright (c) 2021 Mark Schafer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
import sqlite3
from sqlite3 import Error
import sys
class Yvideos:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS yvideos (video_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, VideoID TEXT, VideoTitle TEXT, DateUploaded TEXT, Duration TEXT, VideoTags TEXT, VideoCats TEXT, VideoURL TEXT)")
self.conn.commit()
# 1 2 3 4 5 6 7 8 9
def insert(self, VideoID, VideoTitle, DateUploaded, Duration, VideoTags, VideoCats, VideoURL):
self.cur.execute("INSERT INTO yvideos VALUES (NULL,?,?,?,?,?,?,?)", (VideoID, VideoTitle, DateUploaded, Duration, VideoTags, VideoCats, VideoURL))
self.conn.commit()
def isthere(self, VidID):
self.cur.execute("SELECT * FROM yvideos WHERE VideoID=?", (VidID,) )
rows = self.cur.fetchall()
# return rows
if len(rows) > 0:
return True
else:
return False
def view(self):
self.cur.execute("SELECT * FROM yvideos ORDER BY DateUploaded DESC" )
rows = self.cur.fetchall()
return rows
def generic(self, sqlstring):
self.cur.execute(sqlstring)
rows = self.cur.fetchall()
return rows
def genericupd(self, sqlstring):
self.cur.execute(sqlstring)
self.conn.commit()
def viewfor(self, sqlexpr):
self.cur.execute("SELECT * FROM yvideos "+sqlexpr )
rows = self.cur.fetchall()
return rows
def search(self, search):
minOn = False
pluOn = False
if "--" in search and "++" in search:
minOn = True
pluOn = True
minSt = search.find("--")
pluSt = search.find("++")
if minSt < pluSt: # search --search ++search
notword = search[minSt+2:pluSt-1]
andword = search[pluSt+2:]
search = search[0:minSt-1]
search = '%' + search + '%'
andword = '%' + andword + '%'
notword = '%' + notword + '%'
else: # search ++search --search
andword = search[pluSt+2:minSt-1]
notword = search[minSt+2:]
search = search[0:pluSt-1]
search = '%' + search + '%'
andword = '%' + andword + '%'
notword = '%' + notword + '%'
if "--" in search and "++" not in search: # search --search
minOn = True
minSt = search.find("--")
notword = search[minSt+2:]
search = search[0:minSt-1]
search = '%' + search + '%'
notword = '%' + notword + '%'
if "++" in search and "--" not in search : # search ++search
pluOn = True
pluSt = search.find("++")
andword = search[pluSt+2:]
search = search[0:pluSt-1]
search = '%' + search + '%'
andword = '%' + andword + '%'
if "--" not in search and "++" not in search:
search = '%' + search + '%'
if pluOn == True and minOn == True:
self.cur.execute("SELECT * FROM yvideos WHERE VideoTitle LIKE ? AND VideoTitle LIKE ? AND VideoTitle NOT LIKE ? ORDER BY DateUploaded DESC", (search, andword, notword ) )
elif pluOn == True and minOn == False:
self.cur.execute("SELECT * FROM yvideos WHERE VideoTitle LIKE ? AND VideoTitle LIKE ? ORDER BY DateUploaded DESC", (search, andword ) )
elif pluOn == False and minOn == True:
self.cur.execute("SELECT * FROM yvideos WHERE VideoTitle LIKE ? AND VideoTitle NOT LIKE ? ORDER BY DateUploaded DESC", (search, notword ) )
elif pluOn == False and minOn == False:
self.cur.execute("SELECT * FROM yvideos WHERE VideoTitle LIKE ? OR VideoTags LIKE ? OR VideoCats LIKE ? ORDER BY DateUploaded DESC", (search, search, search ) )
rows = self.cur.fetchall()
return rows
def update(self, VideoID, VideoTitle, DateUploaded, Duration, VideoTags, VideoCats, VideoURL, PornStar):
# 0 1 2 3 4 5 6 7
self.cur.execute("UPDATE yvideos SET VideoID=?, VideoTitle=?, DateUploaded=?, Duration=?, VideoTags=?, VideoCats=?, PornStar=? WHERE video_id=?", (VideoID, VideoTitle, DateUploaded, Duration, VideoTags, VideoCats, VideoURL, PornStar))
self.conn.commit()
if self.cur.rowcount < 1:
return False
else:
return True
def updatetag(self, Tag, VideoID):
self.cur.execute("UPDATE yvideos SET VideoTags=? WHERE VideoID=?", (VideoTags, VideoID,))
self.conn.commit()
def viewtag(self, VideoID):
self.cur.execute("SELECT VideoTags FROM yvideos WHERE VideoID=?", (VideoID,) )
rows = self.cur.fetchall()
return rows
def delete(self, id):
self.cur.execute("DELETE FROM yvideos WHERE Video_id=?", (id,))
self.conn.commit()
def deleteall(self):
self.cur.execute("DELETE FROM yvideos WHERE Video_id > -1")
self.conn.commit()
def deleteVideoID(self, VideoID):
self.cur.execute("DELETE FROM yvideos WHERE VideoID=?", (VideoID,))
self.conn.commit()
def showStuffIDontLike(self):
self.cur.execute("SELECT * FROM yvideos WHERE lower(VideoTags) LIKE '%ebony%' OR lower(VideoTags) LIKE '%black%' OR lower(VideoTags) LIKE '%shemale%' OR lower(VideoTags) LIKE '%boob%' OR lower(VideoTags) LIKE '%tits%' OR lower(VideoTags) LIKE '%-pelo%' OR lower(VideoTags) LIKE '%feet%' OR lower(VideoTags) LIKE '%emo%' OR lower(VideoTags) LIKE '%sissy%' OR lower(VideoTags) LIKE '%verification-video%' OR lower(VideoTags) LIKE '%pau%'")
rows = self.cur.fetchall()
return rows
def __del__(self):
self.conn.close()
################################################
class YTdl:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS ytdl (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, VideoTitle TEXT, VideoURL, started INTEGER)")
self.conn.commit()
def insert(self, VideoTitle, VideoURL, started):
self.cur.execute("INSERT INTO ytdl VALUES (NULL,?,?,?)", (VideoTitle, VideoURL, started))
self.conn.commit()
def view(self):
self.cur.execute("SELECT * FROM ytdl" )
rows = self.cur.fetchall()
return rows
def viewOne(self):
ans = self.cur.execute("SELECT COUNT(*) FROM ytdl WHERE started == 0")
if ans == 0:
return []
else:
self.cur.execute("SELECT * FROM ytdl WHERE started == 0 LIMIT 1" )
rows = self.cur.fetchone()
return rows
def updateOne(self, started, id):
self.cur.execute("UPDATE ytdl SET started=1 WHERE id=?", (id,))
self.conn.commit()
def update(self, VideoTitle, VideoURL, started):
self.execute("UPDATE ytdl SET VideoTitle=?, VideoURL=?, started=?, WHERE id=?", (self, VideoTitle, VideoURL, started))
self.conn.commit()
def delete(self, id):
self.cur.execute("DELETE FROM ytdl WHERE id=?", (id,))
self.conn.commit()
def deletetitle(self, Title):
url = ""
Title = '%' + Title + '%'
self.cur.execute("SELECT * FROM ytdl WHERE VideoTitle LIKE ?", (Title,))
rows = self.cur.fetchall()
if len(rows) > 0:
row = rows[0]
self.cur.execute("DELETE FROM ytdl WHERE id=?", (row[0],))
self.conn.commit()
url = row[2]
return url
def deleteall(self):
self.cur.execute("DELETE FROM ytdl WHERE id > -1")
self.conn.commit()
def __del__(self):
self.conn.close()
#############################################################################
class NoWord:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS noword (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, noword TEXT)")
self.conn.commit()
def insert(self, id, noword):
self.cur.execute("INSERT INTO noword VALUES (NULL, ?)", (id, noword))
self.conn.commit()
def insertlist(self, list):
insertquery = "INSERT INTO noword (id, noword) VALUES (NULL, ?);"
self.cur.executemany(insertquery, list)
def view(self):
self.cur.execute("SELECT * FROM noword" )
rows = self.cur.fetchall()
return rows
def update(self, id, noword):
self.execute("UPDATE noword SET noword=?, WHERE id=?", (self, id, noword))
self.conn.commit()
def delete(self, id):
self.cur.execute("DELETE FROM noword WHERE id=?", (id,))
self.conn.commit()
def deleteall(self):
self.cur.execute("DELETE FROM noword WHERE id > -1")
self.conn.commit()
def __del__(self):
self.conn.close()
#############################################################################
class Thumb:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS thumb (thumb_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, VideoID TEXT, ThumbUrl TEXT, ThumbNail BLOB)")
self.conn.commit()
# 1 2 3 4 5 6 7 8 9
def insert(self, VideoID, ThumbUrl, ThumbNail):
self.cur.execute("INSERT INTO thumb VALUES (NULL,?,?,?)", (VideoID, ThumbUrl, ThumbNail))
self.conn.commit()
def isthere(self, VidID):
self.cur.execute("SELECT * FROM thumb WHERE VideoID=?", (VidID,) )
rows = self.cur.fetchall()
# return rows
if len(rows) > 0:
return True
else:
return False
def generic(self, sqlstring):
self.cur.execute(sqlstring)
rows = self.cur.fetchall()
return rows
def view(self):
self.cur.execute("SELECT * FROM thumb" )
rows = self.cur.fetchall()
return rows
def __del__(self):
self.conn.close()
###############################################################################
class HaveGot:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS havegot (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, VideoID TEXT, FromSite TEXT)")
self.conn.commit()
# 1 2 3 4 5 6 7 8 9
def insert(self, VideoID, FromSite):
self.cur.execute("INSERT INTO havegot VALUES (NULL,?,?)", (VideoID, FromSite))
self.conn.commit()
def isthere(self, VidID):
self.cur.execute("SELECT * FROM havegot WHERE VideoID=?", (VidID,) )
rows = self.cur.fetchall()
if len(rows) > 0:
return True
else:
return False
def view(self):
self.cur.execute("SELECT * FROM havegot" )
rows = self.cur.fetchall()
return rows
def viewfor(self, sqlexpr):
self.cur.execute("SELECT * FROM havegot "+sqlexpr )
rows = self.cur.fetchall()
return rows
def generic(self, sqlstring):
self.cur.execute(sqlstring)
rows = self.cur.fetchall()
return rows
def __del__(self):
self.conn.close()
################################################################################
class PornStar:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS pornstars (id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, PornstarName TEXT, Gender TEXT )")
self.conn.commit()
# 1 2 3 4 5 6 7 8 9
def insert(self, PornstarName, Gender):
self.cur.execute("INSERT INTO pornstars VALUES (NULL,?,?)", (PornstarName, Gender))
self.conn.commit()
def isthere(self, PornstarName):
self.cur.execute("SELECT * FROM pornstars WHERE PornstarName=?", (PornstarName,) )
rows = self.cur.fetchall()
return rows
# if len(rows) > 0:
# return True
# else:
# return False
def view(self):
self.cur.execute("SELECT * FROM pornstars" )
rows = self.cur.fetchall()
return rows
def viewfor(self, sqlexpr):
self.cur.execute("SELECT * FROM pornstars "+sqlexpr )
rows = self.cur.fetchall()
return rows
def updateGender(self, Gender, PornstarName):
self.cur.execute("UPDATE pornstars SET Gender=? WHERE PornstarName=?", (Gender, PornstarName,))
self.conn.commit()
def generic(self, sqlstring):
self.cur.execute(sqlstring)
rows = self.cur.fetchall()
return rows
def __del__(self):
self.conn.close()