[15] catch move failures

This commit is contained in:
meisnate12 2022-11-12 11:42:53 -05:00
parent 01fe48828f
commit c43f410e78
7 changed files with 43 additions and 37 deletions

View file

@ -1 +1 @@
1.18.0-develop14
1.18.0-develop15

View file

@ -8,12 +8,12 @@ This sections aims to answer the most commonly asked questions that users have.
### "How do I update to the latest version of Plex Meta Manager?"
[type this into your terminal]
````{tab} OS X/Linux
<br/>
[type this into your terminal]
```
cd /Users/mroche/Plex-Meta-Manager
git pull
@ -21,13 +21,13 @@ source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Windows
<br/>
[type this into your terminal]
```
cd C:\Users\mroche\Plex-Meta-Manager
git pull
@ -35,29 +35,27 @@ git pull
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Docker
<br/>
[type this into your terminal]
```
docker pull meisnate12/plex-meta-manager
```
<br/>
````
### "How do I switch to the develop branch?"
[type this into your terminal]
````{tab} OS X/Linux
<br/>
[type this into your terminal]
```
cd /Users/mroche/Plex-Meta-Manager
git checkout develop
@ -66,13 +64,13 @@ source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Windows
<br/>
[type this into your terminal]
```
cd C:\Users\mroche\Plex-Meta-Manager
git checkout develop
@ -81,18 +79,16 @@ git pull
python -m pip install -r requirements.txt
```
<br/>
````
### "How do I switch to the nightly branch"
[type this into your terminal]
````{tab} OS X/Linux
<br/>
[type this into your terminal]
```
cd /Users/mroche/Plex-Meta-Manager
git checkout nightly
@ -101,13 +97,13 @@ source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Windows
<br/>
[type this into your terminal]
```
cd C:\Users\mroche\Plex-Meta-Manager
git checkout nightly
@ -116,18 +112,16 @@ git pull
python -m pip install -r requirements.txt
```
<br/>
````
### "How do I switch back to the master branch?"
[type this into your terminal]
````{tab} OS X/Linux
<br/>
[type this into your terminal]
```
cd /Users/mroche/Plex-Meta-Manager
git checkout master
@ -136,13 +130,13 @@ source pmm-venv/bin/activate
python -m pip install -r requirements.txt
```
<br/>
````
````{tab} Windows
<br/>
[type this into your terminal]
```
cd C:\Users\mroche\Plex-Meta-Manager
git checkout master
@ -151,8 +145,6 @@ git pull
python -m pip install -r requirements.txt
```
<br/>
````
## Knowledgebase

View file

@ -452,7 +452,6 @@ class CollectionBuilder:
else:
raise Failed(str(e))
if "delete_not_scheduled" in methods and not self.overlay:
logger.debug("")
logger.debug("Validating Method: delete_not_scheduled")
@ -2732,11 +2731,14 @@ class CollectionBuilder:
items = self.library.get_filter_items(search_data[2])
previous = None
for i, item in enumerate(items, 0):
if len(self.items) <= i or item.ratingKey != self.items[i].ratingKey:
text = f"after {util.item_title(previous)}" if previous else "to the beginning"
logger.info(f"Moving {util.item_title(item)} {text}")
self.library.moveItem(self.obj, item, previous)
previous = item
try:
if len(self.items) <= i or item.ratingKey != self.items[i].ratingKey:
text = f"after {util.item_title(previous)}" if previous else "to the beginning"
self.library.moveItem(self.obj, item, previous)
logger.info(f"Moving {util.item_title(item)} {text}")
previous = item
except Failed:
logger.error(f"Moving {util.item_title(item)} Failed")
def sync_trakt_list(self):
logger.info("")

View file

@ -2,7 +2,7 @@ import os, re, time
from datetime import datetime
from modules import plex, util, overlay
from modules.builder import CollectionBuilder
from modules.util import Failed, NonExisting, NotScheduled
from modules.util import Failed, FilterFailed, NonExisting, NotScheduled
from num2words import num2words
from plexapi.exceptions import BadRequest
from plexapi.video import Movie, Show, Season, Episode
@ -413,10 +413,16 @@ class Overlays:
logger.info("")
except NotScheduled as e:
logger.info(e)
except FilterFailed:
pass
except Failed as e:
logger.stacktrace()
logger.error(e)
logger.info("")
except Exception as e:
logger.stacktrace()
logger.error(f"Unknown Error: {e}")
logger.info("")
logger.separator(f"Overlay Operation for the {self.library.name} Library")
logger.debug("")

View file

@ -545,7 +545,11 @@ class Plex(Library):
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def moveItem(self, obj, item, after):
obj.moveItem(item, after=after)
try:
obj.moveItem(item, after=after)
except (BadRequest, NotFound, Unauthorized) as e:
logger.error(e)
raise Failed("Move Failed")
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def query(self, method):

View file

@ -56,7 +56,7 @@ def retry_if_not_failed(exception):
return not isinstance(exception, Failed)
def retry_if_not_plex(exception):
return not isinstance(exception, (BadRequest, NotFound, Unauthorized))
return not isinstance(exception, (BadRequest, NotFound, Unauthorized, Failed))
days_alias = {
"monday": 0, "mon": 0, "m": 0,

View file

@ -123,7 +123,7 @@ from modules import util
util.logger = logger
from modules.builder import CollectionBuilder
from modules.config import ConfigFile
from modules.util import Failed, NonExisting, NotScheduled, Deleted
from modules.util import Failed, FilterFailed, NonExisting, NotScheduled, Deleted
def my_except_hook(exctype, value, tb):
if issubclass(exctype, KeyboardInterrupt):
@ -719,6 +719,8 @@ def run_collection(config, library, metadata, requested_collections):
library.status[str(mapping_name)]["status"] = "Skipped Invalid Library Type"
else:
library.status[str(mapping_name)]["status"] = "Not Scheduled"
except FilterFailed:
pass
except Failed as e:
library.notify(e, collection=mapping_name)
logger.stacktrace()