45
45
from .log import logger
46
46
47
47
from .rpc import RpcInvocationData
48
- from .data_stream import TextStreamWriter , FileStreamWriter , STREAM_CHUNK_SIZE
48
+ from .data_stream import (
49
+ TextStreamWriter ,
50
+ FileStreamWriter ,
51
+ FileStreamInfo ,
52
+ STREAM_CHUNK_SIZE ,
53
+ )
49
54
50
55
51
56
class PublishTrackError (Exception ):
@@ -550,7 +555,7 @@ async def stream_text(
550
555
topic : str = "" ,
551
556
extensions : Dict [str , str ] = {},
552
557
reply_to_id : str | None = None ,
553
- ):
558
+ ) -> TextStreamWriter :
554
559
writer = TextStreamWriter (
555
560
self ,
556
561
topic = topic ,
@@ -571,7 +576,7 @@ async def stream_file(
571
576
extensions : Dict [str , str ] = {},
572
577
stream_id : str | None = None ,
573
578
destination_identities : List [str ] = [],
574
- ):
579
+ ) -> FileStreamWriter :
575
580
writer = FileStreamWriter (
576
581
self ,
577
582
file_name = file_name ,
@@ -592,7 +597,7 @@ async def send_file(
592
597
destination_identities : List [str ] = [],
593
598
extensions : Dict [str , str ] = {},
594
599
stream_id : str | None = None ,
595
- ):
600
+ ) -> FileStreamInfo :
596
601
file_size = os .path .getsize (file_path )
597
602
file_name = os .path .basename (file_path )
598
603
mime_type , _ = mimetypes .guess_type (file_path )
@@ -615,6 +620,8 @@ async def send_file(
615
620
await writer .write (bytes )
616
621
await writer .close ()
617
622
623
+ return writer .info
624
+
618
625
async def publish_track (
619
626
self , track : LocalTrack , options : TrackPublishOptions = TrackPublishOptions ()
620
627
) -> LocalTrackPublication :
0 commit comments