frozenpandaman / s3s

Successor to splatnet2statink. Takes battle data from the SplatNet 3 app and uploads it to stat.ink!
https://github.com/frozenpandaman/s3s/wiki
GNU General Public License v3.0
403 stars 72 forks source link

Add directory argument with outfile option #107

Closed obreathe closed 1 year ago

obreathe commented 1 year ago

This PR adds directory argument with outfile option like [-o [DIR]]. If DIR is omitted, the current directory will be used.

frozenpandaman commented 1 year ago

Thanks for the PR @obreathe! Can I ask what your use case for that is? I'm trying to prevent clogging up the command line arguments too much… but this is a relatively small change, too.

Do you want the folder to be something other than export-TIMESTAMP/? (Why?) Or do you want the export folder to get placed in a different parent directory (you can achieve this by running s3s from any folder) – or what exactly?

-o isn't used much by users and isn't even officially documented, since stat.ink supports all types of battles to be uploaded, so I just wanted some more background on this to help me understand. Thanks!

obreathe commented 1 year ago

@frozenpandaman This change specifies the parent folder of the output destination (and export-TIMESTAMP stays the same). My use case is running s3s by the daemon launchd on macOS to automate registration to stat.ink and saving to local as a raw backup. So I made it possible to specify the destination by absolute path.

This argument seems somewhat generic, and I hope it will help others with similar case. However, I'm sure it's a rare use case, so feel free to reject if it's unneeded :) Thank you for your review.

frozenpandaman commented 1 year ago

Thanks @obreathe! Makes sense. It seems you don't want to change the export directory name (e.g. export-1677312335/) but just where it's located on your computer, i.e. not in the s3s/ directory. For example, instead of ~/path/to/s3s/ you would like the export to be located in ~/Documents/splatnet_backups/ if I'm understanding correctly?

-o creates export folders in the working directory, so you could always run s3s from a different location to start, e.g. Instead of

$ cd ~/path/to/s3s/
$ python s3s.py -o

you could run

$ cd ~/Documents/splatnet_backups/
$ python ~/path/to/s3s/s3s.py -o

Let me know if that solves your issue, or if you still need this added.

obreathe commented 1 year ago

@frozenpandaman Thanks to you, I have a solution! In my case, launchd could not cd, but I found the WorkingDirectory configuration key that launchd has. (I missed this key and took a detour...)

Sorry for my carelessness, thank you for your kindly advice. I will close this PR as it is unnecessary.

frozenpandaman commented 1 year ago

@obreathe No worries, I'm glad you found a solution!! I'm open to adding/revisiting this in the future if there's a need. I use macOS as well, but haven't ever used launchd 😅

Note that the export/output format has changed with v0.3.2, released today. Instead of exporting to individual directories (export-TIMESTAMP/...), creating brand new files every time & having all battle info in a single (large) file, exports are now made to the exports/ directory, and each battle/job is its own timestamped JSON file. When -o is run again this directory is then updated with the new files.