Exemple #1
0
    def testProcess(self):
        """Test the Process function on a Kodi Videos database."""
        plugin = kodi.KodiMyVideosPlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(['MyVideos107.db'],
                                                           plugin)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 4)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetSortedEvents())

        expected_event_values = {
            'data_type': 'kodi:videos:viewing',
            'date_time': '2017-07-16 04:54:54',
            'filename':
            'plugin://plugin.video.youtube/play/?video_id=7WX0-O_ENlk',
            'play_count': 1,
            'timestamp_desc': definitions.TIME_DESCRIPTION_LAST_VISITED
        }

        self.CheckEventValues(storage_writer, events[1], expected_event_values)
Exemple #2
0
    def testProcess(self):
        """Test the Process function on a Kodi Videos database."""
        plugin = kodi.KodiMyVideosPlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(['MyVideos107.db'],
                                                           plugin)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 4)

        events = list(storage_writer.GetSortedEvents())

        # Check the second event.
        event = events[1]

        self.CheckTimestamp(event.timestamp, '2017-07-16 04:54:54.000000')
        self.assertEqual(event.timestamp_desc,
                         definitions.TIME_DESCRIPTION_LAST_VISITED)

        expected_filename = (
            'plugin://plugin.video.youtube/play/?video_id=7WX0-O_ENlk')

        self.assertEqual(event.filename, expected_filename)

        expected_message = (
            'Video: plugin://plugin.video.youtube/play/?video_id=7WX0-O_ENlk '
            'Play Count: 1')
        expected_short_message = expected_filename
        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)