Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
elibroftw committed Apr 19, 2024
1 parent d911191 commit 0b9cc3b
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/modules/win32_media_controls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/system-media-transport-controls
# https://learn.microsoft.com/windows/uwp/audio-video-camera/system-media-transport-controls
# https://github.com/microsoft/WindowsAppSDK/issues/127
import enum
import platform
from datetime import timedelta
Expand Down Expand Up @@ -36,16 +37,20 @@ def __init__(self, on_event):
self.system_media_transport_controls.is_previous_enabled = True
self.on_event = on_event
self.system_media_transport_controls.add_button_pressed(self._on_btn_press)
# from winrt.windows.media.control import \
# GlobalSystemMediaTransportControlsSessionManager as MediaManager
# = media.SystemMediaTransportControls.get_for_current_view()
# media.

if platform.system() == 'Windows':
import winrt.windows.media as media
def _on_btn_press(self, sender, args: media.SystemMediaTransportControlsButtonPressedEventArgs):
self.on_event(args.button)

def set_source(self, source):
if platform.system() == 'Windows':
from winrt.windows.foundation import Uri
if source.startswith('htt'):
self.media_player.set_uri_source(Uri(source))
else:
self.media_player.set_uri_source(Uri(f'file://{source}'))

def set_playing(self):
if platform.system() == 'Windows':
import winrt.windows.media as media
Expand Down Expand Up @@ -92,18 +97,3 @@ def update_time(self):
timeline_properties.max_seek_time = timedelta(0)
timeline_properties.end_time = timedelta(100)
self.system_media_transport_controls.update_timeline_properties(timeline_properties)

pass
# self.dll.ITaskbarList4_SetProgressState(self.session, 0x0)
# self.dll.ITaskbarList4_SetProgressValue(self.session, 0, 100)
# self.dll.ITaskbarList4_SetThumbnailClip(self.session, thumbnail_path)
# self.dll.ITaskbarList4_SetThumbnailTooltip(self.session, title)
# self.dll.ITaskbarList4_SetTitle(self.session, title)
# self.dll.ITaskbarList4_SetDescription(self.session, f"{artist} - {album}")


if __name__ == '__main__':
# Example usage
session = SystemMediaControls(lambda event: print(event))
# session.play()
# session.set_metadata("My Song", "My Artist", "My Album", "path/to/thumbnail.jpg")

0 comments on commit 0b9cc3b

Please sign in to comment.