Skip to content

Commit

Permalink
Switch from InDesign to Publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
Himura2la committed Sep 15, 2021
1 parent b6a5ae2 commit 9a3e079
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions etc/gen-image-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import re
import shutil

csv_path = r"D:\Clouds\YandexDisk\Fests\Yuki no Odori 10\design\Zad\zad_data.csv"
num_row = ''
target_csv_path = r"D:\Clouds\YandexDisk\Fests\Yuki no Odori 10\design\Zad\zad_data_img.csv"
csv_path = r"C:\Users\himura\Desktop\zad-data.csv"
num_row = 'file'
target_csv_path = r"C:\Users\himura\Desktop\zad-data-img.csv"

img_dir = r'D:\Events\Yuki no Odori 10\zad_img'
id_regex = re.compile(r'(\d{1,3})\.jpg')
img_dir = r'C:\Users\himura\Desktop\Fest\Images'
id_regex = re.compile(r'^(\d{1,3})')

empty_img_path = r'D:\Clouds\YandexDisk\Fests\Yuki no Odori 10\design\Zad\Yuno_2021-small.png'
empty_img_path = os.path.abspath(empty_img_path) if empty_img_path else ''
Expand All @@ -21,7 +21,7 @@
if not os.path.isdir(used_dir):
os.mkdir(used_dir)

with open(csv_path, 'r', encoding='utf-16') as f:
with open(csv_path, 'r', encoding='utf-8') as f:
reader = csv.reader(f)
head = reader.__next__()
data = {int(row[head.index(num_row)]): row for row in reader}
Expand Down Expand Up @@ -70,7 +70,7 @@
# from tabulate import tabulate
# print(tabulate(data))

with open(target_csv_path, 'w', encoding='utf-16', newline='') as f:
with open(target_csv_path, 'w', encoding='utf-8', newline='') as f:
w = csv.writer(f, delimiter=',', quotechar='"')
w.writerow(head + ["@img%d-path" % (i+1) for i in range(rows_added)] + ["no-img-warning"])
w.writerows(data)
12 changes: 6 additions & 6 deletions etc/zad_page_renamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
import csv


tracks_dir = r'D:\Clouds\YandexDisk\Fests\Yuki no Odori 10\Fest\Tracks'
tracks_filenames_num_regex = r'№(\d{1,3})'
tracks_dir = r'C:\Users\himura\Desktop\Fest\Tracks'
tracks_filenames_num_regex = r'^(.+?)\. '

pages_dir = r'D:\Clouds\YandexDisk\Fests\Yuki no Odori 10\design\Zad\zad'
pages_dir = r'C:\Users\himura\Desktop\Fest\zad-pages'
pages_filenames_page_regex = r'(\d{1,3})$'

page_to_num_csv = r"D:\Clouds\YandexDisk\Fests\Yuki no Odori 10\design\Zad\zad_data_img.csv"
page_col, num_col = 'page', ''
page_to_num_csv = r"C:\Users\himura\Desktop\zad-data-img.csv"
page_col, num_col = 'page', 'num'

no_op = bool(0)

src_files = os.listdir(tracks_dir)
num_to_name = {re.search(tracks_filenames_num_regex, name).group(1): name.rsplit('.', 1)[0] for name in src_files if re.search(tracks_filenames_num_regex, name)}

with open(page_to_num_csv, 'r', encoding='utf-16') as f:
with open(page_to_num_csv, 'r', encoding='utf-8') as f:
reader = csv.reader(f)
head = reader.__next__()
page_to_num = {row[head.index(page_col)]: row[head.index(num_col)] for row in reader if row}
Expand Down

0 comments on commit 9a3e079

Please sign in to comment.