| 
					
				 | 
			
			
				@@ -6,15 +6,33 @@ client = MPDClient() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 client.timeout = 60 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 client.connect("localhost", 6600) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-title = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-station = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-while(True): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    info = client.currentsong() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if station != info["name"]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        station = info["name"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        print(station) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if title != info["title"]: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        title = info["title"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        print(title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    time.sleep(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+def main(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    title = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    station = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    elapsed = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    while(True): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        stats = client.status() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if elapsed == stats.get("elapsed", "0"): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            refresh(stats["song"]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        elapsed = stats.get("elapsed", "0") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        info = client.currentsong() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if station != info.get("name", ""): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            station = info.get("name", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            print(station) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if title != info.get("title", ""): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            title = info.get("title", "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            print(title) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        time.sleep(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+def refresh(song): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    client.stop() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    time.sleep(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    client.play(song) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if __name__ == "__main__": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    main() 
			 |