Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add _fill_with_ template notation to picture loader #4287

Merged
merged 1 commit into from
Apr 2, 2021

Conversation

ebbit1q
Copy link
Member

@ebbit1q ebbit1q commented Mar 18, 2021

Related Ticket(s)

Short roundup of the initial problem

sometimes you want to add leading zeroes to values

What will change with this Pull Request?

  • all !prop:! and !set:! notations can now end with _fill_with_ and then a value to fill with.
  • filling is always done with the text right aligned
  • if a value is longer than the fill target the url is skipped and a message is displayed in the log

Examples

using the url testurl!set:num_fill_with_000!and!prop:maintype_fill_with_________!compare!set:num!
output:

PictureLoader: [card:  "Air Elemental"  set:  "LEA" ]: Trying to load picture
PictureLoader: [card:  "Air Elemental"  set:  "LEA" ]: Picture not found on disk, trying to download
PictureLoader: [card:  "Air Elemental"  set:  "LEA" ]: Trying to download picture from url: "testurl046andCreaturecompare46"
PictureLoader: [card:  "Air Elemental"  set:  "LEA" ]:  Download failed: "Protocol \"\" is unknown"
PictureLoader: [card:  "Air Elemental"  set:  "LEA" ]: Possible picture at  "testurl046andCreaturecompare46"  could not be loaded
...
PictureLoader: [card:  "Bad Moon"  set:  "LEA" ]: Requested property ( "maintype" ) for Url template ( "testurl!set:num_fill_with_000!and!prop:maintype_fill_with_________!compare!set:num!" ) is longer than fill specification ( "________" )
...
PictureLoader: [card:  "Badlands"  set:  "LEA" ]: Trying to load picture
PictureLoader: [card:  "Badlands"  set:  "LEA" ]: Picture not found on disk, trying to download
PictureLoader: [card:  "Badlands"  set:  "LEA" ]: Trying to download picture from url: "testurl277and____Landcompare277"
PictureLoader: [card:  "Badlands"  set:  "LEA" ]:  Download failed: "Protocol \"\" is unknown"
PictureLoader: [card:  "Badlands"  set:  "LEA" ]: Possible picture at  "testurl277and____Landcompare277"  could not be loaded

while this isn't a valid url it outputs the result in the error message, showing it works as expected.

@ZeldaZach ZeldaZach merged commit 7d1f082 into Cockatrice:master Apr 2, 2021
@ebbit1q ebbit1q deleted the add_zfill_num branch April 10, 2021 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reference Point Collector Number with filling zeros
2 participants