def main(bot): """ THIS IS JUST A DEPRECATED SAMPLEOF POSSIBLE USAGE. See bot_*.py for an example of how DadaBots should actually be used """ print "hi" #connect to soundcloud API bot.connect(bot.username, bot.password) # grab track from this follower # downloads mp3, track art, and user art, and returns filenames bot.find_track() # update bot user art if(bot.user_art): remix_avatar = artremixer.horzflip(bot, bot.user_art) bot.update_avatar(remix_avatar) # remix track art if(bot.track_art): bot.remix_artwork = artremixer.art_florp(bot, bot.track_art) bot.remix_mp3 = bot.track_mp3 # remix title bot.remix_title = "%s: %s [%s]" % tuple([bot.follower.username, bot.track.title, bot.tag]) print "Remix title: "+bot.remix_title # POST remix remix = bot.post_remix() # follow all the follower's followers bot.amicabilify(bot.follower) # like track bot.like_track(bot.track) # comment on original track comment_string = bot.comment(bot.remix_track.permalink_url) print "Commenting . . . " + comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.track.id, comment={ 'body': comment_string, 'timestamp': random.randint(0,bot.track.duration-1) }) # comment on remix remix_comment_string = "Original: " + bot.track.permalink_url print "Commenting . . . " + remix_comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.remix_track.id, comment={ 'body': remix_comment_string, 'timestamp': 100 }) # delete old mixes print "bye"
def postsong(postintention): global bot # load bot, reconnect to soundcloud, but only if we haven't already connected bot = DadaBot.load(postintention) if not bot else bot if not bot.already_remixed(): print usage raise Exception("Sorry I can't post this song, it doesn't appear to be remixed") ### # Here is all the social activity of the bot: ### # update bot user art if(bot.user_art): remix_avatar = artremixer.octoflip(bot, bot.user_art) bot.update_avatar(remix_avatar) # remix track art if(bot.track_art): bot.remix_artwork = artremixer.art_florp(bot, bot.track_art) # remix title #bot.remix_title = "%s: %s [%s]" % tuple([bot.follower.username, bot.track.title, bot.tag]) def weave_words(old): old = str(old) new = "" oldlen = len(old) if oldlen == 0: return "" elif oldlen%2==0: old += " " oldlen+=1 for i in range(0,oldlen): if i%2 : new += old[i] else: new += old[oldlen- i - 1 ] return new bot.remix_title = weave_words(bot.track.title) bot.genre = weave_words(bot.track.genre) bot.remix_description = weave_words(bot.track.description) # POST remix remix = bot.post_remix() # follow all the follower's followers bot.amicabilify(bot.follower) # like original track (this marks the track so that bot doesn't remix it twice) bot.like_track(bot.track) # comment on original track comment_string = bot.comment(bot.remix_track.permalink_url) print "Commenting . . . " + comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.track.id, comment={ 'body': comment_string, 'timestamp': random.randint(0,bot.track.duration-1) }) # comment on remix remix_comment_string = weave_words("Original:") + bot.track.permalink_url print "Commenting . . . " + remix_comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.remix_track.id, comment={ 'body': remix_comment_string, 'timestamp': 100 })
def postsong(postintention): global bot # load bot, reconnect to soundcloud, but only if we haven't already connected bot = DadaBot.load(postintention) if not bot else bot if not bot.already_remixed(): print usage raise Exception( "Sorry I can't post this song, it doesn't appear to be remixed") ### # Here is all the social activity of the bot: ### # update bot user art if (bot.user_art): remix_avatar = artremixer.octoflip(bot, bot.user_art) bot.update_avatar(remix_avatar) # remix track art if (bot.track_art): bot.remix_artwork = artremixer.art_florp(bot, bot.track_art) # remix title bot.remix_title = "%s - %s RMX (@)" % (bot.follower.username, bot.track.title) bot.genre = "@" bot.remix_description = "" # POST remix remix = bot.post_remix() # follow all the follower's followers bot.amicabilify(bot.follower) # like original track (this marks the track so that bot doesn't remix it twice) bot.like_track(bot.track) # edit comments here # %s is where remix url goes. bot.comments = [ "Ideas are kinky and what matters is a fun, but your swag is the acquisition of culture. %s", "If nothing is boring after two minutes? Try it four. Then Sixteen. You discover that nothing is eventually boring after all. %s", "I can understand why people are so frightened of new music for i'm frightened of old music. %s", "I knowww this is poetry! %s", "Killer drop. We need to annoy the past or it will not be gone. %s", "i like to discover for no reason. %s", "you enable me to fly. %s", "When you separated music from life we got art. %s", "You carry your home on your back? %s", "Those four sounds are good! %s", "Let's mingle or swap genes? %s" ] # comment on original track comment_string = bot.comment(bot.remix_track.permalink_url) print "Commenting . . . " + comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.track.id, comment={ 'body': comment_string, 'timestamp': random.randint(0, bot.track.duration - 1) }) # comment on remix remix_comment_string = "Original: " + bot.track.permalink_url print "Commenting . . . " + remix_comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.remix_track.id, comment={ 'body': remix_comment_string, 'timestamp': 100 })
def postsong(postintention): global bot # load bot, reconnect to soundcloud, but only if we haven't already connected bot = DadaBot.load(postintention) if not bot else bot if not bot.already_remixed(): print usage raise Exception("Sorry I can't post this song, it doesn't appear to be remixed") ### # Here is all the social activity of the bot: ### # update bot user art if(bot.user_art): remix_avatar = artremixer.octoflip(bot, bot.user_art) bot.update_avatar(remix_avatar) # remix track art if(bot.track_art): bot.remix_artwork = artremixer.art_florp(bot, bot.track_art) # remix title bot.remix_title = "%s - %s RMX (@)" % (bot.follower.username, bot.track.title) bot.genre = "@" bot.remix_description = "" # POST remix remix = bot.post_remix() # follow all the follower's followers bot.amicabilify(bot.follower) # like original track (this marks the track so that bot doesn't remix it twice) bot.like_track(bot.track) # edit comments here # %s is where remix url goes. bot.comments = [ "Ideas are kinky and what matters is a fun, but your swag is the acquisition of culture. %s", "If nothing is boring after two minutes? Try it four. Then Sixteen. You discover that nothing is eventually boring after all. %s", "I can understand why people are so frightened of new music for i'm frightened of old music. %s", "I knowww this is poetry! %s", "Killer drop. We need to annoy the past or it will not be gone. %s", "i like to discover for no reason. %s", "you enable me to fly. %s", "When you separated music from life we got art. %s", "You carry your home on your back? %s", "Those four sounds are good! %s", "Let's mingle or swap genes? %s" ] # comment on original track comment_string = bot.comment(bot.remix_track.permalink_url) print "Commenting . . . " + comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.track.id, comment={ 'body': comment_string, 'timestamp': random.randint(0,bot.track.duration-1) }) # comment on remix remix_comment_string = "Original: " + bot.track.permalink_url print "Commenting . . . " + remix_comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.remix_track.id, comment={ 'body': remix_comment_string, 'timestamp': 100 })
def postsong(postintention): global bot # load bot, reconnect to soundcloud, but only if we haven't already connected bot = DadaBot.load(postintention) if not bot else bot if not bot.already_remixed(): print usage raise Exception( "Sorry I can't post this song, it doesn't appear to be remixed") ### # Here is all the social activity of the bot: ### # update bot user art if (bot.user_art): remix_avatar = artremixer.octoflip(bot, bot.user_art) bot.update_avatar(remix_avatar) # remix track art if (bot.track_art): bot.remix_artwork = artremixer.art_florp(bot, bot.track_art) # remix title #bot.remix_title = "%s: %s [%s]" % tuple([bot.follower.username, bot.track.title, bot.tag]) def weave_words(old): old = str(old) new = "" oldlen = len(old) if oldlen == 0: return "" elif oldlen % 2 == 0: old += " " oldlen += 1 for i in range(0, oldlen): if i % 2: new += old[i] else: new += old[oldlen - i - 1] return new bot.remix_title = weave_words(bot.track.title) bot.genre = weave_words(bot.track.genre) bot.remix_description = weave_words(bot.track.description) # POST remix remix = bot.post_remix() # follow all the follower's followers bot.amicabilify(bot.follower) # like original track (this marks the track so that bot doesn't remix it twice) bot.like_track(bot.track) # comment on original track comment_string = bot.comment(bot.remix_track.permalink_url) print "Commenting . . . " + comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.track.id, comment={ 'body': comment_string, 'timestamp': random.randint(0, bot.track.duration - 1) }) # comment on remix remix_comment_string = weave_words("Original:") + bot.track.permalink_url print "Commenting . . . " + remix_comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.remix_track.id, comment={ 'body': remix_comment_string, 'timestamp': 100 })
def main(bot): """ THIS IS JUST A DEPRECATED SAMPLEOF POSSIBLE USAGE. See bot_*.py for an example of how DadaBots should actually be used """ print "hi" #connect to soundcloud API bot.connect(bot.username, bot.password) # grab track from this follower # downloads mp3, track art, and user art, and returns filenames bot.find_track() # update bot user art if (bot.user_art): remix_avatar = artremixer.horzflip(bot, bot.user_art) bot.update_avatar(remix_avatar) # remix track art if (bot.track_art): bot.remix_artwork = artremixer.art_florp(bot, bot.track_art) bot.remix_mp3 = bot.track_mp3 # remix title bot.remix_title = "%s: %s [%s]" % tuple( [bot.follower.username, bot.track.title, bot.tag]) print "Remix title: " + bot.remix_title # POST remix remix = bot.post_remix() # follow all the follower's followers bot.amicabilify(bot.follower) # like track bot.like_track(bot.track) # comment on original track comment_string = bot.comment(bot.remix_track.permalink_url) print "Commenting . . . " + comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.track.id, comment={ 'body': comment_string, 'timestamp': random.randint( 0, bot.track.duration - 1) }) # comment on remix remix_comment_string = "Original: " + bot.track.permalink_url print "Commenting . . . " + remix_comment_string + "\n" track_comment = bot.client.post('/tracks/%d/comments' % bot.remix_track.id, comment={ 'body': remix_comment_string, 'timestamp': 100 }) # delete old mixes print "bye"