Hellowlol / bw_plex

binge watching for plex
MIT License
368 stars 23 forks source link

timestamp out of range for platform localtime()/gmtime() function #65

Closed PearsonFlyer closed 5 years ago

PearsonFlyer commented 5 years ago

On Windows 10 again, when I try to process a show, I get this error every time.

>bw_plex process -n Luther

Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\bw_plex.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\bw_plex\plex.py", line 1048, in real_main
    cli()
  File "c:\python27\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\bw_plex\plex.py", line 378, in process
    medias = find_all_movies_shows()
  File "c:\python27\lib\site-packages\bw_plex\plex.py", line 73, in find_all_movies_shows
    all_shows += section.all()
  File "c:\python27\lib\site-packages\plexapi\library.py", line 383, in all
    return self.fetchItems(key, **kwargs)
  File "c:\python27\lib\site-packages\plexapi\base.py", line 148, in fetchItems
    items = self.findItems(data, cls, ekey, **kwargs)
  File "c:\python27\lib\site-packages\plexapi\base.py", line 169, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "c:\python27\lib\site-packages\plexapi\base.py", line 87, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "c:\python27\lib\site-packages\plexapi\base.py", line 79, in _buildItem
    return ecls(self._server, elem, initpath)
  File "c:\python27\lib\site-packages\plexapi\base.py", line 48, in __init__
    self._loadData(data)
  File "c:\python27\lib\site-packages\plexapi\video.py", line 290, in _loadData
    Video._loadData(self, data)
  File "c:\python27\lib\site-packages\plexapi\video.py", line 33, in _loadData
    self.addedAt = utils.toDatetime(data.attrib.get('addedAt'))
  File "c:\python27\lib\site-packages\plexapi\utils.py", line 181, in toDatetime
    value = datetime.fromtimestamp(int(value))
ValueError: timestamp out of range for platform localtime()/gmtime() function

Please let me know if you need any further info. Thanks!

Hellowlol commented 5 years ago

Can you check the value the xml info about that episode? I wondering what the value of addedAt is

Hellowlol commented 5 years ago

Its a bug (not really a bug, but we should handle errors more gracefully) in plexapi. Ill fix it there :)

Hellowlol commented 5 years ago

I have sent a pr to plexapi. Lets hope that solves the issue.

Hellowlol commented 5 years ago

You can try to install plexapi from GitHub. I think my pr should fix your issue

PearsonFlyer commented 5 years ago

I installed the updated .py files over mine. When I fired up bw_plex watch, I got a bunch of errors, but it ended with this:

File "c:\python27\lib\site-packages\plexapi\utils.py", line 183, in toDatetime value = datetime.datetime(1970, 1, 1) + datetime.fromtimestamp(milliseconds=value) AttributeError: type object 'datetime.datetime' has no attribute 'datetime'

On Mon, Jan 21, 2019 at 2:40 PM Hellowlol notifications@github.com wrote:

You can try to install plexapi from GitHub. I think my pr should fix your issue

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Hellowlol/bw_plex/issues/65#issuecomment-456180454, or mute the thread https://github.com/notifications/unsubscribe-auth/AOxVie4PN7AJaw9qL-DikTvmq8SeMlj9ks5vFhefgaJpZM4aA0bU .

Hellowlol commented 5 years ago

My bad.. should be fixed now

Hellowlol commented 5 years ago

Shit it didnt fix what i had intended. I have to come back to this later.

Hellowlol commented 5 years ago

if fix the error i introduced, just grab a fresh file.

Hellowlol commented 5 years ago

what os are you using and what was the value in the xml?

PearsonFlyer commented 5 years ago

I'm using Windows 10. That's the weird thing. It did this immediately when I started "bw_plex watch", and doesn't appear to be tied to any specific media that I can check. When I try to run a bw_plex process (showname) it doesn't even get far enough to find the first episode of that show - it immediately throws that error. The full error path is:

