[15] catch move failures

pull/1179/head
meisnate12 2 years ago
parent 01fe48828f
commit c43f410e78

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

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

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

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

@ -545,7 +545,11 @@ class Plex(Library):
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex) @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def moveItem(self, obj, item, after): 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) @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def query(self, method): def query(self, method):

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

@ -123,7 +123,7 @@ from modules import util
util.logger = logger util.logger = logger
from modules.builder import CollectionBuilder from modules.builder import CollectionBuilder
from modules.config import ConfigFile 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): def my_except_hook(exctype, value, tb):
if issubclass(exctype, KeyboardInterrupt): 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" library.status[str(mapping_name)]["status"] = "Skipped Invalid Library Type"
else: else:
library.status[str(mapping_name)]["status"] = "Not Scheduled" library.status[str(mapping_name)]["status"] = "Not Scheduled"
except FilterFailed:
pass
except Failed as e: except Failed as e:
library.notify(e, collection=mapping_name) library.notify(e, collection=mapping_name)
logger.stacktrace() logger.stacktrace()

Loading…
Cancel
Save