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
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
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
csv2ir is a script to convert ir .csv files to .ir files for the flipper.

csv2ir csv2ir is a script to convert ir .csv files to .ir files for the flipper. For a repo of .ir files, please see https://github.com/logickworkshop

Alex 38 Dec 31, 2022
A bot discord that can create directories, file, rename, move, navigate throw directories etc....

File Manager Discord What is the purpose of this program ? This program is made for a Discord bot. Its purpose is to organize the messages sent in a c

1 Feb 02, 2022
A Python library that provides basic functions to read / write Aseprite format files

A Python library that provides basic functions to read / write Aseprite format files

Joe Trewin 1 Jan 13, 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
This project is a set of programs that I use to create a README.md file.

🤖 codex-readme 📜 codex-readme What is it? This project is a set of programs that I use to create a README.md file. How does it work? It reads progra

Tom Dörr 224 Jan 07, 2023
Here is some Python code that allows you to read in SVG files and approximate their paths using a Fourier series.

Here is some Python code that allows you to read in SVG files and approximate their paths using a Fourier series. The Fourier series can be animated and visualized, the function can be output as a tw

Alexander 12 Jan 01, 2023
OneDriveExplorer - A command line and GUI based application for reconstructing the folder strucure of OneDrive from the UserCid.dat file

OneDriveExplorer - A command line and GUI based application for reconstructing the folder strucure of OneDrive from the UserCid.dat file

Brian Maloney 100 Dec 13, 2022
A python script to pull the transactions of an Algorand wallet and put them into a CSV file.

AlgoCSV A python script to pull the transactions of an Algorand wallet and put them into a CSV file. Dependancies: Requests Main features: Groups: Com

21 Jun 25, 2022
Object-oriented file system path manipulation

path (aka path pie, formerly path.py) implements path objects as first-class entities, allowing common operations on files to be invoked on those path

Jason R. Coombs 1k Dec 28, 2022
Annotate your Python requirements.txt file with summaries of each package.

Summarize Requirements 🐍 📜 Annotate your Python requirements.txt file with a short summary of each package. This tool: takes a Python requirements.t

Zeke Sikelianos 8 Apr 22, 2022
Simple archive format designed for quickly reading some files without extracting the entire archive

Simple archive format designed for quickly reading some files without extracting the entire archive

Jarred Sumner 336 Dec 30, 2022
Python module that parse power builder file (PBD) and analyze code

PowerBuilder-decompile Python module that parse power builder file (PBD) and analyze code (Incomplete) this tool is composed of: pbd_dump.py pbd file

Samy Sultan 8 Dec 15, 2022
organize - The file management automation tool

organize - The file management automation tool

Thomas Feldmann 1.5k Jan 01, 2023
This is a file deletion program that asks you for an extension of a file (.mp3, .pdf, .docx, etc.) to delete all of the files in a dir that have that extension.

FileBulk This is a file deletion program that asks you for an extension of a file (.mp3, .pdf, .docx, etc.) to delete all of the files in a dir that h

Enoc Mena 1 Jun 26, 2022
fast change directory with python and ruby

fcdir fast change directory with python and ruby run run python script , chose drirectoy and change your directory need you need python and ruby deskt

XCO 2 Jun 20, 2022
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
This python project contains a class FileProcessor which allows one to grab a file and get some meta data and header information from it

This python project contains a class FileProcessor which allows one to grab a file and get some meta data and header information from it. In the current state, it outputs a PrettyTable to txt file as

Joshua Wren 1 Nov 09, 2021
Various converters to convert value sets from CSV to JSON, etc.

ValueSet Converters Tools for converting value sets in different formats. Such as converting extensional value sets in CSV format to JSON format able

Health Open Terminology Ecosystem 4 Sep 08, 2022