示例#1
0
    def __init__(self, items, stdscreen, IFL):
        if not IFL:
            self.pytify = get_pytify_class_by_platform()()
            self.window = stdscreen.subwin(0, 0)
            self.window.keypad(1)
            self.panel = panel.new_panel(self.window)
            self.panel.hide()
            panel.update_panels()
            self.position = 2
            self.items = items
            self.song_length = len(items) - 1

            self.items.append(' ')
            self.items.append('<UP> and <DOWN> for navigation.')
            self.items.append('<Enter> to select song.')
            self.items.append('<Esc> for search.')
            self.items.append('<LEFT> and <RIGHT> for prev/next song.')
            self.items.append('<SPACEBAR> for play/pause.')
        else:
            self.position = 2
            self.items = items
            self.window = stdscreen.subwin(0, 0)
            self.window.keypad(1)
            self.panel = panel.new_panel(self.window)
            self.panel = panel.new_panel(self.window)
            self.panel.hide()
            panel.update_panels()
            self.pytify = get_pytify_class_by_platform()()
            self.pytify.listen(1)
            self.pytify.play_pause()
            self.panel.hide()
            self.window.clear()
            curses.endwin();
            exit();
示例#2
0
    def __init__(self, items):
        self.pytify = get_pytify_class_by_platform()()
        self.items = items

        self.position = 2
        self.song_length = len(items) - 1

        # Init curses screen
        self.window = curses.initscr()

        self.window.keypad(1)

        self.panel = panel.new_panel(self.window)
        self.panel.hide()
        panel.update_panels()

        # Show shortcuts
        self.shortcuts()

        # Disable echoing of keys to the screen
        curses.noecho()

        # Disable blinking cursor
        curses.curs_set(False)

        # Use user terminal settings
        curses.endwin()

        # Display window
        self.display()
示例#3
0
    def __init__(self, items):
        self.pytify = get_pytify_class_by_platform()()
        self.items = items

        self.position = 2
        self.song_length = len(items) - 1

        # Init curses screen
        self.window = curses.initscr()

        self.window.keypad(1)

        self.panel = panel.new_panel(self.window)
        self.panel.hide()
        panel.update_panels()

        # Show shortcuts
        self.shortcuts()

        # Disable echoing of keys to the screen
        curses.noecho()

        # Disable blinking cursor
        curses.curs_set(False)

        # Use user terminal settings
        curses.endwin()

        # Display window
        curses.wrapper(self.display)
示例#4
0
    def __init__(self, url, category_id):
        self._client = WebSocketApp(url=url,
                                    on_message=self._on_message,
                                    on_error=self._on_error,
                                    on_close=self._on_close,
                                    on_open=self._on_open)
        self._category_id = category_id
        self._matches = {}  # type: Dict[int, Dict]

        self._spotify = get_pytify_class_by_platform()()
        self._spotify_playing = False
示例#5
0
    def _toggle_spotify_play(self, state):
        if self._spotify_playing == state:
            return

        try:
            self._spotify.play_pause()
            self._spotify_playing = state
        except Exception as e:
            logger.exception(e)
            self._spotify = get_pytify_class_by_platform()()
            try:
                self._spotify.play_pause()
                self._spotify_playing = state
            except Exception:
                logger.error('Cannot connect to spotify.')
示例#6
0
文件: cli.py 项目: Askebredahl/Pytify
    def __init__(self):
        self.pytify = get_pytify_class_by_platform()()

        self.command = Commander(self.pytify)

        self.run()
示例#7
0
文件: cli.py 项目: bjarneo/Pytify
    def __init__(self):
        self.pytify = get_pytify_class_by_platform()()

        self.command = Commander(self.pytify)

        self.run()
示例#8
0
文件: cli.py 项目: wohlfea/Pytify
    def __init__(self):
        self.pytify = get_pytify_class_by_platform()()

        self.run()
示例#9
0
文件: cli.py 项目: wohlfea/Pytify
    def __init__(self):
        self.pytify = get_pytify_class_by_platform()()

        self.run()
示例#10
0
from os import system, name
from pytify.strategy import get_pytify_class_by_platform
from pytify.dbus.metadata import Metadata
import time
import PySimpleGUI as gui

gui.theme('DarkAmber')

spotify = get_pytify_class_by_platform()()
spotify.metadata = Metadata()
metadata = spotify.metadata.get_metadata()

song=spotify.metadata.get_current_playing()
album=metadata['xesam:album']
songlength=(metadata['mpris:length']/(10**6))/60
trackid=metadata['mpris:trackid']
trackurl=metadata['xesam:url']


layout = [	[gui.Text(f"Name of the song: {song}.", key='-SONG-')],
			[gui.Text(f"Album: {album}.", key='-ALBUM-')],
			[gui.Text(f"Song length: {songlength}.", key='-LENGTH-')],
			[gui.Text(f"Track id: {trackid}.", key='-TRACKID-')],
			[gui.Text(f"Track url: {trackurl}.", key='-TRACKURL-')],
			[gui.Button("Refresh")],
            [gui.Button("Next song")],
            [gui.Button("Previous song")],
			[gui.Button("Exit")]
		 ]

window = gui.Window('Spotify Helper', layout)