Skip to content

Commit e10111d

Browse files
committed
fix: telegram doesn't like some movie posters #49
ver: 2.1.4
1 parent e1238d5 commit e10111d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

searcharr.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import sonarr
2323
import settings
2424

25-
__version__ = "2.1.3"
25+
__version__ = "2.1.4"
2626

2727
DBPATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")
2828
DBFILE = "searcharr.db"
@@ -382,7 +382,7 @@ def cmd_movie(self, update, context):
382382
reply_markup=reply_markup,
383383
)
384384
except BadRequest as e:
385-
if str(e) == "Wrong type of the web page content":
385+
if str(e) in self._bad_request_poster_error_messages:
386386
logger.error(
387387
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
388388
)
@@ -453,7 +453,7 @@ def cmd_series(self, update, context):
453453
reply_markup=reply_markup,
454454
)
455455
except BadRequest as e:
456-
if str(e) == "Wrong type of the web page content":
456+
if str(e) in self._bad_request_poster_error_messages:
457457
logger.error(
458458
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
459459
)
@@ -591,7 +591,7 @@ def callback(self, update, context):
591591
reply_markup=reply_markup,
592592
)
593593
except BadRequest as e:
594-
if str(e) == "Wrong type of the web page content":
594+
if str(e) in self._bad_request_poster_error_messages:
595595
logger.error(
596596
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
597597
)
@@ -641,7 +641,7 @@ def callback(self, update, context):
641641
reply_markup=reply_markup,
642642
)
643643
except BadRequest as e:
644-
if str(e) == "Wrong type of the web page content":
644+
if str(e) in self._bad_request_poster_error_messages:
645645
logger.error(
646646
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
647647
)
@@ -704,7 +704,7 @@ def callback(self, update, context):
704704
reply_markup=reply_markup,
705705
)
706706
except BadRequest as e:
707-
if str(e) == "Wrong type of the web page content":
707+
if str(e) in self._bad_request_poster_error_messages:
708708
logger.error(
709709
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
710710
)
@@ -786,7 +786,7 @@ def callback(self, update, context):
786786
reply_markup=reply_markup,
787787
)
788788
except BadRequest as e:
789-
if str(e) == "Wrong type of the web page content":
789+
if str(e) in self._bad_request_poster_error_messages:
790790
logger.error(
791791
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
792792
)
@@ -851,7 +851,7 @@ def callback(self, update, context):
851851
reply_markup=reply_markup,
852852
)
853853
except BadRequest as e:
854-
if str(e) == "Wrong type of the web page content":
854+
if str(e) in self._bad_request_poster_error_messages:
855855
logger.error(
856856
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
857857
)
@@ -905,7 +905,7 @@ def callback(self, update, context):
905905
reply_markup=reply_markup,
906906
)
907907
except BadRequest as e:
908-
if str(e) == "Wrong type of the web page content":
908+
if str(e) in self._bad_request_poster_error_messages:
909909
logger.error(
910910
f"Error sending photo [{r['remotePoster']}]: BadRequest: {e}. Attempting to send with default poster..."
911911
)
@@ -1761,6 +1761,11 @@ def _xlate(self, key, **kwargs):
17611761
logger.error(f"No translation found for key [{key}]!")
17621762
return "(translation not found)"
17631763

1764+
_bad_request_poster_error_messages = [
1765+
"Wrong type of the web page content",
1766+
"Wrong file identifier/http url specified",
1767+
]
1768+
17641769

17651770
if __name__ == "__main__":
17661771
args = parse_args()

0 commit comments

Comments
 (0)