Example #1
0
def foobnix():

    if "--debug" in sys.argv:
        LOG.with_print = True
        for param in sys.argv:
            if param.startswith("--log"):
                if "=" in param:
                    filepath = param[param.index("=") + 1:]
                    if filepath.startswith('~'):
                        filepath = os.path.expanduser("~") + filepath[1:]
                else:
                    filepath = os.path.join(CONFIG_DIR, "foobnix.log")
                LOG.setup("debug", filename=filepath)
        else:
            LOG.setup("debug")
        LOG.print_platform_info()
    else:
        LOG.setup("error")

    from foobnix.gui.foobnix_core import FoobnixCore

    if "--test" in sys.argv:
        from test.all import run_all_tests
        print("""TEST MODE""")
        result = run_all_tests(ignore="test_core")
        if not result:
            raise SystemExit("Test failures are listed above.")
        exit()

    init_time = time.time()

    if "--nt" in sys.argv or os.name == 'nt':
        core = FoobnixCore(False)
        core.run()
        analytics.begin_session()
        print("******Foobnix run in",
              time.time() - init_time, " seconds******")
        Gtk.main()
    else:
        init_time = time.time()
        from foobnix.gui.controls.dbus_manager import foobnix_dbus_interface
        iface = foobnix_dbus_interface()
        if "--debug" in sys.argv or not iface:
            print("start program")
            core = FoobnixCore(True)
            core.run()
            analytics.begin_session()
            #core.dbus.parse_arguments(sys.argv)
            analytics.begin_session()
            print("******Foobnix run in",
                  time.time() - init_time, " seconds******")
            if sys.argv:
                Timer(1, GLib.idle_add,
                      [core.check_for_media, sys.argv]).start()

            Gtk.main()
        else:
            print(iface.parse_arguments(sys.argv))
Example #2
0
def foobnix():

    if "--debug" in sys.argv:
        LOG.with_print = True
        for param in sys.argv:
            if param.startswith("--log"):
                if "=" in param:
                    filepath = param[param.index("=")+1 : ]
                    if filepath.startswith('~'):
                        filepath = os.path.expanduser("~") + filepath[1 : ]
                else:
                    filepath = os.path.join(CONFIG_DIR, "foobnix.log")
                LOG.setup("debug", filename=filepath)
        else:
            LOG.setup("debug")
        LOG.print_platform_info()
    else:
        LOG.setup("error")

    from foobnix.gui.foobnix_core import FoobnixCore

    if "--test" in sys.argv:
        from test.all import run_all_tests
        print("""TEST MODE""")
        result = run_all_tests(ignore="test_core")
        if not result:
            raise SystemExit("Test failures are listed above.")
        exit()

    init_time = time.time()

    if "--nt" in sys.argv or os.name == 'nt':
        GLib.threads_init() #@UndefinedVariable
        core = FoobnixCore(False)
        core.run()
        analytics.begin_session()
        print("******Foobnix run in", time.time() - init_time, " seconds******")
        Gtk.main()
    else:
        init_time = time.time()
        from foobnix.gui.controls.dbus_manager import foobnix_dbus_interface
        iface = foobnix_dbus_interface()
        if "--debug" in sys.argv or not iface:
            print("start program")
            GLib.threads_init()    #@UndefinedVariable
            core = FoobnixCore(True)
            core.run()
            analytics.begin_session()
            #core.dbus.parse_arguments(sys.argv)
            analytics.begin_session()
            print("******Foobnix run in", time.time() - init_time, " seconds******")
            if sys.argv:
                Timer(1, GLib.idle_add, [core.check_for_media, sys.argv]).start()

            Gtk.main()
        else:
            print(iface.parse_arguments(sys.argv))
Example #3
0
def get_radio_source(url):
    LOG.fprint(url)
    if url:
        if url.lower().endswith(".pls"):
            source_url = getStationPath(url)
            if source_url:
                logging.info("Radio url " + source_url)
                return source_url

        elif url.lower().endswith(".m3u"):
            content = get_content(url)
            if not content:
                return None
            for line in content.rsplit():
                if line.startswith("http://") and is_valid_station(line):
                    logging.info("Radio url " + line)
                    return line

    logging.info("Radio url " + url)
    return url
Example #4
0
def get_radio_source(url):
    LOG.fprint(url)
    if url:
        if url.lower().endswith(".pls"):
            source_url = getStationPath(url)
            if source_url:
                logging.info("Radio url " + source_url)
                return source_url

        elif url.lower().endswith(".m3u"):
            content = get_content(url)
            if not content:
                return None
            for line in content.rsplit():
                if line.startswith("http://") and is_valid_station(line):
                    logging.info("Radio url " + line)
                    return line

    logging.info("Radio url " + url)
    return url
Example #5
0
def foobnix():
    if "--debug" in sys.argv:
        LOG.setup("debug")
        LOG.print_platform_info()
    else:
        LOG.setup("error")
        #LOG.setup("debug")

    from foobnix.regui.foobnix_core import FoobnixCore

    if "--test" in sys.argv:
        from test.all import run_all_tests
        print("""TEST MODE""")
        result = run_all_tests(ignore="test_core")
        if not result:
            raise SystemExit("Test failures are listed above.")
        exit()

    init_time = time.time()

    if "--nt" in sys.argv or os.name == 'nt':
        gobject.threads_init()  #@UndefinedVariable
        core = FoobnixCore(False)
        core.run()
        print("******Foobnix run in",
              time.time() - init_time, " seconds******")
        gtk.main()
    else:
        init_time = time.time()
        from foobnix.regui.controls.dbus_manager import foobnix_dbus_interface
        iface = foobnix_dbus_interface()
        if "--debug" in sys.argv or not iface:
            print("start program")
            gobject.threads_init()  #@UndefinedVariable
            core = FoobnixCore(True)
            core.run()
            core.dbus.parse_arguments(sys.argv)
            print("******Foobnix run in",
                  time.time() - init_time, " seconds******")
            gtk.main()

        else:
            print(iface.parse_arguments(sys.argv))
Example #6
0
def foobnix():
    if "--debug" in sys.argv:
        LOG.setup("debug")
        LOG.print_platform_info()
    else:
        LOG.setup("error")
        #LOG.setup("debug")
    
    from foobnix.regui.foobnix_core import FoobnixCore
    
    if "--test" in sys.argv:
        from test.all import run_all_tests
        print ("""TEST MODE""")
        result = run_all_tests(ignore="test_core")
        if not result:        
            raise SystemExit("Test failures are listed above.")
        exit()
    
    init_time = time.time()
    
    if "--nt" in sys.argv or os.name == 'nt':    
        gobject.threads_init() #@UndefinedVariable
        core = FoobnixCore(False)
        core.run()
        print ("******Foobnix run in", time.time() - init_time, " seconds******")
        gtk.main()
    else:
        init_time = time.time() 
        from foobnix.regui.controls.dbus_manager import foobnix_dbus_interface
        iface = foobnix_dbus_interface()
        if "--debug" in sys.argv or not iface:
            print ("start program")
            gobject.threads_init()    #@UndefinedVariable
            core = FoobnixCore(True)
            core.run()
            #core.dbus.parse_arguments(sys.argv)
            print ("******Foobnix run in", time.time() - init_time, " seconds******")
            if sys.argv:
                Timer(1, gobject.idle_add, [core.check_for_media, sys.argv]).start()
            gtk.main()
        else:
            print (iface.parse_arguments(sys.argv))