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 platform independent file lock for Python

py-filelock This package contains a single module, which implements a platform independent file lock in Python, which provides a simple way of inter-p

Benedikt Schmitt 497 Jan 05, 2023
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
useful files for the Freenove Big Hexapod

FreenoveBigHexapod useful files for the Freenove Big Hexapod HexaDogPos is a utility for converting the Freenove xyz co-ordinate system to servo angle

Alex 2 May 28, 2022
Add Ranges and page numbers to IIIF Manifest from a CSV.

Add Ranges and page numbers to IIIF Manifest from CSV specific to a workflow of the Bibliotheca Hertziana.

Raffaele Viglianti 3 Apr 28, 2022
FUSE filesystem Python scripts for Nintendo console files

ninfs (formerly fuse-3ds) is a FUSE program to extract data from Nintendo game consoles. It works by presenting a virtual filesystem with the contents of your games, NAND, or SD card contents, and yo

Ian Burgwin 343 Jan 02, 2023
Vericopy - This Python script provides various usage modes for secure local file copying and hashing.

Vericopy This Python script provides various usage modes for secure local file copying and hashing. Hash data is captured and logged for paths before

15 Nov 05, 2022
PyDeleter - delete a specifically formatted file in a directory or delete all other files

PyDeleter If you want to delete a specifically formatted file in a directory or delete all other files, PyDeleter does it for you. How to use? 1- Down

Amirabbas Motamedi 1 Jan 30, 2022
Convert CSV files into a SQLite database

csvs-to-sqlite Convert CSV files into a SQLite database. Browse and publish that SQLite database with Datasette. Basic usage: csvs-to-sqlite myfile.cs

Simon Willison 731 Dec 27, 2022
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
Swiss army knife for Apple's .tbd file manipulation

Description Inspired by tbdswizzler, this simple python tool for manipulating Apple's .tbd format. Installation python3 -m pip install --user -U pytbd

10 Aug 31, 2022
Maltego transforms to pivot between PE files based on their VirusTotal codeblocks

VirusTotal Codeblocks Maltego Transforms Introduction These Maltego transforms allow you to pivot between different PE files based on codeblocks they

Ariel Jungheit 18 Feb 03, 2022
File storage with API access. Used as a part of the Swipio project

API File storage File storage with API access. Used as a part of the Swipio project 📝 About The Project File storage allows you to upload and downloa

25 Sep 17, 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
Get Your TXT File Length !.

TXTLen Get Your TXT File Length !. Hi 👋 , I'm Alireza A Python Developer Boy 🔭 I’m currently working on my C# projects 🌱 I’m currently Learning CSh

Alireza Hasanzadeh 1 Jan 06, 2022
A simple library for temporary storage of small files

TemporaryStorage An simple library for temporary storage of small files. Navigation Install Usage In Python console As a standalone application List o

2 Apr 17, 2022
Creates folders into a directory to categorize files in that directory by file extensions and move all things from sub-directories to current directory.

Categorize and Uncategorize Your Folders Table of Content TL;DR just take me to how to install. What are Extension Categorizer and Folder Dumper Insta

Furkan Baytekin 1 Oct 17, 2021
Media file renamer and organizion tool

mnamer mnamer (media renamer) is an intelligent and highly configurable media organization utility. It parses media filenames for metadata, searches t

Jessy Williams 533 Dec 29, 2022
Python library for reading and writing tabular data via streams.

tabulator-py A library for reading and writing tabular data (csv/xls/json/etc). [Important Notice] We have released Frictionless Framework. This frame

Frictionless Data 231 Dec 09, 2022
pytiff is a lightweight library for reading chunks from a tiff file

pytiff is a lightweight library for reading chunks from a tiff file. While it supports other formats to some extend, it is focused on reading tiled greyscale/rgb images, that can also be bigtiffs. Wr

Big Data Analytics group 9 Mar 21, 2022
A simple bulk file renamer, written in python.

Python File Editor A simple bulk file renamer, written in python. There are two functions, the bulk rename and the bulk file extention change. Bulk Fi

Sam Bloomfield 2 Dec 22, 2021