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

Remove __shortcuts__ and clean up related code. #27

Closed
oddstr13 opened this issue May 10, 2019 · 2 comments
Closed

Remove __shortcuts__ and clean up related code. #27

oddstr13 opened this issue May 10, 2019 · 2 comments
Labels
cleanup Non-functional code cleanup/readability/formatting

Comments

@oddstr13
Copy link
Member

oddstr13 commented May 10, 2019

Going via __shortcuts__ and __getitem__ makes it harder to figure out where functions are used.

def __shortcuts__(self, key):
if key == "clear":
return self.clear_data
elif key == "servers":
return self.get_available_servers()
elif key in ("reconnect", "refresh"):
return self.connect
elif key == "login":
return self.login
elif key == "server":
return self.get_server_info(self.server_id)
elif key == "server-id":
return self.server_id
elif key == "server-version":
return self.server_version
elif key == "user-id":
return self.jellyfin_user_id()
elif key == "public-users":
return self.get_public_users()
elif key == "token":
return self.jellyfin_token()
elif key == "manual-server":
return self.connect_to_address
elif key == "connect-to-server":
return self.connect_to_server
elif key == "server-address":
server = self.get_server_info(self.server_id)
return get_server_address(server, server['LastConnectionMode'])
elif key == "revoke-token":
return self.revoke_token()
elif key == "server-mode":
server = self.get_server_info(self.server_id)
return server['LastConnectionMode']
return

@oddstr13 oddstr13 added the cleanup Non-functional code cleanup/readability/formatting label May 10, 2019
@TrueTechy
Copy link
Contributor

TrueTechy commented Sep 6, 2019

Adding this list here to keep track of work still needing done

Shortcuts

  • resources/lib/jellyfin/core/configuration.py
  • resources/lib/jellyfin/core/connection_manager.py
  • resources/lib/jellyfin/core/http.py
  • resources/lib/jellyfin/core/ws_client.py

Getitem

  • resources/lib/jellyfin/init.py

  • Has a decorator function on set/get functions, might need to reimplement these elsewhere

  • resources/lib/jellyfin/client.py

  • resources/lib/jellyfin/core/configuration.py:

  • resources/lib/jellyfin/core/connection_manager.py:

  • resources/lib/objects/movies.py

  • resources/lib/objects/music.py

  • resources/lib/objects/musicvideos.py

  • resources/lib/objects/tvshows.py

mcarlton00 added a commit that referenced this issue Sep 8, 2019
Remove __shortcuts__ in http.py and some in client.py  #27
@TrueTechy
Copy link
Contributor

All of the cleanup has been committed and merged for this issue, it can now be closed.

@dkanada dkanada closed this as completed Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Non-functional code cleanup/readability/formatting
Projects
None yet
Development

No branches or pull requests

3 participants