def __init__(self, parent, mplayerloc, hideonplay, showonstop, controls): self.parent = parent self.hideonplay = hideonplay self.showonstop = showonstop self.controls = controls self.parent.title('UbuntuDJ') # initially visible and not playing self.visible = True self.playing = False self.selected = 0 # get mplayer info Player.exec_path = mplayerloc Player.introspect() self.p = Player() # bottom labels self.songname = StringVar() self.label1 = Label(parent, textvariable=self.songname, anchor=W) self.label1.pack(side=BOTTOM) self.status = StringVar() self.label2 = Label(parent, textvariable=self.status) self.label2.pack(side=BOTTOM) # scrollbar and listbox self.scrollbar = Scrollbar(parent) self.scrollbar.pack(side=LEFT, fill=Y) self.listbox = Listbox(parent, yscrollcommand=self.scrollbar.set, selectmode=BROWSE) for i in directorymap: self.listbox.insert(END, i) self.listbox.pack(side=LEFT, fill=BOTH, expand=1) self.scrollbar.config(command=self.listbox.yview) # select first item self.listbox.focus_set() self.listbox.selection_set(0) # bind to click too self.listbox.bind('<<ListboxSelect>>', self.OnClick) # topmost window self.parent.wm_attributes("-topmost", 1) # set up labels self.UpdateLabels()
import glob from pymediainfo import MediaInfo from PIL import ImageTk, Image from mplayer import Player import tkinter.font import math import getpass RunningOnPi = os.uname()[4].startswith('arm') UseOmxplayer = False if RunningOnPi: import RPi.GPIO as GPIO import alsaaudio UseOmxplayer = True Player.introspect() global fullscreen fullscreen = 0 TITLELO = 4 TITLEHI = 12 IDLE = 0 PLAYING = 1 GAPTIME = 0.2 class ZeroPlayer(Frame): def __init__(self, windowed=False): super().__init__()
def __init__(self): Player.exec_path = '/usr/bin/mplayer' Player.introspect() self.p = Player()