示例#1
0
class File(PropertySet):
    reference = Property()
    revision = Property(int, name='_rev')
    url = Property(name='_id')
    mime_type = Property()
    status = Property(enum=FileStatus)

    @property
    def parsed_url(self):
        return urlparse(self.url)
示例#2
0
文件: config.py 项目: eblade/images7
class JobConfig(PropertySet):
    name = Property()
    settings = Property(wrap=True)

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.name = query.netloc
        inst.settings = get_schema(get_schema_name(inst.name))()
        for key, value in parse_qsl(query.query):
            setattr(inst.settings, key, value)
        return inst
示例#3
0
文件: config.py 项目: eblade/images7
class SystemConfig(PropertySet):
    name = Property()
    full_name = Property()

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.name = query.netloc
        for key, value in parse_qsl(query.query):
            if key == 'mount_root': value = get_path(value)
            setattr(inst, key, value)
        return inst
示例#4
0
文件: config.py 项目: eblade/images7
class DatabaseConfig(PropertySet):
    server = Property()
    path = Property()

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.server = query.netloc
        inst.path = get_path(query.path)
        for key, value in parse_qsl(query.query):
            setattr(inst, key, value)
        return inst
示例#5
0
文件: config.py 项目: eblade/images7
class ServerConfig(PropertySet):
    hostname = Property()
    mount_root = Property()
    workers = Property(int)

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.hostname = query.netloc
        for key, value in parse_qsl(query.query):
            setattr(inst, key, value)
        return inst
示例#6
0
文件: config.py 项目: eblade/images7
class ZeroMQConfig(PropertySet):
    server = Property()
    interface = Property(default='localhost')
    port = Property(int, default=5555)

    @classmethod
    def FromUrl(cls, query):
        print(query)
        inst = cls()
        inst.server = query.netloc
        for key, value in parse_qsl(query.query):
            setattr(inst, key, value)
        return inst
示例#7
0
文件: config.py 项目: eblade/images7
class HttpConfig(PropertySet):
    server = Property()
    interface = Property(default='localhost')
    port = Property(int, default=8080)
    adapter = Property(default='cheroot')
    debug = Property(bool, default=False)

    @classmethod
    def FromUrl(cls, query):
        print(query)
        inst = cls()
        inst.server = query.netloc
        for key, value in parse_qsl(query.query):
            setattr(inst, key, value)
        return inst
示例#8
0
文件: config.py 项目: eblade/images7
class ExportConfig(PropertySet):
    server = Property()
    path = Property()
    name = Property()
    filename = Property()
    longest_sise = Property(int)

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.server = query.netloc
        inst.path = get_path(query.path)
        for key, value in parse_qsl(query.query):
            setattr(inst, key, value)
        return inst
示例#9
0
文件: entry.py 项目: eblade/images7
class DefaultEntryMetadata(PropertySet):
    title = Property()
    description = Property()
    author = Property()
    copyright = Property()
    source = Property()
    original_filename = Property()
    taken_ts = Property()
    orientation = Property()
    mirror = Property()
    angle = Property(int, default=0)

    def merge(self, other):
        for k, v in other.to_dict().items():
            if hasattr(self, k):
                setattr(self, k, v)
示例#10
0
文件: jpg.py 项目: eblade/images7
class JPEGExportOptions(PropertySet):
    entry_id = Property(int)
    entry_ids = Property(list)
    purpose = Property(enum=Purpose)
    version = Property(int)
    date = Property()
    longest_side = Property(int)
    folder = Property()
    filename = Property()
示例#11
0
文件: date.py 项目: eblade/images7
class DateStats(PropertySet):
    new = Property(int, none=0)
    pending = Property(int, none=0)
    keep = Property(int, none=0)
    purge = Property(int, none=0)
    todo = Property(int, none=0)
    wip = Property(int, none=0)
    final = Property(int, none=0)
    total = Property(int, none=0)
示例#12
0
文件: jpg.py 项目: eblade/images7
class JPEGImportOptions(PropertySet):
    entry_id = Property(int)
    source_path = Property()
    folder = Property()
    mime_type = Property()
    analyse = Property(bool)
    is_derivative = Property(bool, default=False)
    source_purpose = Property(enum=Purpose, default=Purpose.raw)
    source_version = Property(int)
示例#13
0
文件: entry.py 项目: eblade/images7
class EntryQuery(Query):
    prev_offset = Property(int)
    offset = Property(int, default=0)
    page_size = Property(int, default=25, required=True)
    date = Property()
    state = Property(enum=State)
    delta = Property(int, default=0)
    reverse = Property(bool, default=False)
示例#14
0
文件: flickr.py 项目: eblade/images7
class FlickrOptions(PropertySet):
    entry_id = Property(int)
    source_purpose = Property(enum=Purpose, default=Purpose.original)
    source_version = Property(int)
    title = Property()
    description = Property()
    tags = Property(list)
    is_public = Property(bool, default=True)
