Skip to content

Latest commit

 

History

History
64 lines (59 loc) · 2.31 KB

CONTRIBUTION.md

File metadata and controls

64 lines (59 loc) · 2.31 KB

Contributing to plugin

Adding columns

You can add your own columns with information of your choice.

  1. Include a column within COLUMN_DEFINITIONS dict on top of the script.
    • Choose a name, label and description, all three are required.
    • Remember the name
  2. Determine the mime_type of the type of files, if it is a new one.
    mimetype <file>
  3. Start a new section with a nice header, e.g.
    ################
    # pdf handling #
    ################
    
  4. Add an if-clause within update_file_info for the new mime-type, or continue with an existing one, e.g.
    if file.is_mime_type('application/pdf'):
  5. Always start a try-except for a new block, so when an exception occurs in this new part, it will not break the functionality of the rest.
  6. Prefer to use with open(filename) as variablename: when opening the file.
  7. Create a new object.
  8. Map values from the new object to file using one of the mapping methods. The most generic one is map_any
    map_any(file, bbox, 'height', f=lambda b: self.points_from_bbox(b, 1), c=self.points_to_mm)
    See the javadoc for more information.
  9. Include a test within test_bsc_v2.py
    • Add a file under test/resources
    • Extend the parameterized test with the new resource. e.g.
      ['audio-MP3', 'resources/gs-16b-2c-44100hz.mp3', 'audio/mpeg', {'title': 'Galway', 'artist': 'Kevin MacLeod'}],
      • The first parameter is just the test name, you can type there whatever you want.
      • The second is the relative path to the resource
      • The third is the mime-type of the file.
  10. Run the test.
  11. If all is green...profit!

Generate language/translation files

  • Create a language template file messages.pot with
    pygettext3 bsc_v2.py
  • Install gettext if you do not have it installed
    sudo apt install gettext
  • Then update existing translations with
    msgmerge message.pot <LANG>.po
  • Create a new translation file with
    msginit -i messages.pot -l <LANG>

Interesting reads