From 3a583ad327e7a16352cd11e85a9981afaf656ca2 Mon Sep 17 00:00:00 2001 From: Evan Strat <5790137+evan10s@users.noreply.github.com> Date: Mon, 12 Feb 2024 00:01:16 -0500 Subject: [PATCH] feat(server): Restructure videos directory by label (#92) BREAKING CHANGE: The structure of the videos directory has changed to include video labels as subdirectories, and you will need to adjust your workflow accordingly. Details of the new structure are available in the README at https://github.com/gafirst/match-uploader/blob/main/README.md#video-directory-structure. --- .github/workflows/task-list-checker.yml | 14 +++++ README.md | 45 ++++++++++++++++ .../help/MissingMatchVideosHelp.vue | 4 -- .../help/NameMatchVideoFilesHelp.vue | 36 +++++++++---- .../components/matches/MatchVideoListItem.vue | 13 ++++- .../matches/MatchVideosUploader.vue | 8 +-- client/src/stores/match.ts | 20 +++++-- client/src/types/MatchVideoInfo.ts | 1 + server/.eslintrc.json | 3 +- server/README.md | 2 +- server/package.json | 1 + server/src/models/MatchVideoInfo.ts | 5 +- server/src/repos/FileStorageRepo.ts | 18 +++++-- server/src/repos/YouTubeRepo.ts | 19 ++++++- server/src/services/MatchesService.ts | 54 +++++++------------ server/src/tasks/uploadVideo.ts | 54 ++++++++++++++++++- server/src/util/{file.ts.ts => file.ts} | 0 server/yarn.lock | 53 +++++++++++++++--- 18 files changed, 275 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/task-list-checker.yml rename server/src/util/{file.ts.ts => file.ts} (100%) diff --git a/.github/workflows/task-list-checker.yml b/.github/workflows/task-list-checker.yml new file mode 100644 index 0000000..0a26cdd --- /dev/null +++ b/.github/workflows/task-list-checker.yml @@ -0,0 +1,14 @@ +# https://github.com/Shopify/task-list-checker +name: pr +on: + pull_request: + types: [opened, edited, synchronize, reopened] +jobs: + task-list-checker: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }} + steps: + - name: Check for incomplete task list items + uses: Shopify/task-list-checker@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index c16ead2..839f47f 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,50 @@ To get started: 4. YouTube playlist mappings: If you have playlists that you'd like match videos added to, follow the instructions in this section to set this up. 5. Video description template: While no warning appears for this, you should double-check that the default video description template fits your needs and adjust it as needed. + 6. Read below on how to structure your `videos` directory, which is where you'll place the video files for matches. + +### Video directory structure + +Match Uploader expects a specific directory structure for your videos. When running Match Uploader in Docker, you can +mount any directory (such as one that your video production software writes recordings to) as the videos volume (for +specifics, see [Docker volumes](#docker-volumes), below). + +The expected directory structure is as follows: +``` +videos/ +├─ unlabeled/ +│ ├─ Qualification 1.mp4 +├─ $LABEL/ +│ ├─ Qualification 1.mp4 +``` + +> [!TIP] +> The `.mp4` video extension is just an example. You can use any file type that YouTube supports. + +A video label is an extra description for when you have multiple videos to upload for one match. Match Uploader will +include the video label in the middle of the video title, e.g., `Qualification Match 1 - $LABEL - Event Name`. + +**What if I don't want a label in the video title?** A video with no label is labeled `unlabeled` (so you would put +videos that should be unlabeled in a directory called `unlabeled`). This will title the video like +`Qualification Match 1 - Event Name`. + +After being uploaded, videos are moved to a directory called `uploaded` within each label directory. (You don't need to +create the `uploaded` directories; they'll get created automatically when needed.) For instance: +``` +videos/ +├─ unlabeled/ +│ ├─ uploaded/ +│ │ ├─ Qualification 1.mp4 +| ├─ Qualification 2.mp4 +├─ $LABEL/ +│ ├─ uploaded/ +│ │ ├─ Qualification 1.mp4 +| ├─ Qualification 2.mp4 +``` + +> [!CAUTION] +> Don't mount your videos directory as a read-only Docker volume. Otherwise, the server won't be able to move videos to +> the `uploaded` directories. ### Docker Compose setup in-depth @@ -76,6 +120,7 @@ defined in the file that are not specified below; please leave those intact. There are 3 required Docker volumes for the `web` and `worker` containers: - **Videos:** Mount your local videos directory as a volume to `/home/node/app/server/videos` + - The directory structure is described in [Video directory structure](#video-directory-structure) - **Environment variables:** Server environment variables located in `/home/node/app/server/env` - Make a copy of [`server/env/production.env.example`](server/env/production.env.example) and fill in the values. Descriptions of what you need to fill in are described [above](#environment-variables). diff --git a/client/src/components/help/MissingMatchVideosHelp.vue b/client/src/components/help/MissingMatchVideosHelp.vue index 5f40b66..c0817a9 100644 --- a/client/src/components/help/MissingMatchVideosHelp.vue +++ b/client/src/components/help/MissingMatchVideosHelp.vue @@ -9,10 +9,6 @@
  • Ensure your video files are named correctly (review How to name match video files).
  • -
  • - Go to Settings and confirm that the value of the Video search directory - setting is correct. -
  • diff --git a/client/src/components/help/NameMatchVideoFilesHelp.vue b/client/src/components/help/NameMatchVideoFilesHelp.vue index d858fff..c37ca6d 100644 --- a/client/src/components/help/NameMatchVideoFilesHelp.vue +++ b/client/src/components/help/NameMatchVideoFilesHelp.vue @@ -5,6 +5,14 @@ How to name match video files +

    + For a more detailed explanation, see the + + Video directory structure section in the Match Uploader README. +

    +

    File name matching is not case-sensitive.


    @@ -12,19 +20,27 @@ accepted for uploads on YouTube.


    +

    + Within the videos directory, place match videos within subdirectories for each video label (or + use unlabeled for no label) that you have: +

    +
    +videos/
    +├─ unlabeled/
    +│  ├─ Qualification 1.mp4
    +│  ├─ Qualification 2.mp4
    +├─ $LABEL/
    +│  ├─ Qualification 1.mp4
    +│  ├─ Qualification 2.mp4
    +        
    Qualification matches: -
    Qualification #[ Label].mp4
    -
    Qualification #[ Label].mp4
    -

    Examples: Qualification 1.mp4, Qualification 1 Overhead.mp4, Qualification 1.wav

    +
    $Label/Qualification #.mp4
    +

    Examples: unlabeled/Qualification 1.mp4, Overhead/Qualification 1.mp4


    Double elimination playoff matches: -
    Playoff #[ Label].mp4
    -
    - Best of 3 playoff matches: -
    Quarterfinal #[ Label].mp4
    -
    Semifinal #[ Label].mp4
    -
    Final #[ Label].mp4
    - +
    $Label/Playoff #.mp4
    +
    $Label/Final #.mp4
    +

    Examples: Overhead/Playoff 10.mp4, Feed B/Final 1.mp4


    Be sure to set your playoff type in Settings so we know how to parse your playoff matches!
    diff --git a/client/src/components/matches/MatchVideoListItem.vue b/client/src/components/matches/MatchVideoListItem.vue index a4a3207..dc99467 100644 --- a/client/src/components/matches/MatchVideoListItem.vue +++ b/client/src/components/matches/MatchVideoListItem.vue @@ -8,7 +8,7 @@ size="large" /> -