bw_plex watch Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\Scripts\bw_plex.exe__main.py", line 9, in File "c:\python27\lib\site-packages\bw_plex\plex.py", line 1048, in real_main cli() File "c:\python27\lib\site-packages\click\core.py", line 764, in call__ return self.main(args, kwargs) File "c:\python27\lib\site-packages\click\core.py", line 717, in main rv = self.invoke(ctx) File "c:\python27\lib\site-packages\click\core.py", line 1134, in invoke Command.invoke(self, ctx) File "c:\python27\lib\site-packages\click\core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\python27\lib\site-packages\click\core.py", line 555, in invoke return callback(args, **kwargs) File "c:\python27\lib\site-packages\bw_plex\plex.py", line 235, in cli verify_ssl=verify_ssl) File "c:\python27\lib\site-packages\bw_plex\misc.py", line 55, in get_pms PMS = PlexServer(url, token, sess) File "c:\python27\lib\site-packages\plexapi\server.py", line 104, in init super(PlexServer, self).init(self, data, self.key) File "c:\python27\lib\site-packages\plexapi\base.py", line 48, in init self._loadData(data) File "c:\python27\lib\site-packages\plexapi\server.py", line 146, in _loadData self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) File "c:\python27\lib\site-packages\plexapi\utils.py", line 183, in toDatetime value = datetime.datetime(1970, 1, 1) + datetime.fromtimestamp(milliseconds=value) AttributeError: type object 'datetime.datetime' has no attribute 'datetime'

On Mon, Jan 21, 2019 at 4:18 PM Hellowlol notifications@github.com wrote:

what os are you using and what was the value in the xml?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Hellowlol/bw_plex/issues/65#issuecomment-456201394, or mute the thread https://github.com/notifications/unsubscribe-auth/AOxViX5Ed3TMqF6SqkbryxpP57QKlxRBks5vFi6mgaJpZM4aA0bU .

PearsonFlyer commented 5 years ago

Okay, I grabbed the latest plexapi, and that seems to have resolved the issue. It's no longer throwing that error, and actually starts to grab stuff for things people are watching. Thank you!

On Mon, Jan 21, 2019 at 4:29 PM John Miller john@theediguy.com wrote:

I'm using Windows 10. That's the weird thing. It did this immediately when I started "bw_plex watch", and doesn't appear to be tied to any specific media that I can check. When I try to run a bw_plex process (showname) it doesn't even get far enough to find the first episode of that show - it immediately throws that error. The full error path is:

bw_plex watch Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\Scripts\bw_plex.exe__main.py", line 9, in File "c:\python27\lib\site-packages\bw_plex\plex.py", line 1048, in real_main cli() File "c:\python27\lib\site-packages\click\core.py", line 764, in call__ return self.main(args, kwargs) File "c:\python27\lib\site-packages\click\core.py", line 717, in main rv = self.invoke(ctx) File "c:\python27\lib\site-packages\click\core.py", line 1134, in invoke Command.invoke(self, ctx) File "c:\python27\lib\site-packages\click\core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\python27\lib\site-packages\click\core.py", line 555, in invoke return callback(args, **kwargs) File "c:\python27\lib\site-packages\bw_plex\plex.py", line 235, in cli verify_ssl=verify_ssl) File "c:\python27\lib\site-packages\bw_plex\misc.py", line 55, in get_pms PMS = PlexServer(url, token, sess) File "c:\python27\lib\site-packages\plexapi\server.py", line 104, in init super(PlexServer, self).init(self, data, self.key) File "c:\python27\lib\site-packages\plexapi\base.py", line 48, in init self._loadData(data) File "c:\python27\lib\site-packages\plexapi\server.py", line 146, in _loadData self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) File "c:\python27\lib\site-packages\plexapi\utils.py", line 183, in toDatetime value = datetime.datetime(1970, 1, 1) + datetime.fromtimestamp(milliseconds=value) AttributeError: type object 'datetime.datetime' has no attribute 'datetime'

On Mon, Jan 21, 2019 at 4:18 PM Hellowlol notifications@github.com wrote:

what os are you using and what was the value in the xml?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Hellowlol/bw_plex/issues/65#issuecomment-456201394, or mute the thread https://github.com/notifications/unsubscribe-auth/AOxViX5Ed3TMqF6SqkbryxpP57QKlxRBks5vFi6mgaJpZM4aA0bU .