mirror of
https://github.com/Febbweiss/mopidy-touchscreen.git
synced 2026-03-04 22:25:39 +00:00
First commit
This commit is contained in:
43
mopidy_touchscreen/__init__.py
Normal file
43
mopidy_touchscreen/__init__.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
# TODO: Remove entirely if you don't register GStreamer elements below
|
||||
import pygst
|
||||
pygst.require('0.10')
|
||||
import gst
|
||||
import gobject
|
||||
|
||||
from mopidy import config, ext
|
||||
|
||||
|
||||
__version__ = '0.1.0'
|
||||
|
||||
# TODO: If you need to log, use loggers named after the current Python module
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Extension(ext.Extension):
|
||||
|
||||
dist_name = 'Mopidy-Touchscreen'
|
||||
ext_name = 'touchscreen'
|
||||
version = __version__
|
||||
|
||||
def get_default_config(self):
|
||||
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
|
||||
return config.read(conf_file)
|
||||
|
||||
def get_config_schema(self):
|
||||
schema = super(Extension, self).get_config_schema()
|
||||
# TODO: Comment in and edit, or remove entirely
|
||||
#schema['username'] = config.String()
|
||||
#schema['password'] = config.Secret()
|
||||
return schema
|
||||
|
||||
def setup(self, registry):
|
||||
# You will typically only implement one of the following things
|
||||
# in a single extension.
|
||||
from .touch_screen import TouchScreen
|
||||
registry.add('frontend', TouchScreen)
|
||||
|
||||
43
mopidy_touchscreen/__init__.py~
Normal file
43
mopidy_touchscreen/__init__.py~
Normal file
@@ -0,0 +1,43 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
# TODO: Remove entirely if you don't register GStreamer elements below
|
||||
import pygst
|
||||
pygst.require('0.10')
|
||||
import gst
|
||||
import gobject
|
||||
|
||||
from mopidy import config, ext
|
||||
|
||||
|
||||
__version__ = '0.1.0'
|
||||
|
||||
# TODO: If you need to log, use loggers named after the current Python module
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Extension(ext.Extension):
|
||||
|
||||
dist_name = 'Mopidy-Touchscreen'
|
||||
ext_name = 'touchscreen'
|
||||
version = __version__
|
||||
|
||||
def get_default_config(self):
|
||||
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
|
||||
return config.read(conf_file)
|
||||
|
||||
def get_config_schema(self):
|
||||
schema = super(Extension, self).get_config_schema()
|
||||
# TODO: Comment in and edit, or remove entirely
|
||||
#schema['username'] = config.String()
|
||||
#schema['password'] = config.Secret()
|
||||
return schema
|
||||
|
||||
def setup(self, registry):
|
||||
# You will typically only implement one of the following things
|
||||
# in a single extension.
|
||||
from .touch_screen import Touch_Screen
|
||||
registry.add('frontend', Touch_Screen)
|
||||
|
||||
4
mopidy_touchscreen/ext.conf
Normal file
4
mopidy_touchscreen/ext.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
[touchscreen]
|
||||
enabled = true
|
||||
# TODO: Add additional config values and their default values here, or remove
|
||||
# this comment entirely.
|
||||
7
mopidy_touchscreen/main_screen.py
Normal file
7
mopidy_touchscreen/main_screen.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import pygame
|
||||
|
||||
|
||||
class MainScreen():
|
||||
|
||||
def update(self,screen):
|
||||
screen.fill((255,255,255))
|
||||
8
mopidy_touchscreen/main_screen.py~
Normal file
8
mopidy_touchscreen/main_screen.py~
Normal file
@@ -0,0 +1,8 @@
|
||||
import pygame
|
||||
|
||||
|
||||
class MainScreen():
|
||||
|
||||
def update(self):
|
||||
surface = pygame.Surface((200,200)).fill((255,255,255))
|
||||
return surface
|
||||
0
mopidy_touchscreen/main_screen~
Normal file
0
mopidy_touchscreen/main_screen~
Normal file
0
mopidy_touchscreen/proba.py~
Normal file
0
mopidy_touchscreen/proba.py~
Normal file
0
mopidy_touchscreen/screen_manager.py
Normal file
0
mopidy_touchscreen/screen_manager.py
Normal file
51
mopidy_touchscreen/touch_screen.py
Normal file
51
mopidy_touchscreen/touch_screen.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import pykka
|
||||
|
||||
import logging
|
||||
from threading import Thread
|
||||
import pygame
|
||||
from .main_screen import MainScreen
|
||||
|
||||
from mopidy import core
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class TouchScreen(pykka.ThreadingActor, core.CoreListener):
|
||||
def __init__(self, config, core):
|
||||
super(TouchScreen, self).__init__()
|
||||
self.core = core
|
||||
|
||||
def start_thread(self):
|
||||
pygame.init()
|
||||
clock = pygame.time.Clock()
|
||||
main_screen = MainScreen()
|
||||
screen = pygame.display.set_mode((200,200));
|
||||
while self.running:
|
||||
clock.tick(60)
|
||||
main_screen.update(screen)
|
||||
pygame.display.flip()
|
||||
logger.error("bukatzen")
|
||||
pygame.quit()
|
||||
logger.error("bukatu dot")
|
||||
|
||||
|
||||
|
||||
def on_start(self):
|
||||
self.running=True
|
||||
self.thread = Thread(target=self.start_thread)
|
||||
self.thread.start()
|
||||
|
||||
def on_stop(self):
|
||||
self.running = False
|
||||
|
||||
|
||||
|
||||
def track_playback_started(self, tl_track):
|
||||
pass
|
||||
#myfont = pygame.font.SysFont("monospace", 15)
|
||||
|
||||
# render text
|
||||
#label = myfont.render(tl_track.track.name, 1, (255,255,0))
|
||||
#self.screen.blit(label, (100, 100))
|
||||
#pygame.display.flip()
|
||||
|
||||
51
mopidy_touchscreen/touch_screen.py~
Normal file
51
mopidy_touchscreen/touch_screen.py~
Normal file
@@ -0,0 +1,51 @@
|
||||
import pykka
|
||||
|
||||
import logging
|
||||
from threading import Thread
|
||||
import pygame
|
||||
from .main_screen import MainScreen
|
||||
|
||||
from mopidy import core
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class TouchScreen(pykka.ThreadingActor, core.CoreListener):
|
||||
def __init__(self, config, core):
|
||||
super(TouchScreen, self).__init__()
|
||||
self.core = core
|
||||
|
||||
def start_thread(self):
|
||||
pygame.init()
|
||||
clock = pygame.time.Clock()
|
||||
main_screen = MainScreen()
|
||||
screen = pygame.display.set_mode((200,200));
|
||||
while self.running:
|
||||
clock.tick(60)
|
||||
screen.fill((255,255,255))
|
||||
pygame.display.flip()
|
||||
logger.error("bukatzen")
|
||||
pygame.quit()
|
||||
logger.error("bukatu dot")
|
||||
|
||||
|
||||
|
||||
def on_start(self):
|
||||
self.running=True
|
||||
self.thread = Thread(target=self.start_thread)
|
||||
self.thread.start()
|
||||
|
||||
def on_stop(self):
|
||||
self.running = False
|
||||
|
||||
|
||||
|
||||
def track_playback_started(self, tl_track):
|
||||
pass
|
||||
#myfont = pygame.font.SysFont("monospace", 15)
|
||||
|
||||
# render text
|
||||
#label = myfont.render(tl_track.track.name, 1, (255,255,0))
|
||||
#self.screen.blit(label, (100, 100))
|
||||
#pygame.display.flip()
|
||||
|
||||
Reference in New Issue
Block a user