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

Add command to log in to Plex #230

Merged
merged 13 commits into from
Apr 16, 2021
Merged

Add command to log in to Plex #230

merged 13 commits into from
Apr 16, 2021

Conversation

glensc
Copy link
Collaborator

@glensc glensc commented Apr 12, 2021

➔ ./plex_trakt_sync.sh plex-login --help
Usage: main.py plex-login [OPTIONS]

  Log in to Plex Account

Options:
  --username TEXT  Plex login
  --password TEXT  Plex password
  --help           Show this message and exit.

the command line options are optional, they are asked interactively.

Similarly to #243

@glensc glensc self-assigned this Apr 12, 2021
@glensc glensc force-pushed the login-command branch 2 times, most recently from 04743f1 to 311188d Compare April 13, 2021 10:20
@glensc glensc changed the title Add login command Add command to log in to Plex Apr 13, 2021
@glensc
Copy link
Collaborator Author

glensc commented Apr 13, 2021

@BEisem can you test this? it doesn't save them yet to config (only prints), but I'm interested is the UX suitable.

@BEisem
Copy link

BEisem commented Apr 13, 2021

@BEisem can you test this? it doesn't save them yet to config (only prints), but I'm interested is the UX suitable.

Please don't hate me, but I'm not sure what you want me to test. I'm not a programmer so I'm trying to look at the changes in the code, but I don't understand what I'm looking at. If you let me know what to test, I'll be happy to do it... thanks!

@glensc
Copy link
Collaborator Author

glensc commented Apr 13, 2021

@BEisem I'm asking to test the command, not look at the code! the command usage is printed in PR body!

@BEisem
Copy link

BEisem commented Apr 13, 2021

Ok, I've tried this out and it's not working for me. I'm getting Error: No such command 'plex-login'.

% ./plex_trakt_sync.sh plex-login --help
Usage: main.py [OPTIONS] COMMAND [ARGS]...
Try 'main.py --help' for help.

Error: No such command 'plex-login'.

I tried it with both Taxel:0.7.9 and glensc:login-command both with the same results.

I know I'm probably doing something wrong, just not sure what...

@glensc
Copy link
Collaborator Author

glensc commented Apr 13, 2021

you need to use zip from the branch of this pull request if you intend to test code from this pull request, it's glensc:login-command as seen on top of the page. click on the branch name and download the zip from there, as I instructed before. this is unmerged code, so it's obviously not in any release, like Taxel:0.7.9

if you are getting no such command error, you did not use my branch.

I tested exactly those steps right now, and it does have the command.

you need additionally to copy .env from the existing installation (doesn't need to contain valid PLEX_TOKEN, just .env with PLEX_TOKEN filled), or the old code tries to ask plex login.

@BEisem
Copy link

BEisem commented Apr 13, 2021

Ok! Now I got it ... thank you. I went through a few options and it works nicely. I purposely entered an incorrect password, and instead of crashing it told me the login failed. I think this is a much better overall setup experience.

The only thing I noticed so far is, I decided I wanted to quit during the setup process, and I tried CTRL-C but it didn't break. It just repeated the last command. So I had to complete the process before I was able to get out of it.

Also, after the setup is complete, instead of starting the first sync, it just exits back to the command line. Was this intentional?

@glensc
Copy link
Collaborator Author

glensc commented Apr 14, 2021

@BEisem yes, this is intended as a standalone command (notice that command is named 'plex-login'). with a single purpose: login to plex.

yeah, I also noticed that ctrl+c does not abort the process, this may be something internal to the click library being used here.

you can ctrl+\ to force quit. this is for en-us keyboard, it may vary on other keyboards.

@glensc
Copy link
Collaborator Author

glensc commented Apr 14, 2021

ok, the ctrl+c is likely my fault:

should never ever catch top-level Exception, as ctrl+c emits KeyboardInterrupt exception:

I added the top-level exception temporarily because could not figure out what exceptions plex.connect() can throw. it seemed not. to throw their own exceptions but exceptions came from httplib.

@glensc
Copy link
Collaborator Author

glensc commented Apr 14, 2021

@BEisem: Removed catching plain Exception. Can you try again, and if it still does not allow ctrl+c to quit, pay attention to what prompt is running at the time and report it here.

@BEisem
Copy link

BEisem commented Apr 14, 2021

Ok I'm not sure what I'm doing wrong here, but I'm sure it's me...

I downloaded the zip file from glensc:login-command (URL is https://github.com/glensc/plex-trakt-sync/archive/refs/heads/login-command.zip). Started with a fresh install, ran python3 main.py and now the procedure looks like the old version, not the new one any more. What am I doing wrong?

@glensc
Copy link
Collaborator Author

glensc commented Apr 14, 2021

@BEisem zip url is correct. so redo steps past that. rm -rf and unpack zip again. executed from wrong dir? unpacked wrong copy of the zip. dunno really.

@BEisem
Copy link

BEisem commented Apr 15, 2021

I don't know what to tell you ... I've done this multiple times, tried it on several different computers, downloaded from the above URL, unzip to a new directory, enter that directory and run the command. I'm 100% sure I am not executing from the wrong dir, haven't unpacked the wrong copy, etc. I give up...

@glensc
Copy link
Collaborator Author

glensc commented Apr 15, 2021

@BEisem show your error, exact steps, I can't help you with just blind guessing.

@BEisem
Copy link

BEisem commented Apr 15, 2021

@BEisem show your error, exact steps, I can't help you with just blind guessing.

  1. Download https://github.com/glensc/plex-trakt-sync/archive/refs/heads/login-command.zip
  2. Copy plex-trakt-sync-login-command folder to ~/scripts
  3. cd ~/scripts/plex-trakt-sync-login-command
  4. python3 main.py

Results in the old-style setup procedure, not the new one.

@glensc
Copy link
Collaborator Author

glensc commented Apr 15, 2021

@BEisem seems you have forgotten that I said you need to copy the .env from the previous installation:

@glensc
Copy link
Collaborator Author

glensc commented Apr 15, 2021

I've added .env save to the end of the method, so this command is complete now.

NOTE: The removal of old setup is not removed in this PR context, trakt login command needs to be added first.

@glensc glensc marked this pull request as ready for review April 15, 2021 02:52
@glensc glensc mentioned this pull request Apr 15, 2021
@glensc glensc merged commit ed6d95d into Taxel:0.7.x Apr 16, 2021
@glensc glensc deleted the login-command branch April 16, 2021 12:08
@glensc glensc mentioned this pull request Apr 17, 2021
Repository owner locked as resolved and limited conversation to collaborators Jan 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants