Example #1
0
	def append_list(self, list):
		# populate menu with new items
		from utils import epoch_to_readable, open_link
		for x in range(len(list))[::-1]:
			if list[x]["active"] == True:
				self.history_menu_item = Gtk.MenuItem(list[x]['title'] + ' (' + epoch_to_readable(list[x]['modified'])+')')
				self.history_menu_item.connect('activate',open_link, 'https://www.pushbullet.com/')
				self.history_menu.prepend(self.history_menu_item)
				self.history_menu.show_all()
Example #2
0
	def append_item(self, item):
		from utils import epoch_to_readable, open_link, assign_from_json
		import time
		self.title = assign_from_json(item, ('title', 'application_name'), 'Push')
		self.meta = assign_from_json(item, ('modified', epoch_to_readable(time.time())), 'Push')
		print self.meta
		self.history_menu_item = Gtk.MenuItem(self.title + ' (' + self.meta + ')')
		self.history_menu_item.connect('activate',open_link, 'https://www.pushbullet.com/')
		self.history_menu.prepend(self.history_menu_item)
		self.history_menu.show_all()
Example #3
0
 def append_list(self, list):
     # populate menu with new items
     from utils import epoch_to_readable, open_link
     for x in range(len(list))[::-1]:
         if list[x]["active"] == True:
             self.history_menu_item = Gtk.MenuItem(
                 list[x]['title'] + ' (' +
                 epoch_to_readable(list[x]['modified']) + ')')
             self.history_menu_item.connect('activate', open_link,
                                            'https://www.pushbullet.com/')
             self.history_menu.prepend(self.history_menu_item)
             self.history_menu.show_all()
Example #4
0
 def append_item(self, item):
     from utils import epoch_to_readable, open_link, assign_from_json
     import time
     self.title = assign_from_json(item, ('title', 'application_name'),
                                   'Push')
     self.meta = assign_from_json(
         item, ('modified', epoch_to_readable(time.time())), 'Push')
     print self.meta
     self.history_menu_item = Gtk.MenuItem(self.title + ' (' + self.meta +
                                           ')')
     self.history_menu_item.connect('activate', open_link,
                                    'https://www.pushbullet.com/')
     self.history_menu.prepend(self.history_menu_item)
     self.history_menu.show_all()
Example #5
0
def get_pins_db(post_no=None,board=None):
    database = storage.Storage()
    pins = database.get_pins(post_no,board)

    pins_list=[]

    if post_no == None and board == None:

        for pin in pins:
            short_com = pin['SHORT_COM'][2:-1].replace("'","'")
            filename = database.get_thumb_dir() + "/" + re.findall(r'\d+s.jpg',pin['THUMB_URL'])[0]
            thread_dead =False
            archived = thread_archived(pin['POSTNO'])
            now = epoch_to_readable(pin['TIME_CREATED'])

            post_count = get_new_posts_count(pin['BOARD'],pin['POSTNO'],pin['REPLIES_COUNT'])
            if post_count is None:
                thread_dead = True

            pins_list.append({'no':pin['POSTNO'],'pinBoardId':pin['BOARD'],'com':short_com,'postCount':post_count,
                              'thumbUrl':filename,'threadArchived':archived,'threadDead':thread_dead,'now':now})
            #pins_list.append({'postNo':pin['POSTNO'],'pinFromBoard':pin['BOARD'],'shortCom':short_com,'postCount':post_count,'pinnedThumbSource':filename,'threadArchived':archived,'threadDead':thread_dead})
            #POSTNO,BOARD,SHORT_COM,THUMB_URL,TIME_ADDED,TIME_READ,TIME_CREATED

        print(pins_list)
        #return pins_list
        if sys.platform != 'win32':
            pyotherside.send('pinned_all', pins_list)

    elif post_no and board == None:

        for pin in pins:
            pins_list.append({'postNo':pin['POSTNO'],'board':pin['BOARD']})

        print(pins_list)
        if sys.platform != 'win32':
            pyotherside.send('pinned_postno', pins_list)

    elif board and post_no == None:
        #pin_dict = {}
        for pin in pins:
            pins_list.append(pin['POSTNO'])

        #print(pins_list)

        #pins_list = dict (zip(my_dict.values(),my_dict.keys()))
        if sys.platform != 'win32':
            pyotherside.send('pinned_board', pins_list)
