From 63b423cf756708d64efa214ca5a7a91e65af68ee Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 2 Feb 2019 00:06:28 +0100 Subject: [PATCH] Refactored mplayer and omxplayer under the same media player --- .../platypush/plugins/media.omxplayer.rst | 6 + .../platypush/plugins/video.omxplayer.rst | 6 - docs/source/plugins.rst | 2 +- .../css/{video.omxplayer.css => media.css} | 0 .../js/{video.omxplayer.js => media.js} | 10 +- .../{video.omxplayer.html => media.html} | 4 +- .../http/templates/plugins/media.mplayer.html | 1 + .../templates/plugins/media.omxplayer.html | 1 + platypush/plugins/media/__init__.py | 72 ++- platypush/plugins/media/ctrl.py | 8 +- platypush/plugins/media/mplayer.py | 108 ++-- platypush/plugins/media/omxplayer.py | 297 +++++++++++ platypush/plugins/video/omxplayer.py | 496 ------------------ 13 files changed, 400 insertions(+), 611 deletions(-) create mode 100644 docs/source/platypush/plugins/media.omxplayer.rst delete mode 100644 docs/source/platypush/plugins/video.omxplayer.rst rename platypush/backend/http/static/css/{video.omxplayer.css => media.css} (100%) rename platypush/backend/http/static/js/{video.omxplayer.js => media.js} (94%) rename platypush/backend/http/templates/plugins/{video.omxplayer.html => media.html} (97%) create mode 120000 platypush/backend/http/templates/plugins/media.mplayer.html create mode 120000 platypush/backend/http/templates/plugins/media.omxplayer.html create mode 100644 platypush/plugins/media/omxplayer.py delete mode 100644 platypush/plugins/video/omxplayer.py diff --git a/docs/source/platypush/plugins/media.omxplayer.rst b/docs/source/platypush/plugins/media.omxplayer.rst new file mode 100644 index 000000000..e623afea3 --- /dev/null +++ b/docs/source/platypush/plugins/media.omxplayer.rst @@ -0,0 +1,6 @@ +``platypush.plugins.media.omxplayer`` +===================================== + +.. automodule:: platypush.plugins.media.omxplayer + :members: + diff --git a/docs/source/platypush/plugins/video.omxplayer.rst b/docs/source/platypush/plugins/video.omxplayer.rst deleted file mode 100644 index e60bd9abe..000000000 --- a/docs/source/platypush/plugins/video.omxplayer.rst +++ /dev/null @@ -1,6 +0,0 @@ -``platypush.plugins.video.omxplayer`` -===================================== - -.. automodule:: platypush.plugins.video.omxplayer - :members: - diff --git a/docs/source/plugins.rst b/docs/source/plugins.rst index 80f412f50..54ccce47d 100644 --- a/docs/source/plugins.rst +++ b/docs/source/plugins.rst @@ -33,6 +33,7 @@ Plugins platypush/plugins/light.hue.rst platypush/plugins/light.rst platypush/plugins/media.kodi.rst + platypush/plugins/media.omxplayer.rst platypush/plugins/midi.rst platypush/plugins/mqtt.rst platypush/plugins/music.mpd.rst @@ -51,7 +52,6 @@ Plugins platypush/plugins/tts.rst platypush/plugins/utils.rst platypush/plugins/variable.rst - platypush/plugins/video.omxplayer.rst platypush/plugins/weather.forecast.rst platypush/plugins/websocket.rst platypush/plugins/wiimote.rst diff --git a/platypush/backend/http/static/css/video.omxplayer.css b/platypush/backend/http/static/css/media.css similarity index 100% rename from platypush/backend/http/static/css/video.omxplayer.css rename to platypush/backend/http/static/css/media.css diff --git a/platypush/backend/http/static/js/video.omxplayer.js b/platypush/backend/http/static/js/media.js similarity index 94% rename from platypush/backend/http/static/js/video.omxplayer.js rename to platypush/backend/http/static/js/media.js index 31fe93156..793bd882e 100644 --- a/platypush/backend/http/static/js/video.omxplayer.js +++ b/platypush/backend/http/static/js/media.js @@ -59,13 +59,13 @@ $(document).ready(function() { request = { type: 'request', - action: 'video.omxplayer.play', + action: 'media.play', args: { resource: resource } }; } else { request = { type: 'request', - action: 'video.omxplayer.search', + action: 'media.search', args: { query: resource } }; @@ -87,7 +87,7 @@ $(document).ready(function() { execute( { type: 'request', - action: 'video.omxplayer.' + action, + action: 'media.' + action, } ); }); @@ -100,7 +100,7 @@ $(document).ready(function() { execute( { type: 'request', - action: 'video.omxplayer.set_volume', + action: 'media.set_volume', args: { volume: $(this).val() } }, @@ -124,7 +124,7 @@ $(document).ready(function() { execute( { type: 'request', - action: 'video.omxplayer.play', + action: 'media.play', args: { resource: $item.data('url') }, }, diff --git a/platypush/backend/http/templates/plugins/video.omxplayer.html b/platypush/backend/http/templates/plugins/media.html similarity index 97% rename from platypush/backend/http/templates/plugins/video.omxplayer.html rename to platypush/backend/http/templates/plugins/media.html index e541972c7..351d98367 100644 --- a/platypush/backend/http/templates/plugins/video.omxplayer.html +++ b/platypush/backend/http/templates/plugins/media.html @@ -1,5 +1,5 @@ - - + +