mirror of
https://github.com/kemayo/leech
synced 2026-05-08 12:34:37 +02:00
Merge pull request #60 from ClaasJG/master
Stable seed generation for Sections
This commit is contained in:
commit
77cc334bcf
1 changed files with 5 additions and 4 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
import click
|
import click
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
import uuid
|
import uuid
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
|
@ -14,8 +15,9 @@ logger.addHandler(logging.NullHandler())
|
||||||
_sites = []
|
_sites = []
|
||||||
|
|
||||||
|
|
||||||
def _default_uuid_string(*args):
|
def _default_uuid_string(self):
|
||||||
return str(uuid.uuid4())
|
rd = random.Random(x=self.url)
|
||||||
|
return str(uuid.UUID(int=rd.getrandbits(8*16), version=4))
|
||||||
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
|
|
@ -23,7 +25,6 @@ class Chapter:
|
||||||
title = attr.ib()
|
title = attr.ib()
|
||||||
contents = attr.ib()
|
contents = attr.ib()
|
||||||
date = attr.ib(default=False)
|
date = attr.ib(default=False)
|
||||||
id = attr.ib(default=attr.Factory(_default_uuid_string), converter=str)
|
|
||||||
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
|
|
@ -32,7 +33,7 @@ class Section:
|
||||||
author = attr.ib()
|
author = attr.ib()
|
||||||
url = attr.ib()
|
url = attr.ib()
|
||||||
cover_url = attr.ib(default='')
|
cover_url = attr.ib(default='')
|
||||||
id = attr.ib(default=attr.Factory(_default_uuid_string), converter=str)
|
id = attr.ib(default=attr.Factory(_default_uuid_string, takes_self=True), converter=str)
|
||||||
contents = attr.ib(default=attr.Factory(list))
|
contents = attr.ib(default=attr.Factory(list))
|
||||||
footnotes = attr.ib(default=attr.Factory(list))
|
footnotes = attr.ib(default=attr.Factory(list))
|
||||||
summary = attr.ib(default='')
|
summary = attr.ib(default='')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue