예제 #1
0
    def __init__(self, *a, **kw):
        Jukebox.__init__(self, *a, **kw)

        self._json_queue = JsonQueue()
        self._util       = Util(self._json_queue)

        self._ripper_thread = RipperThread(self, self._json_queue)
        self._end_of_track = self._ripper_thread.get_end_of_track()
        self.set_ui_thread(self._ripper_thread)

        self.session.set_preferred_bitrate(1) # 320 kbps (ostensibly)
예제 #2
0
 def music_delivery_safe(self, session, frames, frame_size, num_frames, sample_type, sample_rate, channels):
     rip(session, frames, frame_size, num_frames, sample_type, sample_rate, channels)
     #if playback:
     if args.playback:
         return Jukebox.music_delivery_safe(self, session, frames, frame_size, num_frames, sample_type, sample_rate, channels)
     else:
         return num_frames
 def setUp(self):
     self.songs={"Sunday Morning" : {"artist" : "No Doubt", "path": "songs/path", "jukebox_id": 1},
                 "Give it Away" : {"artist" : "Red Hot Chilli Peppers", "path": "songs/path", "jukebox_id": 2},
                 "Santeria" : {"artist" : "Sublime", "path": "songs/path", "jukebox_id": 3}}
     self.jukebox=Jukebox()
     #this allows us to test the output to the terminal, stdout
     self.held, sys.stdout = sys.stdout, StringIO()
 def setUp(self):
     self.songs = {
         "Sunday Morning": {
             "artist": "No Doubt",
             "path": "songs/path",
             "jukebox_id": 1
         },
         "Give it Away": {
             "artist": "Red Hot Chilli Peppers",
             "path": "songs/path",
             "jukebox_id": 2
         },
         "Santeria": {
             "artist": "Sublime",
             "path": "songs/path",
             "jukebox_id": 3
         }
     }
     self.jukebox = Jukebox()
     #this allows us to test the output to the terminal, stdout
     self.held, sys.stdout = sys.stdout, StringIO()
예제 #5
0
    queue = NewBlockQueue(r, sui, AudioPlayer(),
                          Bitcoind.getblockchaininfo()['bestblockhash'])
    # start periodic timers
    pu = PeriodicUpdates(sui)
    r.callLater(0.5, pu.run)

    sr = SystemResources(r, sui, args.blockchain_dir, args.blockchain_device)
    sr.run()

    ni = NodeInfo(r, sui)
    ni.run()

    lni = LnNodeInfo(r, sui, args.lightning_rpc)
    lni.run()

    j = Jukebox(r, sui, args.audio_dir, args.lightning_rpc)
    j.run()

    if args.websocket:
        from serve_web import ServeWeb
        from serve_websocket import ServeWebsocket
        from web_eink_ui import WebEinkUI
        weui = WebEinkUI()
        sw = ServeWeb(r)
        sw.run()
        sws = ServeWebsocket(r, sui, weui, j)
        sws.run()
    else:
        from physical_ui import PhysicalUI
        pui = PhysicalUI(r, sui, j)
        pui.run()
예제 #6
0
 def end_of_track(self, session):
     Jukebox.end_of_track(self, session)
     os.rename(self._meta["out_path"] + ".raw.tmp",self._meta["out_path"] + ".raw")
     self._end_of_track.set()
예제 #7
0
 def __init__(self, *a, **kw):
     Jukebox.__init__(self, *a, **kw)
     self.ui = RipperThread(self) # replace JukeboxUI
     self.session.set_preferred_bitrate(1) # 160 bps
예제 #8
0
def main():
    actual_server_location = '192.168.1.71:4040'

    jukebox = Jukebox(actual_server_location)
    RelayServer.init(actual_server_location, jukebox)
    RelayServer.start(4040)
class TestJukebox(unittest.TestCase):
    def setUp(self):
        self.songs={"Sunday Morning" : {"artist" : "No Doubt", "path": "songs/path", "jukebox_id": 1},
                    "Give it Away" : {"artist" : "Red Hot Chilli Peppers", "path": "songs/path", "jukebox_id": 2},
                    "Santeria" : {"artist" : "Sublime", "path": "songs/path", "jukebox_id": 3}}
        self.jukebox=Jukebox()
        #this allows us to test the output to the terminal, stdout
        self.held, sys.stdout = sys.stdout, StringIO()

    def tearDown(self):
        sys.stdout = self.held

    def test_help(self):
        """It prints a list of commands"""
        self.jukebox.help()
        self.assertEqual(sys.stdout.getvalue(), "I accept the following commands:\n"+
        "- help : displays this help message\n"
        "- list : displays a list of songs you can play\n"
        "- play : lets you choose a song to play\n"+
        "- exit : exits this program\n")

    def test_list(self):
        """It lists the songs by jukebox_id, name and artist"""
        self.jukebox.list(self.songs)
        self.assertEqual(sys.stdout.getvalue(),"1. Sunday Morning - No Doubt\n"+
        "2. Give it Away - Red Hot Chilli Peppers\n"+
        "3. Santeria - Sublime\n")

    def test_play_1(self):
        """It plays Sunday Morning when `1` is entered by the user"""
        with mockRawInput('1'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),"Now Playing: Sunday Morning\n")

    def test_play_11(self):
        """It prints an error message when `11` is entered by the user"""
        with mockRawInput('11'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),"Invalid input, please try again\n")

    def test_play_Santeria(self):
        """It plays Santeria when `Santeria` is entered by the user"""
        with mockRawInput('Santeria'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),"Now Playing: Santeria\n")

    def test_play_Bye_Bye_Bye(self):
        """It prints an error message when `Bye Bye Bye` is entered by the user"""
        with mockRawInput('Bye Bye Bye'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),"Invalid input, please try again\n")

    def test_exit_jukebox(self):
        """It prints 'Goodbye'"""
        self.jukebox.exit_jukebox()
        self.assertEqual(sys.stdout.getvalue(),"Goodbye\n")

    def test_run(self):
        """It will ask for a new command after listing the songs"""
        with mockRawInput('exit'):
            self.jukebox.run(self.songs)
            self.assertEqual(sys.stdout.getvalue(),"I accept the following commands:\n"+
            "- help : displays this help message\n"+
            "- list : displays a list of songs you can play\n"+
            "- play : lets you choose a song to play\n"
            "- exit : exits this program\n"+
            "Goodbye\n")
예제 #10
0
 def music_delivery_safe(self, session, frames, frame_size, num_frames, sample_type, sample_rate, channels):
     rip(session, frames, frame_size, num_frames, sample_type, sample_rate, channels)
     if playback:
         return Jukebox.music_delivery_safe(self, session, frames, frame_size, num_frames, sample_type, sample_rate, channels)
     else:
         return num_frames
예제 #11
0
 def __init__(self, *a, **kw):
     Jukebox.__init__(self, *a, **kw)
     self.ui = RipperThread(self) # replace JukeboxUI
     self.session.set_preferred_bitrate(1) # 320 bps
예제 #12
0
 def __init__(self, *a, **kw):
     Jukebox.__init__(self, *a, **kw)
     self.ui = RipperThread(self)  # replace JukeboxUI
예제 #13
0
 def __init__(self, *a, **kw):
     Jukebox.__init__(self, *a, **kw)
     self.ui = RipperThread(self) # replace JukeboxUI
class TestJukebox(unittest.TestCase):
    def setUp(self):
        self.songs = {
            "Sunday Morning": {
                "artist": "No Doubt",
                "path": "songs/path",
                "jukebox_id": 1
            },
            "Give it Away": {
                "artist": "Red Hot Chilli Peppers",
                "path": "songs/path",
                "jukebox_id": 2
            },
            "Santeria": {
                "artist": "Sublime",
                "path": "songs/path",
                "jukebox_id": 3
            }
        }
        self.jukebox = Jukebox()
        #this allows us to test the output to the terminal, stdout
        self.held, sys.stdout = sys.stdout, StringIO()

    def tearDown(self):
        sys.stdout = self.held

    def test_help(self):
        """It prints a list of commands"""
        self.jukebox.help()
        self.assertEqual(
            sys.stdout.getvalue(), "I accept the following commands:\n" +
            "- help : displays this help message\n"
            "- list : displays a list of songs you can play\n"
            "- play : lets you choose a song to play\n" +
            "- exit : exits this program\n")

    def test_list(self):
        """It lists the songs by jukebox_id, name and artist"""
        self.jukebox.list(self.songs)
        self.assertEqual(
            sys.stdout.getvalue(), "1. Sunday Morning - No Doubt\n" +
            "2. Give it Away - Red Hot Chilli Peppers\n" +
            "3. Santeria - Sublime\n")

    def test_play_1(self):
        """It plays Sunday Morning when `1` is entered by the user"""
        with mockRawInput('1'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),
                             "Now Playing: Sunday Morning\n")

    def test_play_11(self):
        """It prints an error message when `11` is entered by the user"""
        with mockRawInput('11'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),
                             "Invalid input, please try again\n")

    def test_play_Santeria(self):
        """It plays Santeria when `Santeria` is entered by the user"""
        with mockRawInput('Santeria'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(), "Now Playing: Santeria\n")

    def test_play_Bye_Bye_Bye(self):
        """It prints an error message when `Bye Bye Bye` is entered by the user"""
        with mockRawInput('Bye Bye Bye'):
            self.jukebox.play(self.songs)
            self.assertEqual(sys.stdout.getvalue(),
                             "Invalid input, please try again\n")

    def test_exit_jukebox(self):
        """It prints 'Goodbye'"""
        self.jukebox.exit_jukebox()
        self.assertEqual(sys.stdout.getvalue(), "Goodbye\n")

    def test_run(self):
        """It will ask for a new command after listing the songs"""
        with mockRawInput('exit'):
            self.jukebox.run(self.songs)
            self.assertEqual(
                sys.stdout.getvalue(), "I accept the following commands:\n" +
                "- help : displays this help message\n" +
                "- list : displays a list of songs you can play\n" +
                "- play : lets you choose a song to play\n"
                "- exit : exits this program\n" + "Goodbye\n")
예제 #15
0
	def __init__(self, *a, **kw):
		Jukebox.__init__(self, *a, **kw)
		self.ui = RipperThread(self)
		self.session.set_preferred_bitrate(2)
예제 #16
0
 def end_of_track(self, session):
     Jukebox.end_of_track(self, session)
     end_of_track.set()
예제 #17
0
	def end_of_track(self, session):
		Jukebox.end_of_track(self, session)
		end_of_track.set()
예제 #18
0
#Runs most optimally in Python 3.7
from jukebox import Jukebox, main_menu
from record import *
import os

mom_and_pops_jukebox = Jukebox()
mom_and_pops_jukebox.initialize_box()
os.system("clear")
mom_and_pops_jukebox.start_up()
while (main_menu):
    mom_and_pops_jukebox.start_up()