예제 #1
0
def get_new_releases():
    config = RdioConfig('config.ini')
    rdio_caller = RdioCaller(config)
    time_frames = ['thisweek', 'lastweek', 'twoweeks']
    for time_frame in time_frames:
        new_releases = rdio_caller.get_new_releases(time_frame)

        today = date.today()
        weeknumber = today.isocalendar()[1]
        if today.weekday() == 0:
            weeknumber -= 1

        if time_frame == 'lastweek':
            weeknumber -= 1
        elif time_frame == 'twoweeks':
            weeknumber -= 2

        year_number = today.isocalendar()[0]

        dest_dir = config.get_downloader_path()
        year_dir = os.path.join(dest_dir, str(year_number))

        if not os.path.exists(year_dir):
            os.makedirs(year_dir)

        file_name = 'music-%02d.json' % weeknumber
        abs_path = os.path.join(year_dir, file_name)
        rdio_caller.save_result(abs_path, new_releases)
예제 #2
0
def main():
    from pprint import pprint

    config = RdioConfig("config.ini")
    options = RdioOptions(config.get_rdio_key(), config.get_rdio_secret())
    # options.authenticate = True
    instance = RdioHelper(options)
    song = instance.getObjectFromShortCode("QE9MK29_fA")
    pprint(song)
예제 #3
0
def identical_test():
    config = RdioConfig('config.ini')

    src_link = 'http://www.rdio.com/artist/Mastodon/album/The_Hunter/'

    linkshare_helper = LinkShareHelper(config.get_linkshare_key(),
        config.get_linkshare_merchant_id())

    simple_link = linkshare_helper.generate_link_simple(src_link)
    link = linkshare_helper.generate_link(src_link)
    if link == simple_link:
        print "Same!"
    else:
        print "Different!"