Browse Source

chore: Remove trailing spaces

Matthias Ladkau 4 years ago
parent
commit
9f10af38cc
3 changed files with 22 additions and 22 deletions
  1. 8 8
      musikautomat/display.py
  2. 10 10
      musikautomat/musikautomat.py
  3. 4 4
      musikautomat/player.py

+ 8 - 8
musikautomat/display.py

@@ -6,17 +6,17 @@ from typing import Dict
 
 # Color constants
 
-BLACK = (0, 0, 0) 
-GREEN = (0, 255, 0) 
+BLACK = (0, 0, 0)
+GREEN = (0, 255, 0)
 
 class Display:
     '''
     Display object
     '''
     def __init__(self, config, pydsp):
-        
+
         # Set config values
-        
+
         self._dx = config.get("dimx", 128) # Drawing dimensions
         self._dy = config.get("dimy", 160)
         self._playlistFile = config.get("playlist", "music.yml") # Playlist data
@@ -55,7 +55,7 @@ class Display:
             self._selection_pointer = self._drawlines # Move the line offset up if possible
             if self._line_offset < len(playlist) - self._drawlines - 1:
                 self._line_offset+=1
-        
+
         # Draw lines
 
         font = pygame.font.Font('freesansbold.ttf', self._fontsize)
@@ -82,9 +82,9 @@ class Display:
                 self._current_item = item
             else:
                 text = font.render(item["name"], True, GREEN, BLACK)
-            
+
             self._pydsp.blit(text, (0, drawline * self._fontsize+50))
-            
+
             # Increase number of drawn lines - stop when the maximum is reached
 
             drawline += 1
@@ -107,5 +107,5 @@ class Display:
             self._selection_pointer-=1
         elif action == "down":
             self._selection_pointer+=1
-        
+
         self.update()

+ 10 - 10
musikautomat/musikautomat.py

@@ -55,7 +55,7 @@ class Musikautomat:
             (r"/(.*)", tornado.web.StaticFileHandler, {"path" : "./web",
             "default_filename" : "index.html" }),
         ]
- 
+
         asyncio.set_event_loop(asyncio.new_event_loop())
         app = tornado.web.Application(urls, debug=False)
         app.listen(8080)
@@ -73,13 +73,13 @@ class Musikautomat:
             try:
 
                 for event in pygame.event.get():
-                    
+
                     # Handle exit event
-                    
+
                     if event.type == pygame.QUIT:
                         pygame.quit()
                         sys.exit()
-                    
+
                     # Handle key events
 
                     if event.type == pygame.KEYDOWN:
@@ -93,7 +93,7 @@ class Musikautomat:
                         elif event.key == pygame.K_RIGHT:
 
                             if self._eventSink == self._player:
-                                self._player.togglePlay()                                
+                                self._player.togglePlay()
                             else:
                                 self.play(self._display.currentItem())
 
@@ -105,19 +105,19 @@ class Musikautomat:
                             self._display.update()
 
             except Exception as e:
-                
+
                 # Display error
                 traceback.print_exc()
 
                 self._pydsp.fill((0,0,0))
                 font = pygame.font.Font('freesansbold.ttf', 12)
-                
+
                 s = str(e)
                 n = int(self._dx / 6)
                 for i, start in enumerate(range(0, len(s), n)):
                     text = font.render(s[start:start+n], True, (255, 0, 0) , (0, 0, 0))
                     self._pydsp.blit(text, (0, i * 12))
-                
+
                 self._eventSink = self._display
 
             pygame.display.update()
@@ -138,7 +138,7 @@ class Musikautomat:
             raise Exception("Unknown type: %s" % t)
 
         if start:
-            self._player.togglePlay()                                
+            self._player.togglePlay()
 
 
     def playDir(self, item):
@@ -148,7 +148,7 @@ class Musikautomat:
         path = item.get("path")
         files = os.listdir(path)
 
-        self._player.setPlaylist(sorted([{ 
+        self._player.setPlaylist(sorted([{
             "name" : f,
             "path" : os.path.join(path, f)
         } for f in files], key=lambda i: i["name"]))

+ 4 - 4
musikautomat/player.py

@@ -23,7 +23,7 @@ class Player(Display):
         self._playingPlaylist = None # Current playing order
 
         self._data = [] # Current playlist
- 
+
         self._player = MPlayer() # Reference to mplayer control object
 
         threading.Thread(target=self._updateFromPlayer, daemon=True).start()
@@ -44,7 +44,7 @@ class Player(Display):
                     # and the item can be found in the current playlist
 
                     if player_playing != self._current_item.get("path"):
-                        
+
                         for i, item in enumerate(self._data):
                             if item.get("path") == player_playing:
                                 self._selection_pointer = i
@@ -73,14 +73,14 @@ class Player(Display):
         Return the playlist for this display.
         '''
         return self._data
-    
+
     def togglePlay(self):
         '''
         Toggle playing the selected item.
         '''
         if not self._current_item:
             return
-        
+
         if self._player.p_path == self._current_item["path"]:
             print("stop")
             self.playing = False