Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mason-larobina committed Nov 1, 2023
0 parents commit 184821c
Show file tree
Hide file tree
Showing 7 changed files with 726 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.txt
Cargo.lock
debug/
target/
20 changes: 20 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "classi-cine"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/mason-larobina/classi-cine"
readme = "README.md"
authors = ["Mason Larobina <mason.larobina@pm.me>"]
description = "A filename based interactive video tagging tool."
license = "MIT"
keywords = ["bayes", "classification", "tokenization", "inference", "vlc"]
categories = ["command-line-utilities"]

[dependencies]
serde = { version = "*", features = ["derive"] }
serde_json = "*"
clap = { version = "*", features = ["derive"] }
walkdir = "*"
env_logger = "*"
log = "*"
reqwest = { version = "*", features = ["blocking"] }
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Mason Larobina

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
![classi-cine](classi-cine.png)

# Classi-Cine

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Classi-Cine** is a Rust-based tool that utilizes a Naive Bayes classifier for
filename-based video tagging. It offers a user-directed classification approach
by interacting with VLC's playback states via its http interface.

The first iteration of this tool is being used to help find and tag videos for
deletion based on learned features (words, tokens, ngrams) in the video
filepaths. The tag names "keep" and "delete" are arbitrary and can be
overridden. For example, you could use this as a video recommendation engine
for local video files. Stopping playback will train and recommend other similar
video files.

## Key Features

- **Interactive Training:** Pause (Shortcut: space) to tag a video as "keep" or
stop (Shortcut: s) to tag it as "delete".
- **Dynamic Re-ranking:** The classifier updates and re-ranks videos based on
user input.
- **Customizable Tags:** The "keep" and "delete" tags can be customized, making
this tool versatile for different applications.

## Installation

VLC is required for video playback.

Ensure you have Rust and Cargo installed. If not, you can install them using
rustup.

```bash
# Clone this repository
$ git clone https://github.com/mason-larobina/classi-cine.git

# Go into the repository
$ cd classi-cine

# Build and install it locally
$ cargo install --path=.
```

## Usage

```bash
Usage: classi-cine [OPTIONS] <PATHS>...

Arguments:
<PATHS>...

Options:
-k <K> [default: 3]
--delete <DELETE> [default: delete.txt]
--keep <KEEP> [default: keep.txt]
--log-level <LOG_LEVEL> [default: info]
--video-exts <VIDEO_EXTS> [default: avi,flv,mov,f4v,flv,m2ts,m4v,mkv,mpg,webm,wmv,mp4]
-h, --help Print help
```

## How it works

1. **Discover Video Files:** Locates all video files within the given
directories.
1. **Tokenization:** Words in the video file paths are tokenized and
post-processed to handle unique and common tokens.
1. **Initialize Classifier:** Loads previous tag states from file lists into the
classifier.
1. **Re-ranking:** Determines the next untagged video files to process ranked by
most likely to be tagged based on the features in the video filepath.
1. **Interact with VLC:** Launches VLC with the http interface.
1. **User Feedback Loop:** The classifier and video ranking adapt based on
whether playback is paused or stopped to train the classifier, re-rank and
open the next likely video for tagging.

## Contributing

We're open to contributions! Enhancements, bug fixes, documentation
improvements, and more are all welcome.

## License

This project is licensed under the MIT License. See LICENSE for details.

## Special Thanks

Made with ❤️ and Rust.
Binary file added classi-cine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 184821c

Please sign in to comment.