Esempio n. 1
0
def main():
    writer = HTMLwriter()
    writer.startBasicPage()
#    performSearch('Ljuden från kosmos', writer)
#    performSearch('Herman Melville', writer)
#    performSearch('mozart', writer)
    performSearch('Baskervilles hund', writer)
#    performSearch('gris', writer)
    writer.closeBasicPage()
Esempio n. 2
0
def main():
    writer = HTMLwriter()
    writer.startBasicPage()
    #    performSearch('Ljuden från kosmos', writer)
    #    performSearch('Herman Melville', writer)
    #    performSearch('mozart', writer)
    performSearch('Baskervilles hund', writer)
    #    performSearch('gris', writer)
    writer.closeBasicPage()
Esempio n. 3
0
    def run(self):
        other_threads = threading.enumerate()
        other_threads.remove(threading.current_thread())
        if self.name in [t.name for t in other_threads]:
            return
        mailer = SMTPMailer(port=config.SMTP_PORT)
        delivery = DirectMailDelivery(mailer)
        a = True
        while True:
            items = deepcopy(self.root)
            for hash, search in items.iteritems():
                if not search['active']:
                    continue
                results = performSearch(self.root, search)
                tell = []
                for result in results:
                    key = result.copy()
                    del key['total_price']
                    del key['book_link']
                    if key not in search['told']:
                        tell.append(result)
                        search['told'].append(key)

                if not tell:
                    continue

                url = config.URL
                remove_link = '%s/remove?email=%s&code=%s' % (url, search['email'], hash)
                journies = []
                for result in tell:
                    journey = config.JOURNEY_STR % result
                    journies.append(journey)

                journies = config.JOURNEY_JOINER.join(journies)

                message_text = config.EMAIL_MATCHES % {'journies': journies,
                                                       'remove_link': remove_link}

                message = Message()
                message.set_payload(message_text)
                delivery.send(config.FROM_ADDR, [search['email'],], message)
                transaction.commit()
            time.sleep(20)
Esempio n. 4
0
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Samsok is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

import cgi  
import cgitb

from html import HTMLwriter
from search import performSearch
        

cgitb.enable()     
HTMLmachine = HTMLwriter()
HTMLmachine.startBasicPage()
HTMLmachine.outputSearchbox()
storage = []
form = cgi.FieldStorage()

if "search" in form:
    performSearch(form['search'].value, HTMLmachine)

HTMLmachine.closeBasicPage()
Esempio n. 5
0
#    You should have received a copy of the GNU General Public License
#    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

import cgi
import cgitb
cgitb.enable()

# First off, modify the path to allow any locally installed packages
import config
import sys
import os
import json
for folder in json.loads(
        config.parser.get(config.defaultSection, 'localLibFolders')):
    sys.path.append(os.path.abspath(folder))

from html import HTMLwriter
from search import performSearch

if __name__ == '__main__':
    HTMLmachine = HTMLwriter()
    HTMLmachine.startBasicPage()
    HTMLmachine.outputSearchbox()
    storage = []
    form = cgi.FieldStorage()

    if "search" in form:
        performSearch(form['search'].value, HTMLmachine)

    HTMLmachine.closeBasicPage()