Skip to content

Commit

Permalink
fix: telegram doesn't like some movie posters #49
Browse files Browse the repository at this point in the history
ver: 2.1.4
  • Loading branch information
toddrob99 committed Apr 28, 2022
1 parent e1238d5 commit e10111d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions searcharr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import sonarr
import settings

__version__ = "2.1.3"
__version__ = "2.1.4"

DBPATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")
DBFILE = "searcharr.db"
Expand Down Expand Up @@ -382,7 +382,7 @@ def cmd_movie(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -453,7 +453,7 @@ def cmd_series(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -591,7 +591,7 @@ def callback(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -641,7 +641,7 @@ def callback(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -704,7 +704,7 @@ def callback(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -786,7 +786,7 @@ def callback(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -851,7 +851,7 @@ def callback(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -905,7 +905,7 @@ def callback(self, update, context):
reply_markup=reply_markup,
)
except BadRequest as e:
if str(e) == "Wrong type of the web page content":
if str(e) in self._bad_request_poster_error_messages:
logger.error(
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
)
Expand Down Expand Up @@ -1761,6 +1761,11 @@ def _xlate(self, key, **kwargs):
logger.error(f"No translation found for key [{key}]!")
return "(translation not found)"

_bad_request_poster_error_messages = [
"Wrong type of the web page content",
"Wrong file identifier/http url specified",
]


if __name__ == "__main__":
args = parse_args()
Expand Down

0 comments on commit e10111d

Please sign in to comment.