|  | @@ -1,5 +1,6 @@
 | 
	
		
			
				|  |  |  import abc
 | 
	
		
			
				|  |  |  import re
 | 
	
		
			
				|  |  | +import typing
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import mutagen.id3
 | 
	
		
			
				|  |  |  import mutagen.mp4
 | 
	
	
		
			
				|  | @@ -212,16 +213,30 @@ class MP4(_MutagenTagInterface):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  class OggOpus(_MutagenTagInterface):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    # https://github.com/cmus/cmus/blob/9a0723f7a90dc7de0898be87963d5105a999aa6c/ip/opus.c#L229
 | 
	
		
			
				|  |  | +    # https://github.com/cmus/cmus/blob/17bf542c6b120d9dcf6642b259d78badfc1143eb/comment.c#L224
 | 
	
		
			
				|  |  | +    _COMMENT_TAG = 'comment'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      def __init__(self, mutagen_file):
 | 
	
		
			
				|  |  |          assert isinstance(mutagen_file.tags, mutagen.oggopus.OggOpusVComment), \
 | 
	
		
			
				|  |  |              (mutagen_file, mutagen_file.tags)
 | 
	
		
			
				|  |  |          super().__init__(mutagen_file)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    def get_comment(self):
 | 
	
		
			
				|  |  | -        raise NotImplementedError()
 | 
	
		
			
				|  |  | +    def _get_single_text(self, tag_label) -> typing.Optional[str]:
 | 
	
		
			
				|  |  | +        tag = self._mutagen_file.get(tag_label, None)  # type: list
 | 
	
		
			
				|  |  | +        if tag is None:
 | 
	
		
			
				|  |  | +            return None
 | 
	
		
			
				|  |  | +        if len(tag) > 1:
 | 
	
		
			
				|  |  | +            raise ValueError((self.track_path, tag))
 | 
	
		
			
				|  |  | +        if not isinstance(tag[0], str):
 | 
	
		
			
				|  |  | +            raise ValueError((self.track_path, tag))
 | 
	
		
			
				|  |  | +        return tag[0]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    def set_comment(self, comment):
 | 
	
		
			
				|  |  | -        raise NotImplementedError()
 | 
	
		
			
				|  |  | +    def get_comment(self) -> typing.Optional[str]:
 | 
	
		
			
				|  |  | +        return self._get_single_text(self._COMMENT_TAG)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    def set_comment(self, comment: str) -> None:
 | 
	
		
			
				|  |  | +        self._mutagen_file[self._COMMENT_TAG] = comment
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      def get_track_uuid(self):
 | 
	
		
			
				|  |  |          raise NotImplementedError()
 |