#NEWLINE# def create_id3( pcr , title , artist ) : #NEWLINE# #INDENT# id3 = bytearray ( b'ID3\x03\x00\x00' ) #NEWLINE# pcr_frame = bytearray ( ) #NEWLINE# pcr_frame += b'com.apple.streaming.transportStreamTimestamp\x00' #NEWLINE# pcr_frame += struct . pack ( '!Q' , pcr ) #NEWLINE# pcr_frame = ( ( ( b'PRIV' + struct . pack ( '!I' , len ( pcr_frame ) ) ) + b'\x00\x00' ) + pcr_frame ) #NEWLINE# title_frame = bytearray ( ) #NEWLINE# title_frame += ( ( b'\x01' + title . encode ( 'utf-16' ) ) + b'\x00\x00' ) #NEWLINE# title_frame = ( ( ( b'TIT2' + synchsafe ( len ( title_frame ) ) ) + b'\x00\x00' ) + title_frame ) #NEWLINE# artist_frame = bytearray ( ) #NEWLINE# artist_frame += ( ( b'\x01' + artist . encode ( 'utf-16' ) ) + b'\x00\x00' ) #NEWLINE# artist_frame = ( ( ( b'TPE1' + synchsafe ( len ( artist_frame ) ) ) + b'\x00\x00' ) + artist_frame ) #NEWLINE# frames = ( ( pcr_frame + title_frame ) + artist_frame ) #NEWLINE# id3 += ( synchsafe ( len ( frames ) ) + frames ) #NEWLINE# return id3