simo 2.7.8__py3-none-any.whl → 2.7.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of simo might be problematic. Click here for more details.

@@ -4,6 +4,7 @@ from .app_widgets import AudioPlayerWidget, VideoPlayerWidget
4
4
 
5
5
 
6
6
  class BasePlayer(Switch):
7
+ admin_widget_template = 'admin/controller_widgets/player.html'
7
8
  default_config = {
8
9
  'has_volume_control': True,
9
10
  }
@@ -50,19 +51,54 @@ class BasePlayer(Switch):
50
51
 
51
52
  def set_volume(self, val):
52
53
  assert 0 <= val <= 100
54
+ self.component.meta['volume'] = val
55
+ self.component.save()
53
56
  self.send({'set_volume': val})
54
57
 
55
58
  def get_volume(self):
56
59
  return self.component.meta['volume']
57
60
 
58
61
  def set_shuffle_play(self, val):
62
+ self.component.meta['shuffle'] = bool(val)
63
+ self.component.save()
59
64
  self.send({'shuffle': bool(val)})
60
65
 
61
66
  def set_loop_play(self, val):
67
+ self.component.meta['loop'] = bool(val)
68
+ self.component.save()
62
69
  self.send({'loop': bool(val)})
63
70
 
64
- def play_library_item(self, val):
65
- self.send({'play_from_library': val})
71
+ def play_library_item(self, id, volume=None, fade_in=None):
72
+ '''
73
+ :param id: Library item ID
74
+ :param volume: Volume to play at. Current volume will be used if not provided
75
+ :param fade_in: number of seconds to fade in
76
+ :return:
77
+ '''
78
+ self.send({'play_from_library': id, 'volume': volume, 'fade_in': fade_in})
79
+
80
+ def play_uri(self, uri, volume=None):
81
+ '''
82
+ Replace que with this single uri and play it immediately
83
+ :param uri: playable uri or url
84
+ :param volume: volume at which to play
85
+ :return:
86
+ '''
87
+ if volume:
88
+ assert 0 <= volume <= 100
89
+ self.send({"play_uri": uri, 'volume': volume})
90
+
91
+ def play_alert(self, val, volume=None):
92
+ '''
93
+ Plays alert and goes back to whatever was playing initially
94
+ :param val: Sound.id or uri
95
+ :param volume: volume at which to play
96
+ :return:
97
+ '''
98
+ assert type(val) in (int, str)
99
+ if volume:
100
+ assert 0 <= volume <= 100
101
+ self.send({"alert": val, 'volume': volume})
66
102
 
67
103
  def toggle(self):
68
104
  if self.component.value == 'playing':
@@ -0,0 +1,11 @@
1
+ <div class="component-controller" data-ws_url="{{ obj.get_socket_url|default_if_none:"" }}">
2
+ {% if obj.value == 'playing' %}
3
+ <i class="fas fa-toggle-on fa-2x component_switch action"
4
+ data-method="pause"
5
+ ></i>
6
+ {% else %}
7
+ <i class="fas fa-toggle-off fa-2x component_switch action"
8
+ data-method="play"
9
+ ></i>
10
+ {% endif %}
11
+ </div>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.7.8
3
+ Version: 2.7.9
4
4
  Summary: Smart Home on Steroids!
5
5
  Author-email: Simanas Venčkauskas <simanas@simo.io>
6
6
  Project-URL: Homepage, https://simo.io
@@ -10431,7 +10431,7 @@ simo/multimedia/admin.py,sha256=GgXiKTLfi3omjBurU-bKgneJRK-tAeiR8o2jo3zD7zs,1002
10431
10431
  simo/multimedia/api.py,sha256=mZ5BTggWdc_kL8P70JGC3rTCiZKPnxWYoyNcAQkFnX4,285
10432
10432
  simo/multimedia/app_widgets.py,sha256=g_IPx5bNmIS6JbaXXDCzYZYV2KVKAiYvWjH4oI30lWM,331
10433
10433
  simo/multimedia/base_types.py,sha256=dAP7_uh_b3A03yXBJZyQdRFucKIro4_RkIZ5yOaWXVE,151
10434
- simo/multimedia/controllers.py,sha256=kaoi-nv9b6O87k1eijgk-6ub0-E2KdTN1lL99OPGpo8,1993
10434
+ simo/multimedia/controllers.py,sha256=U8AuSW-jXYBwFm9960L9bYDlgmHswP7HKxcNd1Mt5NI,3304
10435
10435
  simo/multimedia/forms.py,sha256=oMCVUXRNiESrY3w_uBLRRgjMjx8BrmNeVglzorA9QtY,239
10436
10436
  simo/multimedia/models.py,sha256=5aWGLWDdCkekGAOGZIdanvX1l6ULnhgJN4JAvDZT4nQ,734
10437
10437
  simo/multimedia/requirements.txt,sha256=QeIhjf1RfNGCYn_WZm3VuinPI2wK31WEJPbCxRWxssY,28
@@ -10455,6 +10455,7 @@ simo/multimedia/migrations/__pycache__/0002_sound_length.cpython-38.pyc,sha256=5
10455
10455
  simo/multimedia/migrations/__pycache__/0003_alter_sound_length.cpython-38.pyc,sha256=dkdqLx_cWLAxxVCUxuuAX39iTv7G5kG-PhJ40HsPzx8,669
10456
10456
  simo/multimedia/migrations/__pycache__/0004_auto_20231023_1055.cpython-38.pyc,sha256=tX6x1gNeVcUHcCFvisP9Z2jPBE029TJG632fvtvUjV8,892
10457
10457
  simo/multimedia/migrations/__pycache__/__init__.cpython-38.pyc,sha256=mCgSiQBphL85imdWyTi9-4zBDYF6HfXbhB0ycSPVVuA,175
10458
+ simo/multimedia/templates/admin/controller_widgets/player.html,sha256=v4PFoL37-C7L6ILZI6yF5ff9iO3EnEs5kXbRayaHy0s,358
10458
10459
  simo/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10459
10460
  simo/notifications/admin.py,sha256=WQbN_bd2KRxVjbOajeworNrV9QlDNSadQT58La0Nn2M,1174
10460
10461
  simo/notifications/api.py,sha256=QrfFn5kBU0vlqi8X368w1-0iTmDGu_hmMxLW2R0OTTg,1765
@@ -10607,9 +10608,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10607
10608
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10608
10609
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10609
10610
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10610
- simo-2.7.8.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10611
- simo-2.7.8.dist-info/METADATA,sha256=N8l_soYBEp5Ohuwp2gwQwgd2ScThohJQUa7cfGSkVVk,1952
10612
- simo-2.7.8.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10613
- simo-2.7.8.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10614
- simo-2.7.8.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10615
- simo-2.7.8.dist-info/RECORD,,
10611
+ simo-2.7.9.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10612
+ simo-2.7.9.dist-info/METADATA,sha256=jHAhp_0GQNyZhG5GjyR2Y60aZaxf0qFH5aFlP-qatmo,1952
10613
+ simo-2.7.9.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10614
+ simo-2.7.9.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10615
+ simo-2.7.9.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10616
+ simo-2.7.9.dist-info/RECORD,,
File without changes