Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 bug in postSonarr.py? #386

Closed
Smithoo4 opened this issue Dec 29, 2015 · 4 comments
Closed

Python 3 bug in postSonarr.py? #386

Smithoo4 opened this issue Dec 29, 2015 · 4 comments

Comments

@Smithoo4
Copy link

I believe I have found a Python 3 bug. I am using Sonarr with your script on and Arch Linux install. I have followed the instructions in the README.md file. The outputted mp4s are not being tagged and I get the following info in the info.log; see below.

When I change the first line of postSonarr.py from #!/usr/bin/env python to #!/usr/bin/env python2 everything works fine. In Arch Linux 'python' defaults to python 3.

Let me know if there is any other info that could help you or if this is simply me not knowing what I am doing.

Cheers

2015-12-28 12:18:20 - SonarrPostConversion - INFO - Sonarr extra script post processing started.
2015-12-28 12:18:20 - readSettings - WARNING - Audio bitrate was invalid, defaulting to 256 per channel.
2015-12-28 12:18:20 - SonarrPostConversion - INFO - Processing /media/tv/Blindspot/Season 1/Blindspot - S01E02 - A Stray Howl WEBDL-1080p.mkv.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Reading video stream.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Video codec detected: h264.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Pix Fmt: yuv420p.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Reading audio streams.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Audio detected for stream #1: ac3 [eng].
2015-12-28 12:18:20 - mkvtomp4 - INFO - Creating audio stream 0 from source stream 1.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Reading subtitle streams.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Subtitle detected for stream #2: srt [eng].
2015-12-28 12:18:20 - mkvtomp4 - INFO - Creating subtitle stream 0 from source stream 2.
2015-12-28 12:18:20 - mkvtomp4 - INFO - Starting conversion.
2015-12-28 12:18:31 - mkvtomp4 - INFO - /media/tv/Blindspot/Season 1/Blindspot - S01E02 - A Stray Howl WEBDL-1080p.mp4 created.
2015-12-28 12:18:32 - SonarrPostConversion - INFO - Tagging /media/tv/Blindspot/Season 1/Blindspot - S01E02 - A Stray Howl WEBDL-1080p.mkv with ID 295647 season 1 episode 2.
2015-12-28 12:18:32 - tvdb_mp4 - ERROR - Failed to connect to TVDB, trying again in 20 seconds.
Traceback (most recent call last):
File "/var/lib/sonarr/mp4_automator/tvdb_mp4.py", line 26, in init
self.tvdb_show = Tvdb(interactive=False, cache=False, banners=True, actors=True, forceConnect=True, language=language)
File "/var/lib/sonarr/mp4_automator/tvdb_api/tvdb_api.py", line 433, in init
import requests_cache
ImportError: No module named 'requests_cache'
2015-12-28 12:18:52 - tvdb_mp4 - ERROR - Failed to connect to TVDB, trying again in 20 seconds.
Traceback (most recent call last):
File "/var/lib/sonarr/mp4_automator/tvdb_mp4.py", line 26, in init
self.tvdb_show = Tvdb(interactive=False, cache=False, banners=True, actors=True, forceConnect=True, language=language)
File "/var/lib/sonarr/mp4_automator/tvdb_api/tvdb_api.py", line 433, in init
import requests_cache
ImportError: No module named 'requests_cache'
2015-12-28 12:19:12 - tvdb_mp4 - ERROR - Failed to connect to TVDB, trying again in 20 seconds.
Traceback (most recent call last):
File "/var/lib/sonarr/mp4_automator/tvdb_mp4.py", line 26, in init
self.tvdb_show = Tvdb(interactive=False, cache=False, banners=True, actors=True, forceConnect=True, language=language)
File "/var/lib/sonarr/mp4_automator/tvdb_api/tvdb_api.py", line 433, in init
import requests_cache
ImportError: No module named 'requests_cache'
2015-12-28 12:19:32 - tvdb_mp4 - INFO - Tagging file: /media/tv/Blindspot/Season 1/Blindspot - S01E02 - A Stray Howl WEBDL-1080p.mp4.

