You can add your own columns with information of your choice.
- 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
- Determine the mime_type of the type of files, if it is a new one.
mimetype <file>
- Start a new section with a nice header, e.g.
################ # pdf handling # ################
- Add an if-clause within
update_file_info
for the newmime-type
, or continue with an existing one, e.g.if file.is_mime_type('application/pdf'):
- 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.
- Prefer to use
with open(filename) as variablename:
when opening the file. - Create a new object.
- Map values from the new object to
file
using one of the mapping methods. The most generic one ismap_any
See the javadoc for more information.map_any(file, bbox, 'height', f=lambda b: self.points_from_bbox(b, 1), c=self.points_to_mm)
- 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.
- Run the test.
- If all is green...profit!
- Create a language template file
messages.pot
withpygettext3 bsc_v2.py
- Install
gettext
if you do not have it installedsudo 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>