Fix merge

This commit is contained in:
Sumner Evans
2019-08-04 08:44:04 -06:00
parent 18bd1bc834
commit 15a334b627
2 changed files with 16 additions and 35 deletions

View File

@@ -60,10 +60,18 @@ class LibremsonicApp(Gtk.Application):
GLib.idle_add(self.update_window)
self.mpv_player = MPVPlayer(time_observer, on_track_end,
on_player_event)
self.chromecast_player = ChromecastPlayer(time_observer, on_track_end,
on_player_event)
self.mpv_player = MPVPlayer(
time_observer,
on_track_end,
on_player_event,
self.state.config,
)
self.chromecast_player = ChromecastPlayer(
time_observer,
on_track_end,
on_player_event,
self.state.config,
)
self.player = self.chromecast_player
# Handle command line option parsing.
@@ -146,35 +154,6 @@ class LibremsonicApp(Gtk.Application):
# it exists.
self.state.load()
self.last_play_queue_update = 0
def time_observer(value):
self.state.song_progress = value
GLib.idle_add(
self.window.player_controls.update_scrubber,
self.state.song_progress,
self.state.current_song.duration,
)
if not value:
self.last_play_queue_update = 0
elif self.last_play_queue_update + 15 <= value:
self.save_play_queue()
def on_track_end():
GLib.idle_add(self.on_next_track)
self.mpv_player = MPVPlayer(
time_observer,
on_track_end,
self.state.config,
)
self.chromecast_player = ChromecastPlayer(
time_observer,
on_track_end,
self.state.config,
)
self.player = self.mpv_player
# If there is no current server, show the dialog to select a server.
if (self.state.config.current_server is None
or self.state.config.current_server < 0):

View File

@@ -1,7 +1,8 @@
import threading
from urllib.parse import urlparse, quote
import socket
from http.server import HTTPServer, SimpleHTTPRequestHandler
import socketserver
from http.server import SimpleHTTPRequestHandler
from typing import Callable, List, Any
from time import sleep
from concurrent.futures import ThreadPoolExecutor, Future
@@ -192,7 +193,8 @@ class ChromecastPlayer(Player):
return ServerHandler
def run(self):
self.server = HTTPServer(
# TODO figure out how to support streaming files
self.server = socketserver.TCPServer(
(self.host, self.port),
self.generate_handler(self.directory),
)