@@ -276,8 +276,8 @@ def add(
276276
277277 :param media_ids: List of Media IDs to add.
278278 :param allow_duplicates: Allow adding duplicate items
279- :param position: Insert items at a specific position. Default: insert at the end
280- of the playlist
279+ :param position: Insert items at a specific position.
280+ Default: insert at the end of the playlist
281281 :return: True, if successful.
282282 """
283283 # Insert items at a specific index
@@ -302,6 +302,35 @@ def add(
302302 self ._reparse ()
303303 return res .ok
304304
305+ def add_by_isrc (
306+ self ,
307+ isrc : str ,
308+ allow_duplicates : bool = False ,
309+ position : int = - 1 ,
310+ ) -> bool :
311+ """Add an item to a playlist, using the track ISRC.
312+
313+ :param isrc: The ISRC of the track to be added
314+ :param allow_duplicates: Allow adding duplicate items
315+ :param position: Insert items at a specific position.
316+ Default: insert at the end of the playlist
317+ :return: True, if successful.
318+ """
319+ try :
320+ track = self .session .get_tracks_by_isrc (isrc )
321+ if track :
322+ # Add the first track in the list
323+ track_id = str (track [0 ].id )
324+ return self .add (
325+ [track_id ],
326+ allow_duplicates = allow_duplicates ,
327+ position = position ,
328+ )
329+ else :
330+ return False
331+ except ObjectNotFound :
332+ return False
333+
305334 def move_by_id (self , media_id : str , position : int ) -> bool :
306335 """Move an item to a new position, by media ID.
307336
0 commit comments