884525df33ffb939b354177d6f99ead8ccb28840,homeassistant/components/media_player/plex.py,,setup_plexserver,#Any#Any#Any#,58
Before Change
// configuration, let"s use those, not to break anything
// We may want to use this method as option when HA"s
// configuration options increase
if config.get("name", ""):
name = config.get("name", "")
user = config.get("user", "")
password = config.get("password", "")
plexuser = MyPlexUser.signin(user, password)
plexserver = plexuser.getResource(name).connect()
// Discovery mode. Parse config file, attempt conenction
// Request configuration on connect fail
else:
print("WEEEEJ, host: %s"%host)
try:
// Get configuration from config file
// FIXME unauthenticated plex servers dont require
// a token, so config file isn"t mandatory
with open(conf_file,"r") as f:
conf_dict = eval(f.read())
plexserver = PlexServer(
"http://%s"%host,
conf_dict.get(host)["token"])
except IOError: // File not found
request_configuration(host, hass, add_devices_callback)
return
except NotFound: // Wrong host was given or need token?
_LOGGER.exception("Error connecting to the Hue bridge at %s", host)
return
plex_clients = {}
plex_sessions = {}
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
After Change
// Called by module inclusion, let"s only use config
host,token = conf_dict.popitem()
token = token["token"]
elif host not in conf_dict.keys() :
// Not in config
conf_dict[host] = { "token" : "" }
token = None
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: home-assistant/home-assistant
Commit Name: 884525df33ffb939b354177d6f99ead8ccb28840
Time: 2015-10-25
Author: tom.duijf@gmail.com
File Name: homeassistant/components/media_player/plex.py
Class Name:
Method Name: setup_plexserver
Project Name: studioml/studio
Commit Name: 9ff097f08b073a5c7b98299276da2a82b5ae6a1d
Time: 2020-12-15
Author: andrei.denissov@cognizant.com
File Name: studio/s3_provider.py
Class Name: S3Provider
Method Name: _get
Project Name: home-assistant/home-assistant
Commit Name: 884525df33ffb939b354177d6f99ead8ccb28840
Time: 2015-10-25
Author: tom.duijf@gmail.com
File Name: homeassistant/components/media_player/plex.py
Class Name:
Method Name: setup_plexserver
Project Name: studioml/studio
Commit Name: 821e08817e2e5a7b6af34d3b9c17bffdc2bc028b
Time: 2017-09-07
Author: peter.zhokhov@sentient.ai
File Name: studio/gcloud_artifact_store.py
Class Name: GCloudArtifactStore
Method Name: __init__