cleaned up more
This commit is contained in:
parent
f624ce357c
commit
a321458f59
@ -1031,13 +1031,27 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def change_filetype(row: pd.Series) -> pd.Series:\n",
|
||||
"def fix_filetype(row: pd.Series) -> pd.Series:\n",
|
||||
" try:\n",
|
||||
" if row['path'] != '-':\n",
|
||||
" if row['correct_media_type'] == 'Image':\n",
|
||||
" os.rename(src=f\"../downloads/{row['filename'][:-4]}.mp4\", dst=f\"../downloads/{row['filename'][:-4]}.jpg\")\n",
|
||||
" elif row['correct_media_type'] == 'Video':\n",
|
||||
" os.rename(src=f\"../downloads/{row['filename'][:-4]}.jpg\", dst=f\"../downloads/{row['filename'][:-4]}.mp4\")\n",
|
||||
" mp4_file_path = f\"../downloads/{row['filename'][:-4]}.mp4\"\n",
|
||||
" jpg_file_path = f\"../downloads/{row['filename'][:-4]}.jpg\"\n",
|
||||
" \n",
|
||||
" if row['correct_media_type'] == row['actual_media_type']:\n",
|
||||
" return row\n",
|
||||
" \n",
|
||||
" if row['path'] == '-':\n",
|
||||
" return row\n",
|
||||
" \n",
|
||||
" if row['correct_media_type'] == 'Image':\n",
|
||||
" os.rename(src=mp4_file_path, dst=jpg_file_path)\n",
|
||||
" if os.path.exists(jpg_file_path):\n",
|
||||
" row['filename'] = f\"{row['filename'][:-4]}.jpg\"\n",
|
||||
" row['actual_media_type'] = 'Image'\n",
|
||||
" elif row['correct_media_type'] == 'Video':\n",
|
||||
" os.rename(src=jpg_file_path, dst=mp4_file_path)\n",
|
||||
" if os.path.exists(mp4_file_path):\n",
|
||||
" row['filename'] = f\"{row['filename'][:-4]}.mp4\"\n",
|
||||
" row['actual_media_type'] = 'Video'\n",
|
||||
" except FileNotFoundError:\n",
|
||||
" print(f\"File not found: {row['filename']}\")\n",
|
||||
" return row"
|
||||
@ -1050,7 +1064,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"wrong_filetype.apply(change_filetype, axis=1)"
|
||||
"wrong_filetype.apply(fix_filetype, axis=1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1104,7 +1118,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def update_exif_with_exiftool(row):\n",
|
||||
"def update_exif_with_exiftool(row: pd.Series) -> None:\n",
|
||||
" image_path = row['path']\n",
|
||||
" create_date = row['correct_date_utc']\n",
|
||||
" latitude = row['correct_latitude']\n",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user