mtimkovich / plex2letterboxd Goto Github PK
View Code? Open in Web Editor NEWExport your watched movies on Plex to the Letterboxd Import Format.
License: MIT License
Export your watched movies on Plex to the Letterboxd Import Format.
License: MIT License
While using the latest plex2letterboxd
code, under linux, with an up-to-date PLEX server, i sometimes encounter this error (not on all libraries - some are working fine, some are failing) :
16:38 sergio@solaris ~/plex2letterboxd% time python -m plex2letterboxd --ini config.ini --sections "Séries - TV" --output letterboxd-series.csv
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/users/sergio/plex2letterboxd/plex2letterboxd/__main__.py", line 4, in <module>
plex2letterboxd.main()
File "/home/users/sergio/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 61, in main
write_csv(sections, args.output)
File "/home/users/sergio/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 45, in write_csv
date = movie.lastViewedAt.strftime('%Y-%m-%d')
AttributeError: 'NoneType' object has no attribute 'strftime'
python -m plex2letterboxd --ini config.ini --sections "Séries - TV" --output 2.14s user 0.04s system 6% cpu 34.920 total
To be noted : the code is running fine for several items, but then at some point (here after 150 entries) i encounter one item that is generating this issue - would be interesting if the item name was somehow displayed / identifiable.
Hi,
Just wondering if you know what I've done wrong here?
`C:\Users\Craig\plex2letterboxd>python -m plex2letterboxd
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 198, in _new_conn
sock = connection.create_connection(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
raise err
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
response = self._make_request(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request
conn.request(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 400, in request
self.endheaders()
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\http\client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\http\client.py", line 1010, in _send_output
self.send(msg)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\http\client.py", line 950, in send
self.connect()
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 238, in connect
self.sock = self._new_conn()
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 213, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x03ED2A18>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='172.18.0.7', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x03ED2A18>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Craig\plex2letterboxd\plex2letterboxd_main.py", line 4, in
plex2letterboxd.main()
File "C:\Users\Craig\plex2letterboxd\plex2letterboxd\plex2letterboxd.py", line 67, in main
plex = PlexServer(auth['baseurl'], auth['token'])
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\plexapi\server.py", line 116, in init
data = self.query(self.key, timeout=self._timeout)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\plexapi\server.py", line 759, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='172.18.0.7', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x03ED2A18>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
C:\Users\Craig\plex2letterboxd>python -m plex2letterboxd
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 198, in _new_conn
sock = connection.create_connection(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
raise err
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
response = self._make_request(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request
conn.request(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 400, in request
self.endheaders()
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\http\client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\http\client.py", line 1010, in _send_output
self.send(msg)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\http\client.py", line 950, in send
self.connect()
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 238, in connect
self.sock = self._new_conn()
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connection.py", line 213, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x04192A18>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='172.18.0.7', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x04192A18>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\Craig\plex2letterboxd\plex2letterboxd_main.py", line 4, in
plex2letterboxd.main()
File "C:\Users\Craig\plex2letterboxd\plex2letterboxd\plex2letterboxd.py", line 67, in main
plex = PlexServer(auth['baseurl'], auth['token'])
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\plexapi\server.py", line 116, in init
data = self.query(self.key, timeout=self._timeout)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\plexapi\server.py", line 759, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Craig\AppData\Local\Programs\Python\Python39-32\lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='172.18.0.7', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x04192A18>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))`
i got this after running
Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 151, in _run_module_as_main mod_name, loader, code, fname = _get_module_details(mod_name) File "/usr/lib64/python2.7/runpy.py", line 101, in _get_module_details loader = get_loader(mod_name) File "/usr/lib64/python2.7/pkgutil.py", line 464, in get_loader return find_loader(fullname) File "/usr/lib64/python2.7/pkgutil.py", line 475, in find_loader loader = importer.find_module(fullname) File "/usr/lib64/python2.7/pkgutil.py", line 184, in find_module path = [os.path.realpath(self.path)] File "/usr/lib64/python2.7/posixpath.py", line 376, in realpath return abspath(path) File "/usr/lib64/python2.7/posixpath.py", line 364, in abspath cwd = os.getcwd() OSError: [Errno 2] No such file or directory
i follow your instruction, but seem to have the same problem all the time
Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/var/lib/plex2letterboxd/plex2letterboxd/__main__.py", line 4, in <module> plex2letterboxd.main() File "/var/lib/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 76, in main sections = [plex.library.section(s) for s in args.sections] File "/var/lib/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 76, in <listcomp> sections = [plex.library.section(s) for s in args.sections] File "/home/don/.local/lib/python3.8/site-packages/plexapi/library.py", line 73, in section raise NotFound(f'Invalid library section: {title}') from None plexapi.exceptions.NotFound: Invalid library section: Movies
What am i doing wrong?
When I try to run the script the following stacktrace is generated:
Traceback (most recent call last): File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/opt/plex2letterboxd/plex2letterboxd/__main__.py", line 4, in <module> plex2letterboxd.main() File "/opt/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 58, in main plex = PlexServer(auth['baseurl'], auth['token']) File "/usr/local/lib64/python3.6/site-packages/plexapi/server.py", line 113, in __init__ data = self.query(self.key, timeout=timeout) File "/usr/local/lib64/python3.6/site-packages/plexapi/server.py", line 535, in query return ElementTree.fromstring(data) if data.strip() else None File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 1314, in XML parser.feed(text) xml.etree.ElementTree.ParseError: mismatched tag: line 40, column 2
System Information:
OS: RHEL8
Python Version: 3.6.8
Hello,
Thanks a lot for this tool.
I would like to use it to import the movies I didn’t see (stored on my plex server) in my Letterboxd watchlist but I sadly don’t know how to code this alternative use.
Could you by any chance point me in the right direction?
Thanks in advance!
It worked perfectly :)
Even though I seem to have my config.ini
setup correctly, I nevertheless am getting the following error time and time again:
Traceback (most recent call last):
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connection.py", line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 710, in urlopen
chunked=chunked,
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/lib/python3.6/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1046, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 984, in send
self.connect()
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connection.py", line 187, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f34670ea160>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/seedit4me/.local/lib/python3.6/site-packages/requests/adapters.py", line 450, in send
timeout=timeout
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 788, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/seedit4me/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='148.nl25.seedit4.me', port=32402): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f34670ea160>: Failed to establish a new connection: [Errno 111] Connection refused',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/seedit4me/plex2letterboxd/plex2letterboxd/__main__.py", line 4, in <module>
plex2letterboxd.main()
File "/home/seedit4me/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 62, in main
plex = PlexServer(auth['baseurl'], auth['token'])
File "/home/seedit4me/.local/lib/python3.6/site-packages/plexapi/server.py", line 113, in __init__
data = self.query(self.key, timeout=timeout)
File "/home/seedit4me/.local/lib/python3.6/site-packages/plexapi/server.py", line 523, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/home/seedit4me/.local/lib/python3.6/site-packages/requests/sessions.py", line 542, in get
return self.request('GET', url, **kwargs)
File "/home/seedit4me/.local/lib/python3.6/site-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/home/seedit4me/.local/lib/python3.6/site-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/home/seedit4me/.local/lib/python3.6/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='148.nl25.seedit4.me', port=32402): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f34670ea160>: Failed to establish a new connection: [Errno 111] Connection refused',))
What could I be missing? I'm copying the token from the URL as instructed 🤷♂️
Providing a LetterboxdURI, tmdbID or imdbID for each line in your file performs an exact match for the film (or diary entry, see below), while providing title (and optional year and director/s) results in a best-guess match.
from https://letterboxd.com/about/importing-data/
Plex has both in items.guids
You can see the format here:
https://python-plexapi.readthedocs.io/en/latest/modules/library.html#plexapi.library.LibrarySection.getGuid
All you have to do is filter out tmdb or imdb and you can still fall back to the title if you have to.
Using those IDs seems way more efficient and less error prone.
Tried to run it, but got an error that from my googling of stuff when trying to play around with the PlexAPI, seems to be down for everyone.
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/joe/plex2letterboxd/plex2letterboxd/__main__.py", line 4, in <module>
plex2letterboxd.main()
File "/home/joe/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 61, in main
write_csv(sections, args.output)
File "/home/joe/plex2letterboxd/plex2letterboxd/plex2letterboxd.py", line 44, in write_csv
for movie in section.search(sort='lastViewedAt', unwatched=False):
File "/home/joe/.local/lib/python3.8/site-packages/plexapi/library.py", line 669, in search
args[category] = self._cleanSearchFilter(category, value, libtype)
File "/home/joe/.local/lib/python3.8/site-packages/plexapi/library.py", line 717, in _cleanSearchFilter
raise BadRequest('Unknown filter category: %s' % category)
plexapi.exceptions.BadRequest: Unknown filter category: unwatched
Like I'm pretty sure that filter category should be there, but my Movie library is using the newer scanner, so I think it's not gonna work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.