# Path: engine/conf.py
# PATH_TO_IMG = PATH + '/notes/'
# 
# PATH_TO_MD = PATH + '/notes/'
# 
# PATH_TO_ORIG = PATH + "/engine/data/orig/"


import re
import os
import random
import string
import logging
    import requests
from engine.conf import PATH_TO_IMG, PATH_TO_MD, PATH_TO_ORIG
    from bs4 import BeautifulSoup as bs
        elif '![#ps]' in l:
            fn = l.replace('![#ps](', '').replace(')', '').strip()
            cmd = " open -a 'Adobe Photoshop 2021.app' '%s/%s'" % (PATH_TO_MD, fn)
            logger.info('open Adobe PS image %s', cmd)
            os.system(cmd)
            changed = True
            ntext += l.replace('#ps', '') + '\n'

        elif '![#fork]' in l or '![#f]' in l: # ![](imgs/210209-14:02:20.916512_146566355_244096550673487_436531621545580684_n.png)
            fn = l.replace('![#fork](', '').replace(')', '').strip()
            # # printing letters
            letters = string.ascii_letters
            hash = ''.join(random.choice(letters) for i in range(5)) # hash like ;-)
            nfn = os.path.splitext(fn)[0] + '_fork_' + hash + os.path.splitext(fn)[1]
            cmd = "cp -v '%s/%s' '%s/%s'" % (PATH_TO_MD, fn, PATH_TO_MD, nfn)
            logger.info('%s', cmd)
            os.system(cmd)

            cmd = "open '%s/%s'" % (PATH_TO_MD, nfn)
            logger.info('open image %s', cmd)
            os.system(cmd)

            changed = True
            ntext += l.replace('#fork', '').replace(fn, nfn) + '\n'

        elif '![#dark]' in l or '![#dark]' in l: # ![](imgs/210209-14:02:20.916512_146566355_244096550673487_436531621545580684_n.png)
            fn = l.replace('![#dark](', '').replace(')', '').strip()
            #  $f  ${f}.jpeg
            nfn = fn + '.DARK.jpeg'
            # convert $f  /tmp/invtemp

# Path: engine/conf.py
# PATH_TO_IMG = PATH + '/notes/'
# 
# PATH_TO_MD = PATH + '/notes/'
# 
# PATH_TO_ORIG = PATH + "/engine/data/orig/"


# Path: engine/process_md.py
import re
import os
import random
import string
import logging
    import requests
from engine.conf import PATH_TO_IMG, PATH_TO_MD, PATH_TO_ORIG
    from bs4 import BeautifulSoup as bs

        elif '![#ps]' in l:
            fn = l.replace('![#ps](', '').replace(')', '').strip()
            cmd = " open -a 'Adobe Photoshop 2021.app' '%s/%s'" % (PATH_TO_MD, fn)
            logger.info('open Adobe PS image %s', cmd)
            os.system(cmd)
            changed = True
            ntext += l.replace('#ps', '') + '\n'

        elif '![#fork]' in l or '![#f]' in l: # ![](imgs/210209-14:02:20.916512_146566355_244096550673487_436531621545580684_n.png)
            fn = l.replace('![#fork](', '').replace(')', '').strip()
            # # printing letters
            letters = string.ascii_letters
            hash = ''.join(random.choice(letters) for i in range(5)) # hash like ;-)
            nfn = os.path.splitext(fn)[0] + '_fork_' + hash + os.path.splitext(fn)[1]
            cmd = "cp -v '%s/%s' '%s/%s'" % (PATH_TO_MD, fn, PATH_TO_MD, nfn)
            logger.info('%s', cmd)
            os.system(cmd)

            cmd = "open '%s/%s'" % (PATH_TO_MD, nfn)
            logger.info('open image %s', cmd)
            os.system(cmd)

            changed = True
            ntext += l.replace('#fork', '').replace(fn, nfn) + '\n'

        elif '![#dark]' in l or '![#dark]' in l: # ![](imgs/210209-14:02:20.916512_146566355_244096550673487_436531621545580684_n.png)
            fn = l.replace('![#dark](', '').replace(')', '').strip()
            #  $f  ${f}.jpeg
            nfn = fn + '.DARK.jpeg'
            # convert $f  /tmp/invtemp

            cmd = "convert '%s/%s' -channel RGB -negate '%s/%s'" % (PATH_TO_MD, fn, PATH_TO_MD, nfn)