Example #6
0
def get_pins_db(post_no=None, board=None):
    database = storage.Storage()
    pins = database.get_pins(post_no, board)

    pins_list = []

    if post_no is None and board is None:
        for pin in pins:
            short_com = pin['SHORT_COM']
            short_com = html.unescape(short_com)

            if len(re.findall(r'\d+s.jpg', pin['THUMB_URL'])) != 0:
                filename = database.get_thumb_dir() + "/" + re.findall(
                    r'\d+s.jpg', pin['THUMB_URL'])[0]
            else:
                filename = None

            thread_dead = False
            archived = False
            post_count = 0

            now = epoch_to_readable(pin['TIME_CREATED'])

            print("GETTIng INFO BOUT {}".format(pin['POSTNO']))

            pins_list.append({
                'no': pin['POSTNO'],
                'post_board': pin['BOARD'],
                'thisBoard': pin['BOARD'],
                'com': short_com,
                'postCount': post_count,
                'thumbUrl': filename,
                'threadArchived': archived,
                'threadDead': thread_dead,
                'now': now,
                'has_file': 1,
                'pin': 1,
                'name': '',
                'closed': 0,
                'images': 0,
                'sticky': 0,
                'replies': 0
            })
            #POSTNO,BOARD,SHORT_COM,THUMB_URL,TIME_ADDED,TIME_READ,TIME_CREATED

        pyotherside.send('pinned_all', pins_list)

        pins_list = []

        for pin in pins:
            post_count = get_new_posts_count(pin['BOARD'], pin['POSTNO'],
                                             pin['REPLIES_COUNT'])
            if post_count is None:
                thread_dead = True
                archived = False
            else:
                archived = thread_archived(pin['POSTNO'])

            pins_list.append({
                'no': pin['POSTNO'],
                'postCount': post_count,
                'threadArchived': archived,
                'threadDead': thread_dead
            })

        pyotherside.send('pinned_all_update', pins_list)

    elif post_no and board is None:

        for pin in pins:
            pins_list.append({'postNo': pin['POSTNO'], 'board': pin['BOARD']})

        print(pins_list)
        if sys.platform != 'win32':
            pyotherside.send('pinned_postno', pins_list)

    elif board and post_no is None:
        for pin in pins:
            pins_list.append(pin['POSTNO'])

        if sys.platform != 'win32':
            pyotherside.send('pinned_board', pins_list)
Example #7
0
def get_pins_db(post_no=None,board=None):
    database = storage.Storage()
    pins = database.get_pins(post_no,board)

    pins_list=[]

    if post_no is None and board is None:

        for pin in pins:
            short_com = pin['SHORT_COM'][2:-1].replace("'","'")
            if len(re.findall(r'\d+s.jpg',pin['THUMB_URL'])) != 0:
                filename = database.get_thumb_dir() + "/" + re.findall(r'\d+s.jpg',pin['THUMB_URL'])[0]
            else:
                filename = None
            thread_dead = False
            archived = False
            post_count = 0

            now = epoch_to_readable(pin['TIME_CREATED'])
            #last_read = epoch_to_readable(pin['TIME_CREATED'])

            print("GETTIng INFO BOUT {}".format(pin['POSTNO']))

            pins_list.append({'no':pin['POSTNO'],'post_board':pin['BOARD'],'thisBoard':pin['BOARD'],'com':short_com,'postCount':post_count,
                              'thumbUrl':filename,'threadArchived':archived,'threadDead':thread_dead,
                              'now':now,'has_file':1,'pin':1,'name':'','closed':0,'images':0,'sticky':0,'replies':0})
            #POSTNO,BOARD,SHORT_COM,THUMB_URL,TIME_ADDED,TIME_READ,TIME_CREATED

        pyotherside.send('pinned_all', pins_list)

        pins_list = []

        for pin in pins:
            post_count = get_new_posts_count(pin['BOARD'],pin['POSTNO'],pin['REPLIES_COUNT'])
            if post_count is None:
                thread_dead = True
                archived = False
            else:
                archived = thread_archived(pin['POSTNO'])

            pins_list.append({'no':pin['POSTNO'],'postCount':post_count,
                              'threadArchived':archived,'threadDead':thread_dead})

        pyotherside.send('pinned_all_update', pins_list)

    elif post_no and board is None:

        for pin in pins:
            pins_list.append({'postNo':pin['POSTNO'],'board':pin['BOARD']})

        print(pins_list)
        if sys.platform != 'win32':
            pyotherside.send('pinned_postno', pins_list)

    elif board and post_no is None:
        #pin_dict = {}
        for pin in pins:
            pins_list.append(pin['POSTNO'])

        #print(pins_list)

        #pins_list = dict (zip(my_dict.values(),my_dict.keys()))
        if sys.platform != 'win32':
            pyotherside.send('pinned_board', pins_list)