Adapt takeout and twitter configs to the new pattern
Works fairly well so far?
This commit is contained in:
parent
8cbbafae1d
commit
e92ca215e3
4 changed files with 45 additions and 23 deletions
|
@ -1,24 +1,35 @@
|
|||
"""
|
||||
Twitter data (tweets and favorites). Uses [[https://github.com/twintproject/twint][Twint]] data export.
|
||||
Twitter data (tweets and favorites).
|
||||
"""
|
||||
|
||||
from ..core.common import Paths
|
||||
from dataclasses import dataclass
|
||||
from my.config import twint as user_config
|
||||
|
||||
@dataclass
|
||||
class twitter(user_config):
|
||||
'''
|
||||
Uses [[https://github.com/twintproject/twint][Twint]] data export.
|
||||
'''
|
||||
export_path: Paths # path[s]/glob to twint Sqlite database
|
||||
|
||||
|
||||
from ..core.cfg import make_config
|
||||
config = make_config(twitter)
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import NamedTuple, Iterable, List
|
||||
from pathlib import Path
|
||||
|
||||
from ..common import PathIsh, get_files, LazyLogger, Json
|
||||
from ..core.common import get_files, LazyLogger, Json
|
||||
from ..core.time import abbr_to_timezone
|
||||
|
||||
from my.config import twint as config
|
||||
|
||||
|
||||
log = LazyLogger(__name__)
|
||||
|
||||
|
||||
def get_db_path() -> Path:
|
||||
# TODO don't like the hardcoded extension. maybe, config should decide?
|
||||
# or, glob only applies to directories?
|
||||
return max(get_files(config.export_path, glob='*.db'))
|
||||
return max(get_files(config.export_path))
|
||||
|
||||
|
||||
class Tweet(NamedTuple):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue