BOOTH宛先印刷用CSVから色々な便利なリストを作成してCSVで出力するプログラムです。

Overview

BOOTH注文リスト作成スクリプト

このPythonスクリプトは、BOOTHの「宛名印刷用CSV」から、

  • 未発送の注文
  • 今月の注文
  • 特定期間の注文

を抽出した上で、各注文を商品毎に一覧化したCSVとして出力するスクリプトです。

簡単な使い方

ダウンロード

通常は、Relaseから、booth_order_list.exe をダウンロードして使ってください。

実行

ダウンロードした booth_order_list.exe を宛名印刷用CSVファイルと同じフォルダに置いてください。

その後、宛名印刷用CSVファイルが置いてあるフォルダを開いた状態で、空いているところをShiftキーを押しながら右クリックして、「PowerShellウィンドをここで開く(S)」をクリックします。

青い画面(Powershell)が表示されたら、目的に応じて以下のコマンドを入力して下さい。

  • 未発送の注文のリストが欲しい時(booth_orders_unshipped.csv に出力されます)
    • booth_order_list.exe -f [宛名印刷用CSVファイルのファイル名] -o booth_orders_unshipped.csv -u
  • 今月の注文のリストが欲しい時(booth_orders_current.csv に出力されます)
    • booth_order_list.exe -f [宛名印刷用CSVファイルのファイル名] -o booth_orders_current.csv -c
  • 特定期間の注文のリストが欲しい時(booth_orders_range.csv に出力されます)
    • 例:2021年10月1日 ~ 2021年10月10日まで
    • booth_order_list.exe -f [宛名印刷用CSVファイルのファイル名] -o booth_orders_range.csv -r 2021-10-01 2021-10-10
    • 最後の 2021-10-01 2021-10-10 を、必要な期間に置き換えて入力してください。

何も表示されず、次の入力が出来る状態になったら出力完了です。フォルダを確認して下さい。

出力

出力されたCSVは、以下のような形式で表示されます。

注文番号 注文日時 注文の状態 (商品名A) (商品名B) ......
0123456 2021-10-01 12:10:14 支払済み 0 1 ...
0123476 2021-10-01 12:16:01 支払待ち 1 2 ...

商品名が書かれた列に記載の数字は、その注文で注文された商品の数量です。

このCSVファイルをExcelで開くことで、大量の注文があった際の注文リスト生成や、月ごとの商品毎の注文数の集計などが可能となります。

コマンドのオプションの説明

usage: booth_order_list.exe [-h] -f FILE -o OUTPUT [-u] [-c] [-r RANGE RANGE]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  BOOTHから出力された宛名印刷用CSVファイルのファイル名(必須)
  -o OUTPUT, --output OUTPUT
                        出力するCSVファイルのファイル名(必須)
  -u, --unshipped       未発送の注文のリストを出力
  -c, --current-month   今月の注文のリストを出力
  -r RANGE RANGE, --range RANGE RANGE
                        指定した期間の注文リストを出力(YYYY-MM-DD YYYY-MM-DDで指定)

ヘルプの表示

  • booth_order_list.exe -h
    • 上に記述したヘルプが表示されます。

リストの出力(標準)

  • booth_order_list.exe -f FILE -o OUTPUT
  • booth_order_list.exe --file FILE --output OUTPUT
    • FILEに指定したBOOTHの宛名印刷用CSVをこのプログラムで商品毎のリストに書き換えてOUTPUTに指定したファイルに出力します。
    • 上の -h オプションを付ける場合以外は -f FILE -o OUTPUTは必ず入力が必要です。

未発送の注文の出力

  • booth_order_list.exe -f FILE -o OUTPUT -u
  • booth_order_list.exe --file FILE --output OUTPUT --unshipped
    • FILEに指定したBOOTHの宛名印刷用CSVに書かれた注文のうち、現在の注文の状況が「支払待ち」か「支払済み」の注文(未発送の注文)だけ取り出し、商品毎のリストに書き換えてOUTPUTに指定したファイルに出力します。
    • 商品数の多い店舗で大量の注文が来たときに、わかりやすい注文リストが欲しい時に重宝します(作成者は当初これが欲しくて作りました)。

今月の注文の出力

  • booth_order_list.exe -f FILE -o OUTPUT -c
  • booth_order_list.exe --file FILE --output OUTPUT --current-month
    • FILEに指定したBOOTHの宛名印刷用CSVに書かれた注文のうち、今月の注文だけ抽出し(発送/未発送問わず)、商品毎のリストに書き換えてOUTPUTに指定したファイルに出力します。
    • 今月どの商品がどのくらい注文されたかリスト化したい際に重宝します。

特定期間の注文の出力

  • booth_order_list.exe -f FILE -o OUTPUT -r START_DATE END_DATE
  • booth_order_list.exe --file FILE --output OUTPUT --range START_DATE END_DATE
    • FILEに指定したBOOTHの宛名印刷用CSVに書かれた注文のうち、START_DATE から END_DATE の間に注文された商品のみ抽出し(発送/未発送問わず)、商品毎のリストに書き換えてOUTPUTに指定したファイルに出力します。
    • START_DATE及びEND_DATEは、"年-月-日"の形式で書きます(例:2021-01-04)
    • 「今月の注文の出力」の発展版です。

注意事項

このスクリプトはPixiv/BOOTH公式及び公認のスクリプトではございません。そのため、Pixiv/BOOTH側の仕様変更により、突然利用できなくなる場合がございます。予めご了承下さい。(その際は是非Issueを立てていただけると幸いです)

このプログラムは個人が作成した物です。このプログラムをダウンロード・実行等した事によって発生する一切の事象について制作者は一切の責任を負いかねます。

詳しい人向けの説明

以下、このスクリプトを使って色々なことをしたい、上級者向けの説明です。

Requirement (Tested environment)

  • Python 3.x
    • tested env
      • ubuntu 18.04 (Python 3.6.9)
      • Windows 10 x64 (Python 3.9.2)
    • cannot run python 2.x
  • Library: Standard library
    • os, csv, argparse, datetime, re

run

This script can run without build.

usage: booth_order_list.py [-h] -f FILE -o OUTPUT [-u] [-c] [-r RANGE RANGE]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  BOOTHから出力された宛名印刷用CSVファイルのファイル名(必須)
  -o OUTPUT, --output OUTPUT
                        出力するCSVファイルのファイル名(必須)
  -u, --unshipped       未発送の注文のリストを出力
  -c, --current-month   今月の注文のリストを出力
  -r RANGE RANGE, --range RANGE RANGE
                        指定した期間の注文リストを出力(YYYY-MM-DD YYYY-MM-DDで指定)

build

Build using "pyinstaller" in this repository release.

pyinstaller booth_order_list.py --onefile

作成者

  • 作成者: hinananoha
  • 所属: Ureshino Network Service
  • 連絡先: info[@]ureshino.dev / Twitter @hinananoha

License

The source code is licensed MIT.

Comments
  • CSV の行数チェックを見直した

    CSV の行数チェックを見直した

    目的

    行数チェックのロジックを見直した

    詳細

    not data のチェックで CSV ファイルの中身が空なのかをチェックしているが、これはそもそも行数が 15 行に足りていないということの特殊な条件を満たす場合の言い換えにすぎず、結局中身が空であれば仮定している CSV ファイルの構造としては不十分であるというエラーメッセージだけでユーザーにはわかると思われる。 したがって、空判定チェックを削除した。

    opened by moba1 2
  • 必要のないファイルチェックを削除した

    必要のないファイルチェックを削除した

    目的

    二重チェックしてしまってる部分を削除する

    原理

    • openr が指定されている場合はファイルが存在しなければ FileNotFoundError が raise されるため、事前に存在性チェックしている行を削除した。
    • デフォルトでは open にあたえられるモードは 'r' なので、 open に指定する必要はないのでモードは省略した
      • https://docs.python.org/ja/3/library/functions.html#open

    余談...

    スレッドを切ってないのであまり問題にはならないが、たとえばあるスレッド Ta がファイル A を削除し、もう1つ別のスレッド Tb がファイル A の存在性チェックを行ってから open するとすると、 Tb がファイルの存在チェックをした直後にスレッド Ta がファイル A を削除した場合、それに Tb は気付かずに open することとなって例外が発生することになる。 つまり、存在性チェックと open がアトミックな処理になってないので、結局ファイルの open には失敗しってしまうことになる。 これはわかりにくいバグのもとにもなるし、元々開けなければ例外が飛ぶため、ファイルが開けるかをそのままためして駄目ならば例外が飛んでくるというような設計にすると余計な存在性チェックもしなくてよくなる上に、コードの見通しも確保できる。

    参考

    result.txt

    opened by moba1 0
  • editorconfig を追加した

    editorconfig を追加した

    目的

    エディタ毎に設定を変更されるとファイルのスタイルが統一できなくなってしまう。 そこでメジャーなエディタであればサポートされている .editorconfig を追加し、細かいエディタの挙動を統一できるようにする。

    変更

    • 全てのファイル
      • 改行文字を LF に
      • 最終行をエディタ上で改行
      • 行の最終文字がスペースならばこれを削除
      • 文字セットは UTF-8 に
    • python ファイル
      • インデントのスタイルは4文字スペースに統一(pep8 でも 4文字スペースにすることが要求されている)
    • markdown ファイル
      • markdown はドキュメントのため、行の最終文字がスペースであっても意味がある場合があるため、行の最終文字のスペースは削除しないように
      • インデントのスタイルは 2 文字スペースが一般的と思われるので、それに統一
    opened by moba1 0
  • コマンドとして実行するモジュール形式に変更した

    コマンドとして実行するモジュール形式に変更した

    目的

    このファイルをそのままモジュールとして実行されることが期待されていると思われるため、モジュールとして import されたときに処理が走らないように変更を加えるのと、 main 関数を用意してこのスクリプトがモジュールとして import されることは期待されていないことを明示するようにした

    加えた変更

    • main 関数を用意して、モジュールの内容をそちらに移した
    • スタイルをPEP 8 に統一
      • 本来はよろしくないが、インデントがほぼ全ての行に含まれなければならなくなってファイル全体の変更が行われるため、この歳にスタイルを統一してしまっても blame も汚れず問題が少ないと思われる
    • モジュールとして読み込まれても実行されないように最終行に必要な記載を2行追加
    opened by moba1 0
  • 期間を指定する部分を改善した

    期間を指定する部分を改善した

    目的

    期間指定に -c-r という2つのオプションが存在してるのを統一したい

    詳細

    統一するにあたって、 -c-r を同一に扱えるフォーマットが必要となる。 そこで、 -r に JSON を指定できるようにして、これらを切り替えられるようにした。 現在は今月を意味する {"type": "current-month" } とある期間を表す {"type": "period", "begin": "YYYY-mm-dd", "end": "YYYY-mm-dd"} の2つのフォーマットを提供している。 つまり、 type プロパティに指定した種類によって JSON の内容を切り替えることで統一的にかつ柔軟に期間指定ができるようになった。

    period タイプの beginend の指定はオプショナルとしてある。 これによって「2020/12/10 以降」を抽出したり、「2020/10/01」までのデータを抽出できるようになった。

    注意事項

    これを含んだものをリリースする際は、後方互換性がなくなっているので v2.0.0 にバンプさせる必要がある

    opened by moba1 2
Releases(v1.0.0)
Owner
hinananoha
hinananoha
A Certificate renaming tool made for IEEE CS SBC, SJCE.

PDF Batch Renamer Made for IEEE CS SBC, SJCE How to use? Before using the python script, ensure that pytesseract, pdf2image, opencv and other supporti

Ashwin Kumar U 2 Nov 14, 2021
An easy-to-use library for emulating code in minidump files.

dumpulator Note: This is a work-in-progress prototype, please treat it as such. An easy-to-use library for emulating code in minidump files. Example T

Duncan Ogilvie 362 Dec 31, 2022
Find potentially sensitive files

find_files Find potentially sensitive files This script searchs for potentially sensitive files based off of file name or string contained in the file

4 Aug 20, 2022
ValveVMF - A python library to parse Valve's VMF files

ValveVMF ValveVMF is a Python library for parsing .vmf files for the Source Engi

pySourceSDK 2 Jan 02, 2022
CSV-Handler written in Python3

CSVHandler This code allows you to work intelligently with CSV files. A file in CSV syntax is converted into several lists, which are combined in a to

Max Tischberger 1 Jan 13, 2022
Nmap XML output to CSV and HTTP/HTTPS URLS.

xml-to-csv-url Convert NMAP's XML output to CSV file and print URL addresses for HTTP/HTTPS ports. NOTE: OS Version Parsing is not working properly ye

1 Dec 21, 2021
CredSweeper is a tool to detect credentials in any directories or files.

CredSweeper is a tool to detect credentials in any directories or files. CredSweeper could help users to detect unwanted exposure of credentials (such as personal information, token, passwords, api k

Samsung 54 Dec 13, 2022
A python module to parse text files with contains secret variables.

A python module to parse text files with contains secret variables.

0 Dec 05, 2022
Remove [x]_ from StudIP zip Archives and archive_filelist.csv completely

This tool removes the "[x]_" at the beginning of StudIP zip Archives. It also deletes the "archive_filelist.csv" file

Kelke vl 1 Jan 19, 2022
Powerful Python library for atomic file writes.

Powerful Python library for atomic file writes.

Markus Unterwaditzer 313 Oct 19, 2022
An universal file format tool kit. At present will handle the ico format problem.

An universal file format tool kit. At present will handle the ico format problem.

Sadam·Sadik 1 Dec 26, 2021
Python's Filesystem abstraction layer

PyFilesystem2 Python's Filesystem abstraction layer. Documentation Wiki API Documentation GitHub Repository Blog Introduction Think of PyFilesystem's

pyFilesystem 1.8k Jan 02, 2023
Organize the files into the relevant sub-folders

This program can be used to organize files in a directory by their file extension. And move duplicate files to a duplicates folder.

Thushara Thiwanka 2 Dec 15, 2021
🧹 Create symlinks for .m2ts files and classify them into directories in yyyy-mm format.

🧹 Create symlinks for .m2ts files and classify them into directories in yyyy-mm format.

Nep 2 Feb 07, 2022
PaddingZip - a tool that you can craft a zip file that contains the padding characters between the file content.

PaddingZip - a tool that you can craft a zip file that contains the padding characters between the file content.

phithon 53 Nov 07, 2022
A python script generate password files in plain text

KeePass (or any desktop pw manager?) Helper WARNING: This script will generate password files in plain text. ITS NOT SECURE. I needed help remembering

Eric Thomas 1 Nov 21, 2021
dotsend is a web application which helps you to upload your large files and share file via link

dotsend is a web application which helps you to upload your large files and share file via link

Devocoe 0 Dec 03, 2022
Two scripts help you to convert csv file to md file by template

Two scripts help you to convert csv file to md file by template. One help you generate multiple md files with different filenames from the first colume of csv file. Another can generate one md file w

2 Oct 15, 2022
ZipFly is a zip archive generator based on zipfile.py

ZipFly is a zip archive generator based on zipfile.py. It was created by Buzon.io to generate very large ZIP archives for immediate sending out to clients, or for writing large ZIP archives without m

Buzon 506 Jan 04, 2023
Simple addon to create folder structures in blender.

BlenderCreateFolderStructure Simple Add-on to create a folder structure in Blender. Installation Download BlenderCreateFolderStructure.py Open Blender

Dominik Strasser 2 Feb 21, 2022