示例#15
0
文件: config.py 项目: eblade/images7
class CardConfig(PropertySet):
    name = Property()
    mode = Property(enum=ImportMode)
    remove_source = Property(bool)
    extension = Property(list)

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.name = query.netloc
        for key, value in parse_qsl(query.query):
            if key == 'extension': value = value.split()
            setattr(inst, key, value)
        return inst

    def get_part_url(self, part):
        return self.get_path_url(part.path)

    def get_path_url(self, path):
        return urlunparse(('card', self.name, path, None, None, None))
示例#16
0
文件: config.py 项目: eblade/images7
class StorageConfig(PropertySet):
    server = Property()
    root_path = Property()
    type = Property(enum=StorageType)

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.server = query.netloc
        inst.root_path = resolve_path(get_path(query.path))
        for key, value in parse_qsl(query.query):
            setattr(inst, key, value)
        return inst

    def get_file_url(self, absolute_path):
        logging.info('RELPATH %s %s', absolute_path,
                     os.path.abspath(self.root_path))
        return urlunparse(('local', self.server,
                           os.path.relpath(absolute_path,
                                           os.path.abspath(self.root_path)),
                           None, None, None))
示例#17
0
文件: entry.py 项目: eblade/images7
class EntryFeed(PropertySet):
    count = Property(int)
    total_count = Property(int)
    offset = Property(int)
    date = Property()
    state = Property(enum=State)
    entries = Property(Entry, is_list=True)
示例#18
0
class Job(PropertySet):
    current_step = Property(type=int, default=0)
    steps = Property(type=Step, is_list=True)
    status = Property(enum=JobStatus, default=JobStatus.new)

    def get_current_step(self) -> Step:
        return self.steps[self.current_step]

    def get_on_with_it(self):
        step = self.get_current_step()
        if step.status != StepStatus.done:
            self.status = JobStatus.failed
            step.status = StepStatus.failed
        else:
            self.current_step += 1
            if self.current_step < len(self.steps):
                self.status = JobStatus.running
            else:
                self.status = JobStatus.done

    def get_step(self, method) -> Step:
        return next(filter(lambda x: x.method == method, self.steps), None)
示例#19
0
文件: date.py 项目: eblade/images7
class DateQuery(PropertySet):
    year = Property(int)
    month = Property(int)
    reverse = Property(bool, default=False)

    @classmethod
    def FromRequest(self):
        q = DateQuery()

        if bottle.request.query.year not in (None, ''):
            q.year = bottle.request.query.year
        if bottle.request.query.month not in (None, ''):
            q.month = bottle.request.query.month
        if bottle.request.query.reverse not in (None, ''):
            q.reverse = (bottle.request.query.reverse == 'yes')

        return q

    def to_query_string(self):
        return urllib.parse.urlencode((
            ('year', str(self.year) or ''),
            ('month', str(self.month) or ''),
            ('reverse', 'yes' if self.reverse else 'no'),
        ))
示例#20
0
class RegisterPart(PropertySet):
    server = Property()
    source = Property()
    root_path = Property()
    path = Property()
    is_raw = Property(bool)
    mime_type = Property()

    def get_url(self, system):
        source = system.config.get_source_by_name(self.source)
        assert source is not None, "Source with name %s not found" % self.source
        return source.get_part_url(self)
示例#21
0
文件: config.py 项目: eblade/images7
class DropConfig(PropertySet):
    name = Property()
    server = Property()
    path = Property()
    mode = Property(enum=ImportMode)
    remove_source = Property(bool)
    extension = Property(list)

    @classmethod
    def FromUrl(cls, query):
        inst = cls()
        inst.server = query.netloc
        inst.path = get_path(query.path)
        for key, value in parse_qsl(query.query):
            if key == 'extension': value = value.split()
            setattr(inst, key, value)
        return inst

    def get_part_url(self, part):
        return urlunparse(
            ('local', self.server, os.path.join(self.path,
                                                part.path), None, None, None))
示例#22
0
文件: raw.py 项目: eblade/images7
class RawImportOptions(PropertySet):
    entry_id = Property(int)
    source_path = Property()
    folder = Property()
    mime_type = Property()
示例#23
0
class TransferOptions(PropertySet):
    entry_id = Property()
    source_url = Property()
    source_root_path = Property()
    destination = Property()
    steps = Property(type=list)
示例#24
0
文件: to_cut.py 项目: eblade/images7
class ToCutResult(PropertySet):
    path = Property()
示例#25
0
文件: raw.py 项目: eblade/images7
class RawFetchOptions(PropertySet):
    entry_id = Property(int)
示例#26
0
文件: to_cut.py 项目: eblade/images7
class ToCutOptions(PropertySet):
    source_root_path = Property()
    source_url = Property()
示例#27
0
class ReadMetadataResult(PropertySet):
    metadata = Property(wrap=True)
示例#28
0
class ReadMetadataOptions(PropertySet):
    path = Property()
    mime_type = Property()
    entry_id = Property()
示例#29
0
class CalculateHashResult(PropertySet):
    calculated_hash = Property()
示例#30
0
class CalculateHashOptions(PropertySet):
    path = Property()