Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_transfer_android_video.py @ 312:772c170b47a9
Python3 port:
/!\ Cagou now runs with Python 3.6+
Port has been done in the same way as for backend (check backend commit b2d067339de3
message for details).
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 13 Aug 2019 19:14:22 +0200 |
parents | 1b835bcfa663 |
children | 4d660b252487 |
comparison
equal
deleted
inserted
replaced
311:a0d978d3ce84 | 312:772c170b47a9 |
---|---|
32 else: | 32 else: |
33 import tempfile | 33 import tempfile |
34 | 34 |
35 | 35 |
36 PLUGIN_INFO = { | 36 PLUGIN_INFO = { |
37 "name": _(u"take video"), | 37 "name": _("take video"), |
38 "main": "AndroidVideo", | 38 "main": "AndroidVideo", |
39 "platforms": ('android',), | 39 "platforms": ('android',), |
40 "external": True, | 40 "external": True, |
41 "description": _(u"upload a video from video application"), | 41 "description": _("upload a video from video application"), |
42 "icon_medium": u"{media}/icons/muchoslava/png/film_camera_off_50.png", | 42 "icon_medium": "{media}/icons/muchoslava/png/film_camera_off_50.png", |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 class AndroidVideo(object): | 46 class AndroidVideo(object): |
47 | 47 |
49 self.callback = callback | 49 self.callback = callback |
50 self.cancel_cb = cancel_cb | 50 self.cancel_cb = cancel_cb |
51 filename = time.strftime("%Y-%m-%d_%H:%M:%S.mpg", time.gmtime()) | 51 filename = time.strftime("%Y-%m-%d_%H:%M:%S.mpg", time.gmtime()) |
52 tmp_dir = self.getTmpDir() | 52 tmp_dir = self.getTmpDir() |
53 tmp_file = os.path.join(tmp_dir, filename) | 53 tmp_file = os.path.join(tmp_dir, filename) |
54 log.debug(u"Video will be saved to {}".format(tmp_file)) | 54 log.debug("Video will be saved to {}".format(tmp_file)) |
55 camera.take_video(tmp_file, self.callback) | 55 camera.take_video(tmp_file, self.callback) |
56 # we don't delete the file, as it is nice to keep it locally | 56 # we don't delete the file, as it is nice to keep it locally |
57 | 57 |
58 def getTmpDir(self): | 58 def getTmpDir(self): |
59 if sys.platform == "android": | 59 if sys.platform == "android": |