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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ pip-selfcheck.json

# Venv
venv/

# Exceptions
!config_sample.json
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ FROM ubuntu:latest
# Set the working directory
WORKDIR /app

# Install Python 3 and pip
# Install Python 3, pip, and venv
# Print out Python and pip versions
RUN echo "[ ] Updating package lists..." && \
apt-get update && \
echo "[ ] Installing Python 3 and pip..." && \
apt-get install -y python3 python3-pip && \
echo "[ ] Installing Python 3, pip, and venv..." && \
apt-get install -y python3 python3-pip python3-venv && \
echo "[ ] Cleaning up package cache..." && \
apt-get clean && \
echo "[ ] Creating a symbolic link for Python 3..." && \
Expand All @@ -18,11 +18,15 @@ RUN echo "[ ] Updating package lists..." && \
python --version && \
pip --version

# Create and activate a virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"

# Copy requirements.txt to the root directory of the image
COPY requirements.txt /requirements.txt

# Install Python dependencies from requirements.txt
RUN python3 -m pip install -r /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt

# Create a symbolic link from /app/plex_dupefinder.py to /plex_dupefinder
RUN ln -s /app/plex_dupefinder.py /plex_dupefinder
Expand All @@ -31,4 +35,4 @@ RUN ln -s /app/plex_dupefinder.py /plex_dupefinder
VOLUME /app

# Define default command
ENTRYPOINT ["/plex_dupefinder"]
ENTRYPOINT ["/plex_dupefinder"]
13 changes: 10 additions & 3 deletions Dockerfile_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Follow these steps to set up the folder structure and retrieve your Python appli
git clone https://github.com/hellblazer315/plex_dupefinder.git app
```

If you would like to use a different branch, instead use:
```
git clone -b {branch name} https://github.com/hellblazer315/plex_dupefinder.git app
```

This command clones your repository and creates the `/app` folder containing all files and directories from the git checkout, including the Dockerfile.

## Building the Docker Image
Expand Down Expand Up @@ -78,10 +83,12 @@ Once the Docker image is built, you can run it as a Docker container using the f

- Replace `plex_dupefinder/app` in the APP_PATH variable with the absolute path to the `app/` directory on your system.

2. If running with `SKIP_OTHER_DUPES=false`, add the `-i` option to the `docker run` command:
2. If running with `SKIP_OTHER_DUPES=false`,`AUTO_DELETE=false`, or if it is a first run (you do not yet have a config.json) add the `-it` option to the `docker run` command:
```
APP_PATH='plex_dupefinder/app'
docker run -i --rm --name plex_dupefinder --env-file $APP_PATH/docker.env -v $APP_PATH:/app plex_dupefinder
docker run -it --rm --name plex_dupefinder --env-file $APP_PATH/docker.env -v $APP_PATH:/app plex_dupefinder
```

The `-i` option ensures interactive mode, allowing input to be sent to the container.
The `-it` option ensures interactive mode, allowing input to be sent to the container.

3. If there is a need for the container to run through a specific network (such as the host network) for the URL to work, add `--net={networkname}`
51 changes: 29 additions & 22 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,30 @@
config_path = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'config.json')

base_config = {
'DRY_RUN': False, # Simulate deletions without applying them
'PLEX_SERVER': 'https://plex.your-server.com', # Plex server URL (https/http)
'PLEX_TOKEN': '', # Plex API token (fetched via login or manually set)
'PLEX_LIBRARIES': {}, # Plex libraries to scan (e.g., ['Movies', 'TV'])
'RUNTIME': { # Overarching category for settings that affect the runtime
'DRY_RUN': False, # Simulate deletions without applying them
'AUTO_DELETE': False, # Whether to auto-delete lowest scored dupes
'FIND_DUPLICATE_FILEPATHS_ONLY': False, # Only mark duplicates with identical filepaths
'SKIP_OTHER_DUPES': False, # Skip interactive/automatic deletion of other duplicates
'FIND_UNAVAILABLE': False, # Try to remove missing media files from Plex
'FIND_EXTRA_TS': False, # Remove .ts files when other copies exist
'SKIP_PLEX_VERSIONS_FOLDER': True, # Skip Plex Versions folder contents
'LOGGING_TIMEZONE': 'UTC' # Timezone used for logging timestamps
},
'PLEX': { # Overarching category for Plex server settings
'LIBRARIES': {}, # Plex libraries to scan (e.g., ['Movies', 'TV'])
'SERVER_URL': 'https://plex.your-server.com', # Plex server URL (https/http)
'AUTH_TOKEN': '', # Plex API token (fetched via login or manually set)
},
'SCORING': { # Overarching category for enabling/disabling various scoring options
'VIDEO_HEIGHT_MULTIPLIER': 2, # Used in scoring: height (in pixels) * multiplier
'SCORE_FILESIZE': True, # Include file size in scoring
'SCORE_AUDIOCHANNELS': True, # Include audio channel count in scoring
'SCORE_VIDEOBITRATE': { # Bitrate score multiplier
'enabled': True,
'multiplier': 2
},
},
'AUDIO_CODEC_SCORES': { # Custom audio codec scoring
'Unknown': 0, 'wmapro': 200, 'mp2': 500, 'mp3': 1000, 'ac3': 1000, 'dca': 2000, 'pcm': 2500,
'flac': 2500, 'dca-ma': 4000, 'truehd': 4500, 'aac': 1000, 'eac3': 1250},
Expand All @@ -28,20 +48,7 @@
'Unknown': 0, '4k': 20000, '1080': 10000, '720': 5000, '480': 3000, 'sd': 1000},
'FILENAME_SCORES': {}, # Keyword pattern scoring (e.g. *Remux*)
'SKIP_LIST': [], # Filenames or folders to always skip
'SCORE_FILESIZE': True, # Include file size in scoring
'SCORE_AUDIOCHANNELS': True, # Include audio channel count in scoring
'SCORE_VIDEOBITRATE': { # Bitrate score multiplier
'enabled': True,
'multiplier': 2
},
'VIDEO_HEIGHT_MULTIPLIER': 2, # Used in scoring: height * multiplier
'AUTO_DELETE': False, # Whether to auto-delete lowest scored dupes
'SKIP_OTHER_DUPES': False, # Skip interactive/automatic deletion of other duplicates
'SKIP_PLEX_VERSIONS_FOLDER': True, # Skip Plex Versions folder contents
'FIND_UNAVAILABLE': False, # Try to remove missing media files from Plex
'FIND_EXTRA_TS': False, # Remove .ts files when other copies exist
'FIND_DUPLICATE_FILEPATHS_ONLY': False, # Only mark duplicates with identical filepaths
'LOGGING_TIMEZONE': 'UTC' # Timezone used for logging timestamps

}
cfg = None

Expand All @@ -58,14 +65,14 @@ def prefilled_default_config(configs):
default_config = base_config.copy()

# Set the token and server url
default_config['PLEX_SERVER'] = configs['url']
default_config['PLEX_TOKEN'] = configs['token']
default_config['PLEX']['SERVER_URL'] = configs['url']
default_config['PLEX']['AUTH_TOKEN'] = configs['token']

# Set AUTO_DELETE config option
default_config['AUTO_DELETE'] = configs['auto_delete']
default_config['RUNTIME']['AUTO_DELETE'] = configs['auto_delete']

# Set Sections/Libraries
default_config['PLEX_LIBRARIES'] = [
default_config['PLEX']['LIBRARIES'] = [
'Movies',
'TV'
]
Expand Down
51 changes: 31 additions & 20 deletions config_sample.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
{
"LOGGING_TIMEZONE": "UTC",
"RUNTIME":{
"DRY_RUN":false,
"AUTO_DELETE": false,
"FIND_DUPLICATE_FILEPATHS_ONLY": false,
"SKIP_OTHER_DUPES": false,
"FIND_UNAVAILABLE": false,
"FIND_EXTRA_TS": false,
"SKIP_PLEX_VERSIONS_FOLDER": true,
"LOGGING_TIMEZONE": "UTC"
},
"PLEX":{
"LIBRARIES": [
"Movies",
"TV"
],
"SERVER_URL": "https://plex.your-server.com",
"AUTH_TOKEN": ""
},
"SCORING":{
"VIDEO_HEIGHT_MULTIPLIER": 2,
"SCORE_AUDIOCHANNELS": true,
"SCORE_FILESIZE": true,
"SCORE_VIDEOBITRATE": {
"enabled": true,
"multiplier": 2
}
},
"AUDIO_CODEC_SCORES": {
"Unknown": 0,
"aac": 1000,
Expand All @@ -14,8 +40,6 @@
"truehd": 4500,
"wmapro": 200
},
"AUTO_DELETE": false,
"FIND_DUPLICATE_FILEPATHS_ONLY": false,
"FILENAME_SCORES": {
"*.avi": -1000,
"*.ts": -1000,
Expand All @@ -35,21 +59,7 @@
"*WEB*TROLLHD*": 2500,
"*WEB*VISUM*": 5000,
"*dvd*": -1000
},
"PLEX_LIBRARIES": [
"Movies",
"TV"
],
"PLEX_SERVER": "https://plex.your-server.com",
"PLEX_TOKEN": "",
"SCORE_FILESIZE": true,
"SCORE_VIDEOBITRATE": {
"enabled": true,
"multiplier": 2
},
"SCORE_AUDIOCHANNELS": true,
"VIDEO_HEIGHT_MULTIPLIER": 2,
"SKIP_LIST": [],
},
"VIDEO_CODEC_SCORES": {
"Unknown": 0,
"h264": 10000,
Expand All @@ -73,5 +83,6 @@
"720": 5000,
"Unknown": 0,
"sd": 1000
}
}
},
"SKIP_LIST": []
}
Loading