diff options
| author | la-ninpre <leobrekalini@gmail.com> | 2020-12-10 20:28:18 +0300 |
|---|---|---|
| committer | la-ninpre <leobrekalini@gmail.com> | 2020-12-10 20:28:18 +0300 |
| commit | ed3ce881738148ce67b077377991ecc6f65015df (patch) | |
| tree | 76bbd758ce04fb923f5f3c2318f79aeda6b163b8 | |
| parent | 4c57d96e545b73e0423566f22695179f58341abf (diff) | |
| download | tg2md-ed3ce881738148ce67b077377991ecc6f65015df.tar.gz tg2md-ed3ce881738148ce67b077377991ecc6f65015df.zip | |
update readme
oops, forgot to change name of script there
| -rw-r--r-- | README.md | 23 | ||||
| -rw-r--r-- | tg2md.py | 6 |
2 files changed, 15 insertions, 14 deletions
@@ -19,25 +19,28 @@ only photos, voice messages and audio files. In format menu you should specify 'Machine-readable JSON' file and then locate to directory of your desire. -To convert your posts to markdown files you need to copy `parse.py` file into -your export folder and run it there. +To convert your posts to markdown files you need to run `tg2md.py` program +which takes path to your `result.json` file as first argument. ```console -$ cp parse.py /path/to/export/dir -$ cd /path/to/export/dir -$ python parse.py +$ python tg2md.py path/to/result.json ``` -Currently there's no way to change name of ouput folder other than directly -editing the script. By default it's creating directory `formatted_posts` with -markdown files in there. +By default it will create `formatted_posts` directory in your current directory +and populate it with markdown files. If you want to specify other location, +use `--out-dir` flag + +```console +$ python tg2md.py result.json --out-dir path/to/post/output +``` Also if your jekyll directory storing media files in folders other than `photos` -and `files`, you should change `photo_dir` and `media_dir` variables. +and `files`, you should specify their location with `--photo-dir` and +`--media-dir` flags respectively. Note that they only change links in the +markdown files. ## todo's -- use argparse module instead of crap - replies - single/muliple tags - forwarded posts @@ -10,14 +10,13 @@ # - custom post header import os -import sys import argparse import json from datetime import datetime - def print_default_post_header(post_title, post_date, post_tag): + ''' returns default post header ''' @@ -259,8 +258,7 @@ def main(): with open(post_path, 'w') as f: print(print_default_post_header( - post_id, post_date, None), - file=f) + post_id, post_date, None), file=f) print(parse_post(post, args.photo_dir, args.media_dir), file=f) |
