forked from jordsti/rsswatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTorrentHistory.py
More file actions
51 lines (29 loc) · 959 Bytes
/
Copy pathTorrentHistory.py
File metadata and controls
51 lines (29 loc) · 959 Bytes
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
'''
Created on 2013-02-04
@author: JordSti
'''
import os
class TorrentHistory:
def __init__(self):
self.filename = ".history.th"
self.ids = []
def add(self, id):
if self.ids.count(str(id)) == 0:
self.ids.append(str(id))
def contains(self, id):
if self.ids.count(str(id)) == 0:
return False
else:
return True
def save(self):
f = open(self.filename, 'w')
for id in self.ids:
f.write( str(id) + '\n' )
f.close()
def load(self):
if os.path.exists(self.filename):
f = open(self.filename, 'r')
for line in f:
id = line.rstrip('\r\n')
self.ids.append(id)
f.close()