How to use the extensions.bas_extension.BaseExtension function in extensions

To help you get started, we’ve selected a few extensions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wowdd1 / xlinkBook / extensions / share / share.py View on Github external
#!/usr/bin/env python

from extensions.bas_extension import BaseExtension
from utils import Utils

class Share(BaseExtension):

    def __init__(self):
        BaseExtension.__init__(self)
        self.utils = Utils()

    def excute(self, form_dict):
        url = form_dict['url'].encode('utf-8')
        title = form_dict['rTitle']
        if url == '':
            url = self.utils.toQueryUrl(url, title)
        html = '<div class="ref"><br>'
        html += '<a title=""><img src="http://mycroftproject.com/updateos.php/id0/facebookvideomirror.ico"></a>&nbsp;'
        html += '<a title=""><img src="http://mycroftproject.com/updateos.php/id0/twitter-music.png"></a>&nbsp;'
        html += '<a title=""><img src="http://mycroftproject.com/updateos.php/id0/plusgoogle.ico"></a>&nbsp;'
        html += '<a title=""><img src="http://mycroftproject.com/updateos.php/id0/linkedin_googfr.ico"></a>&nbsp;'
        html += '<a href="mailto:?subject=' + title + ' (' + url + ')&amp;body=' + title+ ' (' + url + ')"><img src="http://mycroftproject.com/updateos.php/id0/gmail.ico"></a>&nbsp;'</div>
github wowdd1 / xlinkBook / extensions / fulltext / fulltext.py View on Github external
#!/usr/bin/env python

from extensions.bas_extension import BaseExtension
from utils import Utils

class Fulltext(BaseExtension):

    def __init__(self):
        BaseExtension.__init__(self)
        self.utils = Utils()

    def excute(self, form_dict):
        rID = form_dict['rID'].encode('utf8')
        if rID.find('arxiv') != -1:
            arxiv_id = rID[rID.find('arxiv-') + 6 :].replace('-', '.')
            version = self.utils.get_last_arxiv_version(arxiv_id)
            return 'http://arxiv.org/pdf/' + arxiv_id + version
        return 'http://scholar.google.com.secure.sci-hub.io/scholar?q=' + form_dict['rTitle']

    def check(self, form_dict):
        fileName = form_dict['fileName'].encode('utf8')
        return fileName.find('arxiv') != -1
github wowdd1 / xlinkBook / extensions / delete / delete.py View on Github external
def __init__(self):
        BaseExtension.__init__(self)
github wowdd1 / xlinkBook / extensions / reference / reference.py View on Github external
# -*- coding: utf-8 -*-

import sys, os
from extensions.bas_extension import BaseExtension
from utils import Utils
from update.all_subject import default_subject
from record import ReferenceRecord
from record import CategoryRecord, Category
from semanticscholar import Semanticscholar
from config import Config
from bs4 import BeautifulSoup
import requests
from extensions.reference.youtube_helper import YoutubeHelper
from record import Record

class Reference(BaseExtension):

    record_reference = {}
    html = ''
    form_dict = None

    def __init__(self):
        BaseExtension.__init__(self)
        self.utils = Utils()
        self.semanticscholar = Semanticscholar()
        self.category_obj = Category()
        self.helper = YoutubeHelper()

    def loadReference(self, filename, rID):
        print 'loadReference ' + filename + ' rID:' + rID
        if len(self.record_reference) != 0 and self.record_reference.has_key(rID):
            return
github wowdd1 / xlinkBook / extensions / citation / citation.py View on Github external
def __init__(self):
        BaseExtension.__init__(self)
        self.semanticscholar = Semanticscholar()
        self.category_obj = Category()
        self.utils = Utils()
github wowdd1 / xlinkBook / extensions / comment / comment.py View on Github external
#!/usr/bin/env python

from extensions.bas_extension import BaseExtension
from utils import Utils

class Comment(BaseExtension):


    def excute(self, form_dict):
        rID = form_dict['rID'].encode('utf8')

        html = ''
        if rID.find('arxiv') != -1:
            arxiv_id = rID[rID.find('arxiv-') + 6 :].replace('-', '.')          
            utils = Utils()
            for e in utils.get_arxiv_entries(arxiv_id):
                j = utils.encode_feedparser_dict(e)
                if j.has_key('arxiv_comment'):
                    print j['arxiv_comment']
                    html += '<br>' + j['arxiv_comment'] + '<br>'
                    html += j['updated'][0 : j['published'].find('T')] + ' '
                    html += j['id'][j['id'].rfind('v') :] + '<br>'
github wowdd1 / xlinkBook / extensions / social / social.py View on Github external
def __init__(self):
        BaseExtension.__init__(self)
        self.utils = Utils()
        self.tag = Tag()
        self.form_dict = None
github wowdd1 / xlinkBook / extensions / rss / rss.py View on Github external
#!/usr/bin/env python

import sys, os
from extensions.bas_extension import BaseExtension
from utils import Utils
import feedparser


class Rss(BaseExtension):


    def __init__(self):
        BaseExtension.__init__(self)
        self.utils = Utils()

    def excute(self, form_dict):

        fileName = form_dict['fileName'].encode('utf8')
        rID = form_dict['rID'].encode('utf8')
        url = form_dict['url']

        return self.genHtml(url, form_dict['divID'].encode('utf8'), rID)