Skip to content

Commit

Permalink
Add data module and prefetched videos in Git LFS.
Browse files Browse the repository at this point in the history
  • Loading branch information
dodijk committed Oct 4, 2022
1 parent 879e657 commit ad4bd11
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 0 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/*.index filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,6 @@ dmypy.json

# Gradio
gradio_cached_examples/

# MacOS
.DS_Store
29 changes: 29 additions & 0 deletions data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
import json
import shutil

from videohash import filepath_from_url

with open('apb2022.json') as filein:
urls, videos, url2video, video2url = [], [], {}, {}
for item in json.load(filein):
urls.append(item['url'])
videos.append(item['mp4'])
url2video[item['url']] = item['mp4']
video2url[item['mp4']] = item['url']

for url in videos:
filepath = filepath_from_url(url) + '.index'
datapath = os.path.join('data', os.path.basename(filepath))
if not os.path.exists(filepath) and os.path.exists(datapath):
shutil.copyfile(datapath, filepath)


if __name__ == "__main__":
from videomatch import get_video_index

for url in videos:
get_video_index(url)
filepath = filepath_from_url(url) + '.index'
datapath = os.path.join('data', os.path.basename(filepath))
shutil.copyfile(filepath, datapath)
3 changes: 3 additions & 0 deletions data/0fd24e056447f6cd068f40ba2e41828c.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/1de5e559d3d190ca09ac3fa6b40a0138.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/265732a300bbe18c4d39df108fe0c121.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/2909574cb590231c5d1028032bd849a8.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/2f71b6c1d5c91c4b73eef2ebd05bd848.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/75617545ba72efdc9a7b2b140184a9c6.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/9c0a24aa59358ee014ded54c88eaa6c1.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/a3efa8f2e01e0964d7987e6b1e4b3b44.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/b3cf94671de7aadc22970483150aafd5.index
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/d0369414718aa9573ff9d009f4f61cc0.index
Git LFS file not shown

0 comments on commit ad4bd11

Please sign in to comment.