2015-11-24 19:47:51 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2018-01-23 18:19:31 +01:00
|
|
|
# Copyright 2015-2018 Mike Fährmann
|
2015-11-24 19:47:51 +01:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
2017-02-01 00:53:19 +01:00
|
|
|
|
2015-11-24 19:47:51 +01:00
|
|
|
class Message():
|
2018-01-23 18:19:31 +01:00
|
|
|
"""Enum for message identifiers
|
|
|
|
|
|
|
|
Extractors yield their results as message-tuples, where the first element
|
|
|
|
is one of the following identifiers. This message-identifier determines
|
|
|
|
the type and meaning of the other elements in such a tuple.
|
|
|
|
|
|
|
|
- Message.Version:
|
|
|
|
- Message protocol version (currently always '1')
|
|
|
|
- 2nd element specifies the version of all following messages as integer
|
|
|
|
|
|
|
|
- Message.Directory:
|
|
|
|
- Sets the target directory for all following images
|
|
|
|
- 2nd element is a dictionary containing general metadata
|
|
|
|
|
|
|
|
- Message.Url:
|
|
|
|
- Image URL and its metadata
|
|
|
|
- 2nd element is the URL as a string
|
|
|
|
- 3rd element is a dictionary with image-specific metadata
|
|
|
|
|
|
|
|
- Message.Headers: # obsolete
|
|
|
|
- HTTP headers to use while downloading
|
|
|
|
- 2nd element is a dictionary with header-name and -value pairs
|
|
|
|
|
|
|
|
- Message.Cookies: # obsolete
|
|
|
|
- Cookies to use while downloading
|
|
|
|
- 2nd element is a dictionary with cookie-name and -value pairs
|
|
|
|
|
|
|
|
- Message.Queue:
|
|
|
|
- (External) URL that should be handled by another extractor
|
|
|
|
- 2nd element is the (external) URL as a string
|
|
|
|
- 3rd element is a dictionary containing URL-specific metadata
|
|
|
|
|
2020-10-16 01:09:55 +02:00
|
|
|
- Message.Urllist: # obsolete
|
2018-01-23 18:19:31 +01:00
|
|
|
- Same as Message.Url, but its 2nd element is a list of multiple URLs
|
|
|
|
- The additional URLs serve as a fallback if the primary one fails
|
|
|
|
"""
|
2015-11-24 19:47:51 +01:00
|
|
|
|
|
|
|
Version = 1
|
|
|
|
Directory = 2
|
|
|
|
Url = 3
|
2018-01-17 22:08:19 +01:00
|
|
|
# Headers = 4
|
|
|
|
# Cookies = 5
|
2015-11-26 22:55:11 +01:00
|
|
|
Queue = 6
|
2020-10-16 01:09:55 +02:00
|
|
|
# Urllist = 7
|
2019-12-09 07:56:27 +01:00
|
|
|
Metadata = 8
|