v1.8.0 (#105)
## Change log - Youtube support added - Custom filenames feature added - Custom folder structure feature added - Unsaving downloaded posts option added - Remove duplicate posts on different subreddits option added - Skipping given domains option added - Keeping track of already downloaded posts on a separate file option added (See --dowloaded-posts in README) - No audio on v.redd.it videos bug fixed (see README for details about ffmpeg) - --default-directory option is added - --default-options is added - --use-local-config option is added - Bug fixes
This commit is contained in:
24
src/store.py
Normal file
24
src/store.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from os import path
|
||||
|
||||
class Store:
|
||||
def __init__(self,directory=None):
|
||||
self.directory = directory
|
||||
if self.directory:
|
||||
if path.exists(directory):
|
||||
with open(directory, 'r') as f:
|
||||
self.list = f.read().split("\n")
|
||||
else:
|
||||
with open(self.directory, 'a'):
|
||||
pass
|
||||
self.list = []
|
||||
else:
|
||||
self.list = []
|
||||
|
||||
def __call__(self):
|
||||
return self.list
|
||||
|
||||
def add(self, filehash):
|
||||
self.list.append(filehash)
|
||||
if self.directory:
|
||||
with open(self.directory, 'a') as f:
|
||||
f.write("{filehash}\n".format(filehash=filehash))
|
||||
Reference in New Issue
Block a user