Exemple #1
0
    def run(self):
        #os.chdir(self.config['Main']['Data'])
        feeds = self.get_feeds_from_config(self.config)
        threads = []
        url = self.config['Main']['Url']
        username = self.config['Main']['Username']
        password = self.config['Main']['Password']
        client = TTRClient(url, username, password)
        client.login()
        db = rss_db(self.config)

        self.ifRemovedMarkRead(
            client,
            db)  # first mark articles as read if they have been removed

        for article_dict in feeds:
            print(article_dict)

            p = Process(target=self.feedCycle,
                        args=(article_dict, self.downloader, db))
            p.start()
            threads.append(p)
        for thread in threads:
            thread.join()
        self.downloader.stop()
Exemple #2
0
    def feedCycle(self, article_dict, downloader, db):
        url = self.config['Main']['Url']
        username = self.config['Main']['Username']
        password = self.config['Main']['Password']
        client = TTRClient(url, username, password)
        client.login()

        db = rss_db(self.config)

        articles = self.get_unread_articles(
            client, article_dict['feed_name'])  # grab all unread articles

        if articles is None:
            articles = []
        article_ids = [article.id for article in articles]

        for db_article in db.getItemByFeed(article_dict['feed_name']):
            if db_article[0] not in article_ids:
                db.removeItem(db_article[0])

        articles = self.sort_articles(client, articles,
                                      article_dict['release_type'],
                                      int(article_dict['count']))

        # has to create  new database object because of threads
        for article in articles:
            self.download_articles(rss_db(self.config), article, article_dict,
                                   downloader, client)
Exemple #3
0
def init_ttrss(config):
    """Init Tiny tiny RSS API."""
    hostname = config.get('ttrss', 'hostname')
    username = config.get('ttrss', 'username')
    password = config.get('ttrss', 'password')
    client =  TTRClient(hostname, username, password, auto_login=False)
    client.login()
    return client
Exemple #4
0
def init_ttrss(config):
    """Init Tiny tiny RSS API."""
    hostname = config.get('ttrss', 'hostname')
    username = config.get('ttrss', 'username')
    password = config.get('ttrss', 'password')

    htusername = config.get('ttrss', 'htusername')
    htpassword = config.get('ttrss', 'htpassword')
    http_auth = ()
    if htusername or htpassword:
        http_auth = (htusername, htpassword)

    client = TTRClient(hostname, username, password, http_auth=http_auth)
    client.login()

    return client
from ttrss.client import TTRClient  # https://github.com/Vassius/ttrss-python
import RPi.GPIO as GPIO
import time

client = TTRClient('http://raspberry.local', 'YOUR_USERNAME', 'YOUR_PASSWORD')
client.login()

RGB = [17, 27, 22]
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

for pin in RGB:
    GPIO.setup(pin, GPIO.OUT)
    GPIO.output(pin, GPIO.LOW)

try:
    while True:
        count = client.get_unread_count()
        if count > 0:
            print count
            GPIO.output(17, True)  # Red On
            GPIO.output(27, False)  # Green Off
        else:
            print 'Nothing to read.'
            GPIO.output(17, False)  # Red Off
            GPIO.output(27, True)  # Green On
        time.sleep(3)

except KeyboardInterrupt:
    GPIO.cleanup()
from ttrss.client import TTRClient      # https://github.com/Vassius/ttrss-python
import RPi.GPIO as GPIO
import time

client = TTRClient('http://raspberry.local', 'YOUR_USERNAME', 'YOUR_PASSWORD')
client.login()

RGB = [17, 27, 22]
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

for pin in RGB:
        GPIO.setup(pin, GPIO.OUT)
        GPIO.output(pin, GPIO.LOW)

try:
    while True:
        count   = client.get_unread_count()
        if count > 0:
            print count
            GPIO.output(17, True)   # Red On
            GPIO.output(27, False)  # Green Off
        else:
            print 'Nothing to read.'
            GPIO.output(17, False)   # Red Off
            GPIO.output(27, True)    # Green On
        time.sleep(3)

except KeyboardInterrupt:
    GPIO.cleanup()