@ -13,14 +14,40 @@ from tinytinypy import Connection
APP_NAME = "tinytinypy" # For default config directories
class OutputMode(Enum):
# enum values
JSON = ('json', False)
ONLY_URL = ('only-url', False)
HEADLINES = ('headlines', False)
# helpers
@classmethod
def get_mode_names(cls):
return [e.mode_name for e in cls]
@classmethod
def parse_mode(cls, mode_name):
for e in cls:
if e.mode_name == mode_name:
return e
def __init__(self, mode_name, requires_content):
self.mode_name = mode_name
self.requires_content = requires_content
def __str__(self):
return self.mode_name
def func_articles(server, args):
filtered = {key: value for key, value in args.__dict__.items() if key in ["feed_id", "cat_id", "limit", "skip", "view_mode", "since_id", "include_nested", "order_by"]}
parser = argparse.ArgumentParser(description="Allows access to feeds and articles of a Tiny Tiny RSS instance using the API.")
@ -38,7 +65,7 @@ def configure_parser():
p.add_argument('--limit', dest='limit', type=int, help="Maximum count of articles")
p.add_argument('--skip', '--offset', dest='skip', type=int, help="Skip this amount of feeds first")
p.add_argument('--view-mode', '--filter', dest='view_mode', choices=['all_articles', 'unread', 'adaptive', 'marked', 'updated'], default='all_articles', help='Only show articles of certain type')
p.add_argument('--only-url', dest='only_url', action='store_true', help="Only output urls of articles instead of full article info")
p.add_argument('--output-mode', dest='output_mode', choices=OutputMode, type=OutputMode.parse_mode, default='json', help='Define how the received articles should be outputed, in most modes except json and *-full modes, one line equals a single article')