redmine_apijs 6.8.2 → 6.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README +4 -4
  3. data/app/controllers/apijs_controller.rb +41 -41
  4. data/app/views/attachments/_links.html.erb +3 -3
  5. data/app/views/settings/_apijs.html.erb +5 -3
  6. data/assets/javascripts/apijs-redmine.js +6 -5
  7. data/assets/javascripts/apijs-redmine.min.js +1 -1
  8. data/assets/javascripts/apijs-redmine.min.js.map +1 -1
  9. data/assets/javascripts/apijs.min.js +2 -2
  10. data/assets/javascripts/apijs.min.js.map +1 -1
  11. data/assets/stylesheets/apijs-print.min.css +1 -1
  12. data/assets/stylesheets/apijs-print.min.css.map +1 -1
  13. data/assets/stylesheets/apijs-screen-rtl.min.css +2 -2
  14. data/assets/stylesheets/apijs-screen-rtl.min.css.map +1 -1
  15. data/assets/stylesheets/apijs-screen.min.css +2 -2
  16. data/assets/stylesheets/apijs-screen.min.css.map +1 -1
  17. data/config/locales/cs.yml +1 -1
  18. data/config/locales/de.yml +1 -1
  19. data/config/locales/el.yml +1 -1
  20. data/config/locales/es.yml +1 -1
  21. data/config/locales/hu.yml +1 -1
  22. data/config/locales/it.yml +1 -1
  23. data/config/locales/ja.yml +1 -1
  24. data/config/locales/nl.yml +1 -1
  25. data/config/locales/pl.yml +1 -1
  26. data/config/locales/pt-BR.yml +1 -1
  27. data/config/locales/pt.yml +1 -1
  28. data/config/locales/ro.yml +1 -1
  29. data/config/locales/ru.yml +1 -1
  30. data/config/locales/sk.yml +1 -1
  31. data/config/locales/tr.yml +15 -15
  32. data/config/locales/uk.yml +1 -1
  33. data/config/locales/zh.yml +1 -1
  34. data/init.rb +27 -7
  35. data/lib/apijs_attachment.rb +3 -3
  36. data/lib/image.py +119 -19
  37. data/lib/redmine_apijs.rb +34 -11
  38. data/lib/useragentparser.rb +9 -9
  39. data/redmine_apijs.gemspec +2 -4
  40. metadata +5 -6
  41. data/lib/apijs_const.rb +0 -35
  42. data/lib/video.py +0 -80
data/lib/video.py DELETED
@@ -1,80 +0,0 @@
1
- #!/usr/bin/python3
2
- # -*- coding: utf8 -*-
3
- # Created J/26/12/2013
4
- # Updated W/16/12/2020
5
- #
6
- # Copyright 2008-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
7
- # https://www.luigifab.fr/redmine/apijs
8
- #
9
- # This program is free software, you can redistribute it or modify
10
- # it under the terms of the GNU General Public License (GPL) as published
11
- # by the free software foundation, either version 2 of the license, or
12
- # (at your option) any later version.
13
- #
14
- # This program is distributed in the hope that it will be useful,
15
- # but without any warranty, without even the implied warranty of
16
- # merchantability or fitness for a particular purpose. See the
17
- # GNU General Public License (GPL) for more details.
18
-
19
- import os
20
- import sys
21
- from PIL import Image
22
-
23
- try:
24
- filein = str(sys.argv[1])
25
- fileout = str(sys.argv[2])
26
- size = (int(sys.argv[3]), int(sys.argv[4]))
27
- quality = int(sys.argv[5])
28
- except:
29
- print("Usage: video.py source destination width height [quality=0=auto]")
30
- print("source: ogv,webm,mp4")
31
- print("destination: jpg")
32
- exit(-1)
33
-
34
- if not os.path.exists(os.path.dirname(fileout)):
35
- os.makedirs(os.path.dirname(fileout))
36
-
37
- # Video to image
38
- os.system('ffmpegthumbnailer -i ' + filein + ' -o ' + fileout + ' -q 10 -s ' + str(size[0]))
39
- if os.path.isfile(fileout):
40
- filein = fileout
41
- source = Image.open(filein)
42
- else:
43
- source = Image.new('RGBA', size, (0,0,0,0))
44
-
45
- # Standard resizing
46
- source.thumbnail(size, Image.ANTIALIAS)
47
- offset_x = max(int((size[0] - source.size[0]) / 2), 0)
48
- offset_y = max(int((size[1] - source.size[1]) / 2), 0)
49
-
50
- # Color detection
51
- # white background black player OR black background white player
52
- pixels = source.getcolors(size[0] * size[1])
53
- pixels = sorted(pixels, key=lambda t: t[0])
54
- if (pixels[-1][1] > (127,127,127)):
55
- dest = Image.new('RGBA', size, (255,255,255,0))
56
- dest.paste(source, (offset_x, offset_y))
57
- # https://stackoverflow.com/a/59082116 (replace only last lib)
58
- # /var/lib/gems/xyz/gems/redmine_apijs-xyz/lib devient /var/lib/gems/xyz/gems/redmine_apijs-xyz/assets/images/...
59
- path = os.path.dirname(__file__)
60
- path = ('/assets/images/apijs/player-black-' + str(size[0]) + '.png').join(path.rsplit('/lib', 1))
61
- play = Image.open(path)
62
- dest.paste(play, (0, 0), play)
63
- else:
64
- dest = Image.new('RGBA', size, (0,0,0,0))
65
- dest.paste(source, (offset_x, offset_y))
66
- # https://stackoverflow.com/a/59082116 (replace only last lib)
67
- # /var/lib/gems/xyz/gems/redmine_apijs-xyz/lib devient /var/lib/gems/xyz/gems/redmine_apijs-xyz/assets/images/...
68
- path = os.path.dirname(__file__)
69
- path = ('/assets/images/apijs/player-white-' + str(size[0]) + '.png').join(path.rsplit('/lib', 1))
70
- play = Image.open(path)
71
- dest.paste(play, (0, 0), play)
72
-
73
- # https://pillow.readthedocs.io/en/latest/handbook/image-file-formats.html
74
- # The image quality, on a scale from 0 (worst) to 95 (best), the default is 75
75
- if quality < 1:
76
- quality = 75
77
- elif quality > 95:
78
- quality = 95
79
-
80
- dest.convert('RGB').save(fileout, 'JPEG', optimize=True, subsampling=0, quality=quality)