Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ jobs:
python-version: [ '3.11', '3.12', '3.13', '3.14' ]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python --version

- name: Install poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.2.1'
poetry-version: '2.4.0'

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'videohashes/go.mod'
cache-dependency-path: 'videohashes/go.sum'
Expand All @@ -50,12 +50,12 @@ jobs:
fi
shell: bash

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v6
with:
version: 10

- name: Install Node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
cache: 'pnpm'
node-version: '24'
Expand All @@ -70,20 +70,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.13'
python-version: '3.14'

- name: Display Python version
run: python --version

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'videohashes/go.mod'
cache-dependency-path: 'videohashes/go.sum'
Expand All @@ -100,16 +100,16 @@ jobs:
shell: bash

- name: Install poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.2.1'
poetry-version: '2.4.0'

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v6
with:
version: 10

- name: Install Node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
cache: 'pnpm'
node-version: '24'
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

Expand All @@ -154,22 +154,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.13'
python-version: '3.14'

- name: Display Python version
run: python --version

- name: install poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.2.1'
poetry-version: '2.4.0'

- name: create tag from pyproject version on change.
id: auto-tag
Expand Down Expand Up @@ -199,25 +199,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.13'

- name: Display Python version
run: python --version

- name: Install poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.2.1'
poetry-version: '2.4.0'

- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: 'videohashes/go.mod'
cache-dependency-path: 'videohashes/go.sum'
Expand All @@ -233,11 +233,11 @@ jobs:
fi
shell: bash

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v6
with:
version: 10

- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
cache: 'pnpm'
node-version: '24'
Expand Down Expand Up @@ -277,7 +277,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

Expand Down
21 changes: 3 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
FROM ubuntu:latest AS base
FROM python:3.14-trixie AS base

ENV PATH="/root/.local/bin:$PATH"
ENV TZ=Europe/London
ARG DEBIAN_FRONTEND=noninteractive

# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3-pip \
python3 \
pipx \
ffmpeg \
tzdata \
Expand All @@ -25,29 +21,18 @@ RUN apt-get update \
libssl-dev \
systemd \
systemd-sysv \
python3-dev \
python3-venv \
wget \
gnupg2 \
xvfb \
golang \
git \
chromium \
&& rm -rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean

ENV DISPLAY=:99
ARG CHROME_VERSION="google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -qqy \
&& apt-get -qqy install \
${CHROME_VERSION:-google-chrome-stable} \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

RUN pipx install poetry
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
RUN . /root/.bashrc && nvm install 24
RUN . /root/.bashrc && npm i -g pnpm@latest-10

Expand Down
6 changes: 3 additions & 3 deletions namer/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@

import argparse
import gzip
from dataclasses import dataclass
import os
import shutil
import sys
from dataclasses import dataclass
from pathlib import Path
from platform import system
from typing import Iterable, List, Optional, Sequence, Tuple

import jsonpickle
from loguru import logger

from namer.comparison_results import ComparisonResults, LookedUpFileInfo, SceneType
from namer.configuration import NamerConfig
from namer.configuration_utils import default_config
from namer.ffmpeg import FFProbeResults
from namer.fileinfo import parse_file_name, FileInfo
from namer.comparison_results import ComparisonResults, LookedUpFileInfo, SceneType
from namer.fileinfo import FileInfo, parse_file_name


# noinspection PyDataclass
Expand Down
10 changes: 6 additions & 4 deletions namer/comparison_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Performer:
"""

name: str
disambiguation: Optional[str]
alias: Optional[str]
role: Optional[str]
image: Optional[Union[Path, str]]
Expand All @@ -28,21 +29,22 @@ class Performer:
Other performers are also used in name matching, if females are attempted first.
"""

def __init__(self, name, role=None, image=None, alias=None):
def __init__(self, name, role=None, image=None, alias=None, disambiguation=None):
self.name = name
self.disambiguation = disambiguation
self.alias = alias
self.role = role
self.image = image

def __str__(self):
name = 'Unknown' if self.name is None else self.name
if self.role:
return name + ' (' + self.role + ')'
if self.disambiguation:
return name + ' (' + self.disambiguation + ')'

return name

def __repr__(self):
return f'Performer[name={self.name}, role={self.role}, image={self.image}, alias={self.alias}]'
return f'Performer[name={self.name}, role={self.role}, image={self.image}, alias={self.alias}, disambiguation={self.disambiguation}]'


class SceneType(str, Enum):
Expand Down
8 changes: 7 additions & 1 deletion namer/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from enum import Enum
from pathlib import Path
from typing import Dict, List, Optional, Pattern, Sequence
from configupdater import ConfigUpdater

import orjson
from configupdater import ConfigUpdater
from requests_cache import CachedSession

from namer import database
Expand Down Expand Up @@ -358,6 +358,11 @@ class NamerConfig:
Mark any matched video as "collected" in TPDB, allowing TPDB to keep track of videos you have collected.
"""

use_disambiguation: bool = False
"""
Use disambiguation for performer names?
"""

require_match_phash_top: int = 3
"""
If there is a PHASH match, require any name match be in the top N results
Expand Down Expand Up @@ -598,6 +603,7 @@ def to_dict(self) -> dict:
'default_genre': self.default_genre,
'language': self.language,
'mark_collected': self.mark_collected,
'use_disambiguation': self.use_disambiguation,
},
'Watchdog Config': {
'ignored_dir_regex': self.ignored_dir_regex.pattern,
Expand Down
5 changes: 3 additions & 2 deletions namer/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import re
import shutil
from importlib import resources
from typing import Dict, List, Optional, Callable, Pattern, Any, Tuple
from configupdater import ConfigUpdater
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Pattern, Tuple

import orjson
from configupdater import ConfigUpdater
from loguru import logger

from namer import database
Expand Down Expand Up @@ -278,6 +278,7 @@ def set_boolean(updater: ConfigUpdater, section: str, key: str, value: bool) ->
'max_ffmpeg_workers': ('Phash', to_int, from_int),
'use_gpu': ('Phash', to_bool, from_bool),
'mark_collected': ('metadata', to_bool, from_bool),
'use_disambiguation': ('metadata', to_bool, from_bool),
'write_nfo': ('metadata', to_bool, from_bool),
'enabled_tagging': ('metadata', to_bool, from_bool),
'enabled_poster': ('metadata', to_bool, from_bool),
Expand Down
8 changes: 4 additions & 4 deletions namer/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
See: https://iso639-3.sil.org/code_tables/639/data/ for language codes.
"""

import re
import shutil
import string
import subprocess
from contextlib import suppress
from dataclasses import dataclass
import shutil
import string
import re
from functools import lru_cache
from io import BytesIO
from pathlib import Path
Expand All @@ -21,8 +21,8 @@
import ffmpeg
import orjson
from loguru import logger
from PIL import Image
from pathvalidate import ValidationError
from PIL import Image

from namer.videophash.videophashstash import StashVideoPerceptualHash

Expand Down
2 changes: 1 addition & 1 deletion namer/fileinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Parse string in to FileNamePart define in namer_types.
"""

from dataclasses import dataclass
import re
from dataclasses import dataclass
from pathlib import PurePath
from typing import List, Optional, Pattern

Expand Down
Loading
Loading