Project to automate uploading to phillipian.net
Run local_preprocess.py from a local machine with access to the week's photos to compress images, fetch filtered articles, and prepend image info/author name to the beginning of each article. Those files will be scp-ed to the server. Then run remote_upload.py to read the info from the article text files and call the necessary wordpress commands to actually upload.
-
The current script does not support uploading spreads, editorial, eighth page, and multilingual
-
Article Google Docs
- Article text will appear as it does in the doc, so please place the final article back on the doc if changes are made
- Add BOF and EOF markers in article doc (‘BOFCXLII’, ‘EOFCXLII’) (the doc must be the final version of the article)
-
All photos/illustrations should be in the digital directory. Also, folder names on the path have to be standardized, sorry!
-
Filling out the budget
- Use these fields: 'Headline' (for sports, make sure the team name is somewhere in there)
- New fields: 'Link' (explicit link to Google doc), 'Upload?' ('yes'/'no'; whether article is ready for upload), 'Featured?' (whether article is featured), and 'ImageDir' (image directory within the digital folder)
- Photo: 'Caption', 'Photographer' (for credit), 'ImageDir' (should match ImageDir from writing section)
- All photos/illustrations should also be on the budget (including ones that are pulled), with their photographer information so they can be properly fetched, captioned, and credited
-
Check and publish all posts (the script will make them drafts)
-
Docker:
- docker create -it --name container upload_container
- docker cp /Volumes/Phillipian/Phillipian/Spring-2019/4-12/digital/ container:/imgs
- docker start container
- docker exec -it container /bin/bash
- To check status, use Kitematic (if you are Alex) and use docker ps -a (if you are not)
- Fetch budget data using drive CLI
- Extract article text from slug column using drive CLI
- Post to the website us wp post create -(parameters) (see here)
- Fetch and resize images from file directory
- Add downloaded images to uploaded article using this command
- python, pandas, numpy, pillow (obviously)
- wordpress, wp cli
- google drive API (currently using [email protected] credentials)
- gspread
- pytesseract
- unidecode
-
Section specified via wp-post cli function argument
-
Fill in:
- Author from article
- Title from headline
- Date from current time
-
Content imported from google docs
-
Use uploaded post id to add photos
- This command attaches an image for post 1:
wp media import <file or url> --title='Something' --post_id=1
- Set the
--featured-image
flag to set the post thumbnail displayed on the homepage (default to setting the flag on the first image)