Exemplo n.º 1
0
def main(argv):

    config = _config.Config()

    f = open('cookie.json', 'r')
    content = f.read()
    cjson = json.loads(content)
    f.close()

    config.headers['accept'] = cjson['cookie']['accept']
    config.headers['user-agent'] = cjson['cookie']['user-agent']
    config.headers['cookie'] = cjson['cookie']['cookie']

    opts, args = getopt.getopt(argv, '-h-l:-s:', [help])
    for opt_name, opt_val in opts:
        if opt_name in ('-h', '--help'):
            print('-l [url] -s [savefile]')
            sys.exit()
        if opt_name == '-l':
            config.url = opt_val
        if opt_name == '-s':
            config.filepath = opt_val

    if config.url == '':
        print("Please input url!")
        sys.exit()

    UrlTransform(config)
    #print(config.url)
    config = get.GetHtml(config)
    GetAllCollectins(config)
Exemplo n.º 2
0
    def __init__(self, job_factory):
        """Create a new one.

        job_factory - Must have from_dict(d) and from_file(path) methods
        that return a Job or subclass of Job (or None).
        """
        self.procname = sys.argv[0]
        self.job_factory = job_factory
        self.status = _status.Writer()
        self.log = logging.getLogger("voyager")
        self.config = _config.Config(self)
        self.jobtype = self.config.jobtype()
        self.context = None
        self._chatsock = None
        self._sigsock = None
        self._keepgoing = True
        self._stdin = _stdin.new()
        self._cmdbuffer = []
        self._vpid = None
Exemplo n.º 3
0
# encoding: utf-8
"""
store.py

imsto: core module

Created by liut on 2010-12-16.
Copyright (c) 2010 liut. All rights reserved.
"""

import re
import _config

config = _config.Config()


class ImSto:
    db = None

    def __init__(self):
        pass

    def browse(self, limit=20, start=0):
        """retrieve files from mongodb for gallery"""
        #return getFs().list()
        from pymongo import ASCENDING, DESCENDING
        sort = [('updateDate', DESCENDING)]
        coll = self.getCollection()
        cursor = coll.find(limit=limit, skip=start, sort=sort)
        items = []
        for item in cursor:
Exemplo n.º 4
0
import _paths

import os
import logging


if __name__ == "__main__":
    logging.getLogger("eyed3").setLevel(logging.CRITICAL) # hides the eyed3 console output

    root = os.path.dirname(os.path.realpath(__file__)) # filesystem path to this python file

    first_run = True # helps with the startup delay

    while True:
        log = _log.Log(root) # logs all program operations
        config = _config.Config(root) # main configuration file
        control = _control.Control(root) # controls the sync schedule
        email = _email.Email()  # email sent to the user, if asked

        if not config.load(log): # loads the main config file
            raise SystemExit # force close if an error occurred

        if not control.load(log): # loads the schedule file
            raise SystemExit # force close if an error occurred

        if first_run: # will sleep the startup delay if this is the first program loop
            first_run = False
            config.run_startup_delay(log)

        log.report("") # indentation of the log file
        for (dirpath, dirnames, filenames) in os.walk(os.path.join(root, _paths.syncs_folder)): # runs every sync found