Esempio n. 1
0
    def del_track(rem_track: int, cd: DC.CD) -> None:
        """Deletes a Track for the list of cd_tracks


        Args:
            rem_track (int): Position of the track to be deleted.
            cd (DC.CD): cd object the track gets deleted from.

        Raises:
            Exception: DESCraised in case position is not an integer.

        Returns:
            track (string): Track string that matches rem_track, if no match returns None

        """
        tracks = cd.cd_tracks
        try:
            rem_track = int(rem_track)
        except:
            raise Exception('Track must be an Integer!')
        for track in tracks:
            if (track is not None):
                if track.position == rem_track:
                    cd.rmv_track(rem_track)
                    print('Track was removed!')
                    return track
Esempio n. 2
0
    def remove_track(track_position: int, cd: DC.CD) -> None:
        """removes a Track object with the given track position


        Args:
            track_position (int): integer of the track position to remove
            cd (DC.CD): cd object the track gets added to.

        Raises:
            Exception: Exception raised in case position is not an integer.

        Returns:
            None: track is removed from cd object passed in

        """
        try:
            cd.rmv_track(track_position)
        except:
            raise Exception ("Unable to  add track to CD.")
Esempio n. 3
0
    def remove_track(track: int, cd: DC.CD) -> None:
        """Removes a Track object from cd


        Args:
            track (int): Integer containing user choice of track to remove
            cd (DC.CD): cd object the tarck gets added to.

        Raises:
            Exception: DESCraised in case position is not an integer.

        Returns:
            None

        """
        try:
            track = int(track)
        except:
            raise Exception('ID must be an Integer!')
        cd.rmv_track(track)
Esempio n. 4
0
 def remove_track(track_pos: int, cd: DC.CD) -> None:
     """removes a track from the CD
     
     Args:
         track_pos (int): the position of the track to be removed
         cd (DC.CD): the cd object the track is to be removed from
     
     Raises:
         ValueError Exception: raised in case position is not an integer.
         Exception: raised in case the track does not exist
     
     Returns:
         None
     """
     try:
         track_pos = int(track_pos)
         try:
             cd.rmv_track(track_pos)
         except Exception as e:
             print('Track does not exist.\n', str(e))
     except ValueError:
         print('Position must be an integer.')