def config_setup(args): """Usage: recorder config setup [ -u | -p ] Setup program settings. A new settings file is created. Options: -u Create user settings in ~/.capturadio -p Crete local settings in current work directory """ config = Configuration() bbcradio2 = config.add_station( "bbc2", "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p?s=1423688987&e=1423703387&h=1f97ff4f9b0e0f1ae988bdf684f233b3", "BBC Radio 2", "http://www.bbc.co.uk/radio2/images/homepage/bbcradio2.gif", ) bobharriscountry = config.add_show(bbcradio2, "bobharriscountry", "Bob Harris Country", parse_duration("58m")) bobharriscountry.link_url = "http://www.bbc.co.uk/programmes/b006x527" bobharrissunday = config.add_show(bbcradio2, "bobharrissunday", "Bob Harris Sunday", parse_duration("2h57m")) bobharrissunday.link_url = "http://www.bbc.co.uk/programmes/b006wqtf" config.write_config() print( """ Created a new configuration at %(filename)s. The URL is set to %(url)s and the files are stored at %(destination)s. You can change all settings by editing %(filename)s and you are engcouraged to do that. Use the command 'config list' to see all settings.""" % {"destination": config.destination, "filename": config.filename, "url": config.feed["base_url"]} )
def test_add_station(test_folder): configuration = Configuration(reset=True, folder=str(test_folder)) assert configuration.folder == test_folder configuration.add_station( 'me', 'http://example.org/stream', 'Me', 'http://example.org/logo.png' ) assert ['me', 'dkultur', 'dlf', 'wdr2'] == configuration.get_station_ids() station = configuration.stations['me'] assert isinstance(station, Station) assert station.name == 'Me' assert station.id == 'me' assert station.logo_url == 'http://example.org/logo.png' assert station.stream_url == 'http://example.org/stream' assert station.shows == []
def config_setup(args): """Usage: recorder config setup [ -u | -p ] Setup program settings. A new settings file is created. Options: -u Create user settings in ~/.capturadio -p Crete local settings in current work directory """ config = Configuration() bbcradio2 = config.add_station( 'bbc2', 'http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p?s=1423688987&e=1423703387&h=1f97ff4f9b0e0f1ae988bdf684f233b3', 'BBC Radio 2', 'http://www.bbc.co.uk/radio2/images/homepage/bbcradio2.gif' ) bobharriscountry = config.add_show( bbcradio2, 'bobharriscountry', 'Bob Harris Country', parse_duration('58m'), ) bobharriscountry.link_url = 'http://www.bbc.co.uk/programmes/b006x527' bobharrissunday = config.add_show( bbcradio2, 'bobharrissunday', 'Bob Harris Sunday', parse_duration('2h57m'), ) bobharrissunday.link_url = 'http://www.bbc.co.uk/programmes/b006wqtf' config.write_config() print """ Created a new configuration at %(filename)s. The URL is set to %(url)s and the files are stored at %(destination)s. You can change all settings by editing %(filename)s and you are engcouraged to do that. Use the command 'config list' to see all settings.""" % { 'destination': config.destination, 'filename': config.filename, 'url': config.feed['base_url'], }