-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
73 lines (44 loc) · 1.6 KB
/
main.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
import gkeepapi
import sqlite3
import os
# keep = gkeepapi.Keep()
# succes = keep.login('tomkobat@gmail.com', 'amirkuspapirkus')
# note = keep.findLabel("poznamky")
# finaltext = ""
# gnotes = keep.all()
# for note in gnotes:
# finaltext += note.text
# # with open("ahoj.txt", "a") as ahoj:
# # ahoj.write(finaltext)
# finaltext = [s.strip() for s in finaltext.splitlines()]
# list_links = list()
# count = 0
# for text in finaltext:
# if text.startswith("http"):
# list_links.append(text)
# count += 1
# print(list_links)
db = sqlite3.connect('/home/tomas/.mozilla/firefox/4mjkjidl.default/places.sqlite')
"""INSERT INTO moz_bookmarks(type, fk, parent, position)"""
# gnote = keep.createNote('cauuuu', 'jakjeeeeeeee')
# glist = keep.createList('Title', [
# ('Item 2', True) # Checked
# ])
# keep.sync()
class SyncLinks():
def __init__(self, **kwargs):
if "path" in kwargs:
self.path = kwargs["path"]
def path_mozzilla(self):
if os.path.isdir(os.path.join("/home/tomas", ".mozilla")):
return [x for x in list(os.listdir(os.path.join("/home/tomas", ".mozilla/firefox"))) if x.endswith(".default")][0]
elif os.path.isdir(self.path):
return [x for x in os.listdir(self.path) if x.endswith(".default")][0]
else:
raise FileNotFoundError(
"Folder of mozila could not be"
)
def get_places_sql(self):
return os.path.join(self.path_mozzilla(), "places.sql")
s = SyncLinks()
print(s.get_places_sql())