@mdhiggins
Copy link
Owner

Looks like your python3 installation is missing the requests-cache package. Running pip install requests-cache should fix this error.

Thanks for pointing this out though, I'll update the readme to reflect this being required as well.

@Smithoo4
Copy link
Author

I have installed requests-cache and I am now no longer getting the prevision error. Thank you for your help.

However I am now getting a different error and PLEX is not getting notified to update. Please see the output of info.log below. Like before if I change back to python2 I no longer get this error.

I am using "PLEX home" so I am using the token option. I double check and everything in autoProcess.ini looks correct. Not sure if this has anything to do with it or not.

Is this a case of me not knowing what I am doing again?

Thank you for your help

2015-12-29 22:06:09 - SonarrPostConversion - INFO - Sonarr extra script post processing started.
2015-12-29 22:06:09 - readSettings - WARNING - Audio bitrate was invalid, defaulting to 256 per channel.
2015-12-29 22:06:09 - SonarrPostConversion - INFO - Processing /media/tv/Blindspot/Season 1/Blindspot - S01E01 - Pilot WEBDL-1080p.mkv.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Reading video stream.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Video codec detected: hevc.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Pix Fmt: yuv420p.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Reading audio streams.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Audio detected for stream #1: aac [eng].
2015-12-29 22:06:09 - mkvtomp4 - INFO - Creating audio stream 0 from source stream 1.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Reading subtitle streams.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Subtitle detected for stream #2: ass [eng].
2015-12-29 22:06:09 - mkvtomp4 - INFO - Creating subtitle stream 0 from source stream 2.
2015-12-29 22:06:09 - mkvtomp4 - INFO - Starting conversion.
2015-12-29 22:29:47 - mkvtomp4 - INFO - /media/tv/Blindspot/Season 1/Blindspot - S01E01 - Pilot WEBDL-1080p.mp4 created.
2015-12-29 22:29:47 - SonarrPostConversion - INFO - Tagging /media/tv/Blindspot/Season 1/Blindspot - S01E01 - Pilot WEBDL-1080p.mkv with ID 295647 season 1 episode 1.
2015-12-29 22:29:48 - tvdb_mp4 - INFO - Tagging file: /media/tv/Blindspot/Season 1/Blindspot - S01E01 - Pilot WEBDL-1080p.mp4.
2015-12-29 22:29:48 - tvdb_mp4 - INFO - Trying to write tags.
2015-12-29 22:29:48 - tvdb_mp4 - INFO - Tags written successfully.
2015-12-29 22:29:48 - mkvtomp4 - INFO - Relocating MOOV atom to start of file.
2015-12-29 22:29:48 - qtfaststart - INFO - Removing free atom at 32 (8 bytes)
2015-12-29 22:29:48 - qtfaststart - INFO - Patching stco with 60637 entries
2015-12-29 22:29:48 - qtfaststart - INFO - Patching stco with 60636 entries
2015-12-29 22:29:48 - qtfaststart - INFO - Patching stco with 1 entries
2015-12-29 22:29:48 - qtfaststart - INFO - Writing output...
2015-12-29 22:29:48 - SonarrPostConversion - ERROR - Unable to refresh plex, check your settings.
Traceback (most recent call last):
File "/var/lib/sonarr/mp4_automator/autoprocess/plex.py", line 34, in refreshPlex
xml_sections = minidom.parse(urllib.urlopen(base_url))
AttributeError: module 'urllib' has no attribute 'urlopen'

@mdhiggins
Copy link
Owner

Looks like another python2 to 3 bug with urllib. Just pushed an update that should resolve the issue. Give it a try.

@Smithoo4
Copy link
Author

I just tested it and everything look to be working correctly.

Thank you for all your help

On Wed, Dec 30, 2015 at 7:29 AM, Michael Higgins notifications@github.com
wrote:

Looks like another python2 to 3 bug with urllib. Just pushed an update
that should resolve the issue. Give it a try.


Reply to this email directly or view it on GitHub
#386 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants