Skip to content

Commit 85e2aa2

Browse files
committed
Capture now playing
1 parent cb97827 commit 85e2aa2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dlna.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ def __init__(self, *args, **kwargs):
105105
if self.fast:
106106
print("Fast mode enabled - subprocess calls will be disabled")
107107

108+
self.now_playing = "None"
109+
110+
def get_now_playing(self):
111+
"""Get the currently playing media file."""
112+
return self.now_playing
113+
108114
def setup(self):
109115
"""Set up the connection with timeout"""
110116
super().setup()
@@ -837,6 +843,11 @@ def serve_media_file(self, filename, head_only=False):
837843
if self.verbose:
838844
print(f"MEDIA ACCESS: {self.path} from {client_addr}")
839845
print(f"MEDIA HEADERS: {dict(self.headers)}")
846+
847+
# Set the current playing file for DLNA clients
848+
# Get filename after the last slash for display
849+
self.now_playing = os.path.basename(decoded_filename)
850+
print(f"NOW PLAYING: {self.now_playing}")
840851

841852
# Handle range requests for video streaming
842853
range_header = self.headers.get("Range")

0 commit comments

Comments
 (0)