コード例 #1
0
    def test_jpg_description2(self):
        p = test_data / 'IMG_20180908_132733-gphotos.jpg'
        lfm = LocalFilesMedia(p)
        self.assertEqual(lfm.description, '')

        p = test_data / 'IMG_20180908_132733-insync.jpg'
        lfm = LocalFilesMedia(p)
        self.assertEqual(lfm.description, '')
コード例 #2
0
    def test_jpg_description(self):
        p = test_data / 'IMG_20190102_112832.jpg'
        lfm = LocalFilesMedia(p)
        self.assertEqual(lfm.description, '')

        p = test_data / '20180126_185832.jpg'
        lfm = LocalFilesMedia(p)
        self.assertEqual(lfm.description, '')

        p = test_data / '1987-JohnWoodAndGiles.jpg'
        lfm = LocalFilesMedia(p)
        self.assertEqual(lfm.description, '')
コード例 #3
0
 def get_extra_meta(self):
     count = 0
     log.warning('updating index with extra metadata for comparison '
                 '(may take some time) ...')
     media_items = self._db.get_rows_by_search(
         GooglePhotosRow, uid='ISNULL')
     for item in media_items:
         file_path = self._root_folder / item.relative_path
         # if this item has a uid it has been scanned before
         if file_path.exists():
             local_file = LocalFilesMedia(file_path)
             count += 1
             log.info('updating metadata %d on %s', count, file_path)
             item.update_extra_meta(local_file.uid,
                                    local_file.create_date,
                                    local_file.size)
             # erm lets try some duck typing then !
             # todo is the DbRow class model rubbish or brilliant Python?
             # noinspection PyTypeChecker
             self._db.put_row(GooglePhotosRow.from_media(item),
                              update=True)
             if count % 2000 == 0:
                 self._db.store()
         else:
             log.debug('skipping metadata (already scanned) on %s',
                       file_path)
     log.warning('updating index with extra metadata complete')
コード例 #4
0
    def test_local_duplicate_names(self):
        ps = 'PIC00002 (2).jpg'
        p = Path(test_data) / Path(ps)

        lf = LocalFilesMedia(p)
        self.assertEqual(lf.duplicate_number, 1)

        assert str(lf.filename) == ps

        ps = 'PIC00002.jpg'
        p = Path(test_data) / Path(ps)

        lf = LocalFilesMedia(p)
        self.assertEqual(lf.duplicate_number, 0)

        assert str(lf.filename) == ps