Пример #1
0
def posts_transclude(profile: NaClProfile):
    """
    Transclude every single post in the posts list of a profile object.
    Use it before saving the DSU file in order to change the posts list
    of the profile object before uploading or saving to local.
    :param profile: current working Profile object
    :return: modified Profile object
    """
    # posts here is not the actual _posts private list from the NaClProfile object
    # they are the decrypted copy of the _posts
    posts = profile.get_posts()
    print('Transcluding...')
    for i in range(len(posts)):
        if '@weather' in posts[i]['entry']:
            a = OpenWeather.OpenWeather('92697', 'US')
            entry = a.transclude(posts[i].get_entry())
            # entry = profile.encrypt_entry(entry)
            posts[i].set_entry(entry)
        if '@lastfm' in posts[i]['entry']:
            a = LastFM.LastFM('United States')
            entry = a.transclude(posts[i].get_entry())
            # entry = profile.encrypt_entry(entry)
            posts[i].set_entry(entry)
        if '@extracredit' in posts[i]['entry']:
            a = ExtraCreditAPI.Joke()
            entry = a.transclude(posts[i].get_entry())
            # entry = profile.encrypt_entry(entry)
            posts[i].set_entry(entry)

    # empty the actual _posts private list from the NaClProfile object
    profile._posts = []
    # move each post in the posts temporary holder back to the actual _posts
    for post in posts:
        profile.add_post(post)

    print_ok('Transcluded!')
    return profile
Пример #2
0
def posts_transclude(profile: Profile):
    """
    Transclude every single post in the posts list of a profile object.
    Use it before saving the DSU file in order to change the posts list
    of the profile object before uploading or saving to local.
    :param profile: current working Profile object
    :return: modified Profile object
    """
    posts = profile._posts
    print('Transcluding...')
    for i in range(len(posts)):
        if '@weather' in posts[i]['entry']:
            a = OpenWeather.OpenWeather('92697', 'US')
            posts[i].set_entry(a.transclude(posts[i].get_entry()))
        if '@lastfm' in posts[i]['entry']:
            a = LastFM.LastFM('United States')
            posts[i].set_entry(a.transclude(posts[i].get_entry()))
        if '@extracredit' in posts[i]['entry']:
            a = ExtraCreditAPI.Joke()
            posts[i].set_entry(a.transclude(posts[i].get_entry()))

    msg = color_mod.color_code('Transcluded!', 'ok')
    print(msg)
    return profile
Пример #3
0
import common
import settings
import Tumblr
import LastFM
import DeviantArt
import Flickr
#import Artstation
import HackerNews
from pprint import pprint

silos = [
    DeviantArt.DAFavs(),
    Flickr.FlickrFavs(),
    Tumblr.TumblrFavs(),
    #    Artstation.ASFavs(),
    LastFM.LastFM(),
    HackerNews.HackerNews()
]

for silo in silos:
    silo.run()