vivianchen98 commited on
Commit
a4fa488
·
verified ·
1 Parent(s): 5990a5c

Delete organize.py

Browse files
Files changed (1) hide show
  1. organize.py +0 -35
organize.py DELETED
@@ -1,35 +0,0 @@
1
- import shutil
2
- import os
3
- import pandas as pd
4
- from tqdm import tqdm
5
-
6
- # Load catalog data
7
- catalog_df = pd.read_json("/nas/pohan/datasets/AIConfVideo/learningpaper24/metadata/catalog.json")
8
-
9
- # Setup output directory
10
- output_dir = "/nas/pohan/datasets/AIConfVideo/learningpaper24/video"
11
- os.makedirs(output_dir, exist_ok=True)
12
-
13
- # Copy videos
14
- for _, row in tqdm(catalog_df.iterrows(), desc="Copying videos"):
15
- source = f"/nas/pohan/datasets/AIConfVideo/video/{row['slideslive_id']}/video.mp4"
16
- dest = f"{output_dir}/{row['openreview_id']}_{row['slideslive_id']}.mp4"
17
-
18
- if os.path.exists(source) and os.path.getsize(source) > 0:
19
- try:
20
- # Use os.system with cp command instead of shutil.copy2 to handle permission issues
21
- os.system(f"cp '{source}' '{dest}'")
22
- if not os.path.exists(dest) or os.path.getsize(dest) == 0:
23
- print(f"Failed to copy {source} using system command")
24
- except Exception as e:
25
- print(f"Error copying {source}: {e}")
26
- else:
27
- print(f"Warning: Source video not found or empty: {source}")
28
-
29
- # Add a new column to catalog_df for video path
30
- catalog_df["video_path"] = catalog_df.apply(
31
- lambda row: f"{output_dir}/{row['openreview_id']}_{row['slideslive_id']}.mp4"
32
- if row["slideslive_id"] is not None
33
- else None,
34
- axis=1,
35
- )