Skip to content

moc: fix type mismatch in moc_data #2288

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions py3status/modules/moc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,25 @@ def _get_moc_data(self):
is_started = False
return is_started, data

def _organize_data(self, data):
temporary = {}
for line in data.splitlines():
category, value = line.split(": ", 1)
temporary[category.lower()] = value
return temporary

def moc(self):
is_paused = is_playing = is_stopped = None
cached_until = self.sleep_timeout
color = self.py3.COLOR_BAD
data = {}

is_started, moc_data = self._get_moc_data()

if is_started:
cached_until = self.cache_timeout
moc_data = self._organize_data(moc_data)

for line in moc_data.splitlines():
category, value = line.split(": ", 1)
data[category.lower()] = value

self.state = data["state"]
self.state = moc_data["state"]
if self.state == "PLAY":
is_playing = True
color = self.color_playing
Expand Down
Loading