## 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
24 lines
694 B
Python
24 lines
694 B
Python
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)) |