Exemple #1
0
    def GetPrettyInfo(self):

        (hash, inbox, size, mime, timestamp, width, height, duration,
         num_frames, num_words, tags_manager, locations_manager, local_ratings,
         remote_ratings) = self._media_result.ToTuple()

        info_string = HC.ConvertIntToBytes(
            size) + ' ' + HC.mime_string_lookup[mime]

        if width is not None and height is not None:
            info_string += ' (' + HC.ConvertIntToPrettyString(
                width) + 'x' + HC.ConvertIntToPrettyString(height) + ')'

        if duration is not None:
            info_string += ', ' + HC.ConvertMillisecondsToPrettyTime(duration)

        if num_frames is not None:
            info_string += ' (' + HC.ConvertIntToPrettyString(
                num_frames) + ' frames)'

        if num_words is not None:
            info_string += ' (' + HC.ConvertIntToPrettyString(
                num_words) + ' words)'

        return info_string
Exemple #2
0
    def test_number_conversion(self):

        i = 123456789

        i_pretty = HC.ConvertIntToPrettyString(i)

        # this test only works on anglo computers; it is mostly so I can check it is working on mine

        self.assertEqual(i_pretty, '123,456,789')
Exemple #3
0
    def GetPrettyInfo(self):

        size = HC.ConvertIntToBytes(self._size)

        mime = HC.mime_string_lookup[HC.APPLICATION_HYDRUS_CLIENT_COLLECTION]

        info_string = size + ' ' + mime

        info_string += ' (' + HC.ConvertIntToPrettyString(
            self.GetNumFiles()) + ' files)'

        return info_string