scripts: Include os.path as osp in new-photo-post
This commit is contained in:
parent
22dbdceab3
commit
6db1174a21
1 changed files with 5 additions and 9 deletions
|
@ -1,24 +1,20 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
'''
|
|
||||||
New script.
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path as osp
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from PIL.ExifTags import TAGS
|
from PIL.ExifTags import TAGS
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from website.metadata import slugify
|
from erynwells_me.metadata import slugify
|
||||||
|
from erynwells_me.paths import content_path
|
||||||
|
|
||||||
|
|
||||||
PHOTOS_CONTENT_DIR = 'content/photos'
|
PHOTOS_CONTENT_DIR = osp.join(content_path(), 'photos')
|
||||||
|
|
||||||
|
|
||||||
def parse_args(argv, *a, **kw):
|
def parse_args(argv, *a, **kw):
|
||||||
|
@ -90,7 +86,7 @@ def main(argv):
|
||||||
elif args.title:
|
elif args.title:
|
||||||
name = slugify(args.title)
|
name = slugify(args.title)
|
||||||
else:
|
else:
|
||||||
name = os.path.splitext(os.path.basename(photo))[0]
|
name = osp.splitext(osp.basename(photo))[0]
|
||||||
|
|
||||||
post_path_year = os.path.join(PHOTOS_CONTENT_DIR, f'{year:04}', name)
|
post_path_year = os.path.join(PHOTOS_CONTENT_DIR, f'{year:04}', name)
|
||||||
post_path_year_month = os.path.join(PHOTOS_CONTENT_DIR, f'{year:04}', f'{month:02}', name)
|
post_path_year_month = os.path.join(PHOTOS_CONTENT_DIR, f'{year:04}', f'{month:02}', name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue