[55] more mal_search fixes

pull/1227/head
meisnate12 2 years ago
parent 5094f531b7
commit ef0bfbcf58

@ -1 +1 @@
1.18.0-develop54
1.18.0-develop55

@ -55,8 +55,7 @@ libraries:
token: ################################
root_folder_path: S:/Anime
settings:
asset_directory:
config/assets/anime
asset_directory: config/assets/anime
plex:
url: http://192.168.1.12:32400
token: ####################

@ -36,16 +36,17 @@ something like this
Thats a command youre going to type or paste into your terminal (OSX or Linux) or Powershell (Windows).
IMPORTANT NOTE:
This walkthrough is going to be pretty pedantic. Im assuming youre reading it because you have no idea how to get a Docker container going, so Im proceeding from the assumption that you want to be walked through every little detail. Youre going to deliberately cause errors and then fix them as you go through it. This is to help you understand what exactly is going on behind the scenes so that when you see these sorts of problems in the wild you will have some background to understand whats happening. If I only give you the happy path walkthrough, then when you make a typo later on youll have no idea where that typo might be or why its breaking things.
**IMPORTANT NOTES:**
I am assuming you do not have any of these tools already installed. When writing this up I started with a brand new Windows 10 install.
* This walkthrough is going to be pretty pedantic. Im assuming youre reading it because you have no idea how to get a Docker container going, so Im proceeding from the assumption that you want to be walked through every little detail. Youre going to deliberately cause errors and then fix them as you go through it. This is to help you understand what exactly is going on behind the scenes so that when you see these sorts of problems in the wild you will have some background to understand whats happening. If I only give you the happy path walkthrough, then when you make a typo later on youll have no idea where that typo might be or why its breaking things.
I'm also assuming you are doing this on a computer, not through a NAS interface or the like. You can do all this through something like the Synology NAS UI or Portainer or the like, but those aren't documented here. This uses the docker command line because it works the same on all platforms.
* I am assuming you do not have any of these tools already installed. When writing this up I started with a brand new Windows 10 install.
You may want to take an hour to get familiar with Docker fundamentals with the [official tutorial](https://www.docker.com/101-tutorial/).
* I'm also assuming you are doing this on a computer, not through a NAS interface or the like. You can do all this through something like the Synology NAS UI or Portainer or the like, but those aren't documented here. This uses the docker command line because it works the same on all platforms.
DO NOT MAKE ANY CHANGES BELOW if you want this to just work. Don't change the docker image [`linuxserver.io` will not work for this, for example]; don't change the paths, etc.
* You may want to take an hour to get familiar with Docker fundamentals with the [official tutorial](https://www.docker.com/101-tutorial/).
* DO NOT MAKE ANY CHANGES BELOW if you want this to just work. Don't change the docker image [`linuxserver.io` will not work for this, for example]; don't change the paths, etc.
### Installing Docker.
@ -56,17 +57,13 @@ The Docker install is discussed here: [Installing Docker](https://docs.docker.co
Once you have Docker installed, test it at the command line with:
[type this into your terminal]
```
docker run --rm hello-world
```
You should see something that starts with:
```
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
```
@ -143,82 +140,55 @@ pwd
This will display a full path:
````{tab} Linux
<br/>
```
/home/YOURUSERNAME/plex-meta-manager
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
```
/Users/YOURUSERNAME/plex-meta-manager
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
```
C:\Users\YOURUSERNAME\plex-meta-manager
```
<br/>
````
Add "config" onto the end of that to get the host path to your config directory, for example:
````{tab} Linux
<br/>
```
/home/YOURUSERNAME/plex-meta-manager/config
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
```
/Users/YOURUSERNAME/plex-meta-manager/config
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
```
C:\Users\YOURUSERNAME\plex-meta-manager\config
```
<br/>
````
You'll need to add this to the docker command every time you run it, like this:
````{tab} Linux
<br/>
```
docker run --rm -it -v "/home/YOURUSERNAME/plex-meta-manager/config:/config:rw" meisnate12/plex-meta-manager
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
```
docker run --rm -it -v "/Users/YOURUSERNAME/plex-meta-manager/config:/config:rw" meisnate12/plex-meta-manager
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
```
docker run --rm -it -v "C:\Users\YOURUSERNAME\plex-meta-manager\config:/config:rw" meisnate12/plex-meta-manager
```
<br/>
````
If you run that command now it will display a similar error to before, but without all the image loading:
@ -232,7 +202,6 @@ Note that I show the example path there.
<details>
<summary>Why did we create that `config' directory?</summary>
<br />
This was done so that from here on in the instructions match between this walkthrough and the [Local walkthrough](local) are the same.
@ -246,31 +215,22 @@ The default config file contains a reference to a directory that will show an er
We'll create it here so the error doesn't show up later.
````{tab} Linux
<br/>
[type this into your terminal]
```
mkdir config/assets
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
mkdir config/assets
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
mkdir config\assets
```
<br/>
````
### Setting up the initial config file
@ -283,30 +243,22 @@ mkdir config\assets
First, make a copy of the template:
````{tab} Linux
<br/>
Get a copy of the template to edit [type this into your terminal]:
```
curl -fLvo config/config.yml https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/config/config.yml.template
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
Get a copy of the template to edit [type this into your terminal]:
```
curl -fLvo config/config.yml https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/config/config.yml.template
```
````
````{tab} Windows:
<br/>
````{tab} Windows
Go to [this URL](https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/config/config.yml.template) using a web browser; choose the "Save" command, then save the file at:
```
C:\Users\YOURUSERNAME\plex-meta-manager\config\config.yml
```
<br/>
````
Now open the copy in an editor:

@ -69,21 +69,17 @@ Since most of this is typing commands into a terminal, you'll need to have a ter
````{tab} Linux
<br/>
If your Linux system is remote to your computer, connect to it via SSH. That SSH session is the terminal you will be using, so leave it open.
If you are running this on a desktop Linux machine, start up the Terminal application. That window will be the terminal you will type commands into throughout this walkthrough, so leave it open.
<br/>
````
````{tab} OS X:
````{tab} OS X
Open the Terminal app; this window will be the place you type commands throughout this walkthrough, so leave it open. The Terminal app is in Applications -> Utilities.
You can also use iTerm or some other terminal app if you wish. If you don't know what that means, use Terminal.
<br/>
````
````{tab} Windows:
````{tab} Windows
Use the Start menu to open PowerShell. This will be the window into which you type commands throughout this walkthrough, so leave it open.
<br/>
````
### Installing Python.
@ -99,21 +95,17 @@ python3 --version
If this doesn't return `3.7.0` or higher, you'll need to get Python 3 installed.
````{tab} Linux
<br/>
Describing a python install for any arbitrary linux is out of scope here, but if you're using Ubuntu, [this](https://techviewleo.com/how-to-install-python-on-ubuntu-linux/) might be useful.
<br/>
````
````{tab} OS X:
````{tab} OS X
Follow the instructions here: [Installing Python 3 on Mac OS X](https://docs.python-guide.org/starting/install3/osx/)
<br/>
````
````{tab} Windows:
Go to http://www.python.org/download and download the latest version of Python for Windows in 32 or 64-bit as appropriate for your system [probably 64-bit]. As this is written, that's 3.10.4.
````{tab} Windows
Go [here](http://www.python.org/download) and download the latest version of Python for Windows in 32 or 64-bit as appropriate for your system [probably 64-bit]. As this is written, that's 3.10.4.
Once downloaded, run the installer. Tick “Add to path” checkbox at the bottom and click “Install Now”.
For Windows 10, you will need to enable scripts in PowerShell. Follow the instructions [here](https://windowsloop.com/enable-powershell-scripts-execution-windows-10) to do so. If you skip this step you're going to hit a hard stop in a little bit.
<br/>
````
---
@ -131,17 +123,12 @@ git --version
If this doesn't return a version number, you'll need to get git installed.
````{tab} Linux
<br/>
The git install is discussed here: [Download for Linux and Unix](https://git-scm.com/download/linux)
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
The git install is discussed here: [Git - Downloading Package](https://git-scm.com/download/mac)
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
Download the installer from [here](https://git-scm.com/download/windows)
Run the install; you can probably just accept the defaults and click through except for the step that asks you to choose an editor; you probably want to choose something other than the default there:
@ -149,7 +136,6 @@ Run the install; you can probably just accept the defaults and click through exc
![Git Install](git-install.png)
This install comes with its own command line interface. **Do not use this interface in this walkthrough**. Continue to do everything here in Powershell.
<br/>
````
---
@ -181,53 +167,38 @@ There are parts of the code that are assuming and expecting that you will be in
<details>
<summary>What did that do?</summary>
<br />
```
cd ~
```
This changes to your home directory, which will be something like `/home/yourname` or `/Users/yourname` or `C:\Users\YourName` depending on the platform.
```
git clone https://github.com/meisnate12/Plex-Meta-Manager
```
This uses `git` to make a copy of (`clone`) the PMM code from where it is stored on `github`.
```
cd Plex-Meta-Manager
```
This moves into the directory that was created by the `clone` command.
</details>
Later on you can move it elsewhere if you want, but for now put it there. This will ensure that everything to follow works just like it says here. Presumably youre reading this because the other docs are unclear to you. Dont make unilateral changes to my assumptions while doing this.
<details>
<summary>Why use git instead of downloading the release ZIP?</summary>
<br />
Retrieving the code with `git` makes updating simpler. When you want to update to the newest version, you can go into this directory and type:
```
git pull
```
No need to download a new ZIP, uncompress it, etc.
Also, if you are asked to [or want to] switch to the latest develop or nightly code, you can do so with:
```
git checkout develop
```
```
git checkout nightly
```
</details>
---
@ -237,67 +208,46 @@ Later on you can move it elsewhere if you want, but for now put it there. This
This walkthrough is going to use a "virtual environment", since that provides a simple way to keep the requirements for a given thing self-contained; think of it as a "sandbox" for this script. It also provides a clean way to recover from mistakes, and keeps the host system clean.
````{tab} Linux
<br/>
[type this into your terminal]
```
python3 -m venv pmm-venv
```
If you see an error like:
```
Error: Command '['/home/mroche/Plex-Meta-Manager/pmm-venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
```
You probably need to make sure the Python 3.9-specific virtualenv support library is installed:
[type this into your terminal]
```
sudo apt-get install python3.9-venv
```
Then try the original venv command above again.
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
python3 -m venv pmm-venv
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
python -m venv pmm-venv
```
If you see:
```
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
```
You apparently didn't check the “Add to path” checkbox above under [installing Python](#installing-python). "Repair" your Python install and check "add python to environment variables".
<br/>
````
<details>
<summary>What did that do?</summary>
<br />
```
python3 -m venv pmm-venv
```
This tells Python3 to use the `venv` module to create a virtual environment called `pmm-venv`. The only visible effect will be the creation of a `pmm-venv` directory.
</details>
That command will not produce any output if it works; it will display an error if a problem occurs. If everything is fine, you will be looking at something like this:
@ -312,32 +262,23 @@ If you aren't looking at an error, you're ready to move on.
That will create the virtual environment, and then you need to activate it:
````{tab} Linux
<br/>
[type this into your terminal]
```
source pmm-venv/bin/activate
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
source pmm-venv/bin/activate
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
.\pmm-venv\Scripts\activate
```
If you see something like this:
```powershell
.\pmm-venv\Scripts\activate : File C:\Users\mroche\Plex-Meta-Manager\pmm-venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink LinkID=135170.
At line:1 char:1
@ -346,13 +287,11 @@ At line:1 char:1
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
```
You apparently skipped the "enable scripts in Powershell" step above under [installing Python](#installing-python) for Windows.
You will need to take care of that before moving on. Follow the instructions [here](https://windowsloop.com/enable-powershell-scripts-execution-windows-10).
Once you have done that, try the activation step again.
<br/>
````
That command will not produce any output if it works; it will display an error if a problem occurs.
@ -368,10 +307,8 @@ Note that the prompt now shows the name of the virtual environment. You may not
<details>
<summary>What did that do?</summary>
<br />
This tells Python to make the virtual environment "active", which means to use the copy of python that is available there, install all support libraries there, etc. This keeps the PMM code and its runtime environment totally separate from your host machine's environment.
</details>
An advantage of doing this in a virtual environment is that in the event something goes wrong with this part of the setup, you can delete that pmm-venv directory and do the setup again.
@ -379,31 +316,22 @@ An advantage of doing this in a virtual environment is that in the event somethi
**IMPORTANT: In the future, when you want to run the script, you will need to do this "activation" step every time. Not the venv creation, just the activation**:
````{tab} Linux
<br/>
[type this into your terminal]
```
source pmm-venv/bin/activate
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
source pmm-venv/bin/activate
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
.\pmm-venv\Scripts\activate
```
<br/>
````
### Installing requirements
@ -437,10 +365,8 @@ Don't worry about the WARNING about `pip version thus-and-such` if it comes up.
<details>
<summary>What did that do?</summary>
<br />
This told Python to use the `pip` module to install some libraries that PMM needs.
</details>
Lets make sure its working so far.
@ -465,31 +391,22 @@ The default config file contains a reference to a directory that will show an er
We'll create it here so the error doesn't show up later.
````{tab} Linux
<br/>
[type this into your terminal]
```
mkdir config/assets
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
mkdir config/assets
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
mkdir config\assets
```
<br/>
````
### Setting up the initial config file
@ -502,31 +419,22 @@ mkdir config\assets
First, make a copy of the template. This is going to create a copy of the base template that you can then edit. You only need to do this once.
````{tab} Linux
<br/>
[type this into your terminal]
```
cp config/config.yml.template config/config.yml
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
cp config/config.yml.template config/config.yml
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
copy .\config\config.yml.template .\config\config.yml
```
<br/>
````
Now open the copy in an editor:
@ -624,48 +532,37 @@ deactivate
### I want to update to the latest version of PMM
````{tab} Linux
<br/>
[type this into your terminal]
```
cd ~/Plex-Meta-Manager
git pull
source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
cd ~/Plex-Meta-Manager
git pull
source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
cd ~\Plex-Meta-Manager
git pull
.\pmm-venv\Scripts\activate
python -m pip install -r requirements.txt
```
<br/>
````
### I want to use the develop branch
````{tab} Linux
<br/>
[type this into your terminal]
```
cd ~/Plex-Meta-Manager
git checkout develop
@ -673,12 +570,9 @@ git pull
source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
cd ~/Plex-Meta-Manager
git checkout develop
@ -686,12 +580,9 @@ git pull
source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
cd ~/Plex-Meta-Manager
git checkout develop
@ -699,7 +590,6 @@ git pull
.\pmm-venv\Scripts\activate
python -m pip install -r requirements.txt
```
<br/>
````
### I want to use the nightly branch

@ -1,5 +1,4 @@
````{tab} Linux
<br/>
[type this into your terminal]
```
@ -23,10 +22,8 @@ sudo apt install nano
```
You can use any other text editor you wish, provided it saves files as PLAIN TEXT. `vi`, `emacs`, etc.
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
[type this into your terminal]
```
@ -36,17 +33,14 @@ nano config/config.yml
Im using `nano` here simply because its built into OSX. You can use any other text editor you wish, provided it saves files as PLAIN TEXT. BBedit, TextMate, VSCode, etc.
A common mistake is using TextEdit.app, which saves files as RTF by default.
<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
[type this into your terminal]
```
notepad .\config\config.yml
```
Im using `notepad` here simply because its built into Windows. You can use any other text editor you wish, provided it saves files as PLAIN TEXT.
<br/>
````
From here on in, when this walkthrough says "open the config file", I mean this `nano` or `notepad` command. **Don't copy the template again**.

@ -1,14 +1,9 @@
````{tab} Linux
<br/>
If you're using `nano`, type control-`x`, then `y`, then the enter key.
<br/>
````
````{tab} OS X:
<br/>
````{tab} OS X
If you're using `nano`, type control-`x`, then `y`, then the enter key.<br/>
````
````{tab} Windows:
<br/>
````{tab} Windows
If you're using `notepad`, type control-`s` or choose `Save` from the `File` menu.
<br/>
````

@ -1427,6 +1427,8 @@ class MetadataFile(DataFile):
for tag_edit in ["genre", "style", "mood", "collection", "label"]:
if self.edit_tags(tag_edit, album, album_dict, album_methods):
updated = True
if not title:
title = album.title
finish_edit(album, f"Album: {title}")
_, _, ups = self.library.item_images(album, album_dict, album_methods, asset_location=asset_location,
title=f"{item.title} Album {album.title}", image_name=album.title, folder_name=folder_name)
@ -1468,6 +1470,8 @@ class MetadataFile(DataFile):
for tag_edit in ["mood", "collection", "label"]:
if self.edit_tags(tag_edit, track, track_dict, track_methods):
updated = True
if not title:
title = track.title
finish_edit(track, f"Track: {title}")
logger.info(f"Track: {track_num} on Album: {title} of {mapping_name} Details Update {'Complete' if updated else 'Not Needed'}")

@ -674,9 +674,9 @@ def check_int(value, datatype="int", minimum=1, maximum=None):
def parse_and_or(error, attribute, data, test_list=None):
out = ""
ands = data.split(",")
ands = [d.strip() for d in data.split(",")]
for an in ands:
ors = an.split("|")
ors = [a.strip() for a in an.split("|")]
for item in ors:
if not item:
raise Failed(f"{error} Error: Cannot have a blank {attribute}")
@ -687,9 +687,9 @@ def parse_and_or(error, attribute, data, test_list=None):
if len(ands) > 1 and len(ors) > 1:
out += "("
if len(ors) > 1:
out += f"{' or '.join([test_list[o] if test_list else o for o in ors])}"
out += ' or '.join([test_list[int(o)] if test_list else o for o in ors])
else:
out += f"{test_list[ors[0]]}" if test_list else f"{ors[0]}"
out += test_list[int(ors[0])] if test_list else ors[0]
if len(ands) > 1 and len(ors) > 1:
out += ")"
return out

Loading…
Cancel
Save