def testCreateDownloadVideoInfoDic_timeFrameSyntax(self):
		expectedPlayListName = 'Test 3 short videos'
		timeInfoWithSyntaxError = '(e-0:0:4-0:0:6 e0:0:12-e s0:0:1-0:0:3 s0:0:4-0:0:6 s0:0:9-e) (s0:0:1-0:0:3 s0:0:4-0:0:6 s0:0:9-e) (e0:0:2-0:0:3 e0:0:5-e)'
		playlistTitle = expectedPlayListName + ' ' + timeInfoWithSyntaxError
		
		downloadDir = AUDIO_DIR_TEST + DIR_SEP + expectedPlayListName
		
		# deleting dic file in downloadDir
		files = glob.glob(downloadDir + DIR_SEP + '*.txt')
		
		for f in files:
			os.remove(f)
		
		downloadedVideoInfoDic, accessError = PlaylistTitleParser.createDownloadVideoInfoDicForPlaylist(playlistTitle, AUDIO_DIR_TEST)
		self.assertIsNotNone(accessError)
		self.assertEqual('time frame syntax error "e-0:0:4-0:0:6" detected in playlist title: "Test 3 short videos (e-0:0:4-0:0:6 e0:0:12-e s0:0:1-0:0:3 s0:0:4-0:0:6 s0:0:9-e) (s0:0:1-0:0:3 s0:0:4-0:0:6 s0:0:9-e) (e0:0:2-0:0:3 e0:0:5-e)".\ndownloading playlist interrupted.', accessError.errorMsg)
		
		self.assertEqual(expectedPlayListName, downloadedVideoInfoDic.getPlaylistName())
		self.assertIsNone(downloadedVideoInfoDic.getExtractStartEndSecondsListsForVideoIndex(1))
		self.assertIsNone(downloadedVideoInfoDic.getExtractStartEndSecondsListsForVideoIndex(2))
		self.assertIsNone(downloadedVideoInfoDic.getExtractStartEndSecondsListsForVideoIndex(3))

		self.assertIsNone(downloadedVideoInfoDic.getSuppressStartEndSecondsListsForVideoIndex(1))
		self.assertIsNone(downloadedVideoInfoDic.getSuppressStartEndSecondsListsForVideoIndex(2))
		self.assertIsNone(downloadedVideoInfoDic.getSuppressStartEndSecondsListsForVideoIndex(3))
	def testCreateDownloadVideoInfoDic_two_time_frames_one_extract_one_suppress_two_videos_timeFrames_to_end_playlistTitle_with_spaces(self):
		# Example of playlist title: playlist_title (s01:05:52-01:07:23 e01:15:52-e  E01:35:52-01:37:23 S01:25:52-e) (s01:05:52-01:07:23 e01:15:52-e S01:25:52-e E01:35:52-01:37:23)
		expectedPlayListName = 'Test_title two time_frame_one extract one_suppress_two_videos'
		timeInfo = '(E0:05:52-0:07:23 S0:10:52-e) (e1:05:52-E s1:10:52-1:10:53)'
		playlistTitle = expectedPlayListName + ' ' + timeInfo
		
		expectedVideo1ExtractTimeFramesList = [[352, 443]]
		expectedVideo1SuppressTimeFramesList = [[652, 'end']]
		
		expectedVideo2ExtractTimeFramesList = [[3952, 'end']]
		expectedVideo2SuppressTimeFramesList = [[4252, 4253]]
		
		downloadDir = AUDIO_DIR_TEST + DIR_SEP + expectedPlayListName
		
		# deleting dic file in downloadDir
		files = glob.glob(downloadDir + DIR_SEP + '*.txt')
		
		for f in files:
			os.remove(f)
		
		downloadedVideoInfoDic, accessError = PlaylistTitleParser.createDownloadVideoInfoDicForPlaylist(playlistTitle, AUDIO_DIR_TEST)
		
		self.assertEqual(expectedPlayListName, downloadedVideoInfoDic.getPlaylistName())
		self.assertEqual(downloadedVideoInfoDic.getExtractStartEndSecondsListsForVideoIndex(1),
		                 expectedVideo1ExtractTimeFramesList)
		self.assertEqual(downloadedVideoInfoDic.getSuppressStartEndSecondsListsForVideoIndex(1),
		                 expectedVideo1SuppressTimeFramesList)
		self.assertEqual(downloadedVideoInfoDic.getExtractStartEndSecondsListsForVideoIndex(2),
		                 expectedVideo2ExtractTimeFramesList)
		self.assertEqual(downloadedVideoInfoDic.getSuppressStartEndSecondsListsForVideoIndex(2),
		                 expectedVideo2SuppressTimeFramesList)
	def getDownloadVideoInfoDicForPlaylistUrl(self, playlistUrl):
		playlistObject, playlistTitle, accessError = self.getPlaylistObjectForPlaylistUrl(playlistUrl)
		
		if accessError:
			self.audioController.displayError(accessError.errorMsg)
			return None, None
		
		downloadVideoInfoDic = PlaylistTitleParser.createDownloadVideoInfoDicForPlaylist(playlistTitle)
		
		return playlistObject, downloadVideoInfoDic
	def testCreateDownloadVideoInfoDic_no_time_frame_playlistTitle_with_spaces(self):
		expectedPlayListName = '21 leçons pour le XXIe siècle'
		playlistTitle = expectedPlayListName
		
		downloadDir = AUDIO_DIR_TEST + DIR_SEP + expectedPlayListName
		
		# deleting dic file in downloadDir
		files = glob.glob(downloadDir + DIR_SEP + '*.txt')
		
		for f in files:
			os.remove(f)
		
		downloadedVideoInfoDic, accessError = PlaylistTitleParser.createDownloadVideoInfoDicForPlaylist(playlistTitle, AUDIO_DIR_TEST)
		
		self.assertEqual(expectedPlayListName, downloadedVideoInfoDic.getPlaylistName())
	def testCreateDownloadVideoInfoDic_two_time_frames_one_extract_one_suppress(self):
		expectedPlayListName = 'Test_title_two_time_frame_one_extract_one_suppress'
		timeInfo = '(e0:05:52-0:07:23 s0:10:52-0:10:53)'
		playlistTitle = expectedPlayListName + ' ' + timeInfo
		
		expectedVideoExtractTimeFramesList = [[352, 443]]
		expectedVideoSuppressTimeFramesList = [[652, 653]]
		
		downloadDir = AUDIO_DIR_TEST + DIR_SEP + expectedPlayListName
		
		# deleting dic file in downloadDir
		files = glob.glob(downloadDir + DIR_SEP + '*.txt')
		
		for f in files:
			os.remove(f)
		
		downloadedVideoInfoDic, accessError = PlaylistTitleParser.createDownloadVideoInfoDicForPlaylist(playlistTitle, AUDIO_DIR_TEST)

		self.assertEqual(expectedPlayListName, downloadedVideoInfoDic.getPlaylistName())
		self.assertEqual(downloadedVideoInfoDic.getExtractStartEndSecondsListsForVideoIndex(1), expectedVideoExtractTimeFramesList)
		self.assertEqual(downloadedVideoInfoDic.getSuppressStartEndSecondsListsForVideoIndex(1), expectedVideoSuppressTimeFramesList)