<commit_before>#!/usr/bin/python

import os
import subprocess
import tempfile
import json
import shutil

#~/Dropbox/IFTTT/YouTube/YouTube2MP3Hook

dropbox_filename='/home/rpetti/Dropbox/IFTTT/YouTube/youtube2mp3hook.txt'
artist_filter_file='/home/rpetti/Dropbox/IFTTT/YouTube/MusicArtists.txt'

artist_list = []

with open(artist_filter_file) as f:
	artist_list = f.readlines();

def is_url_from_approved_artist(url):
	json_data = subprocess.check_output(["youtube-dl","-j",url])
	metadata = json.loads(json_data)
	uploader = metadata[u'uploader']
	if uploader in artist_list:
		return True
	else:
		return False

def download_song(url):
	subprocess.call(["yt-mp3.py",url])

if os.path.isfile(dropbox_filename):
	tempdir = tempfile.mkdtemp()
	newfilename=tempdir+"/favoritelist"
	os.rename(dropbox_filename,newfilename)
	with open(newfilename) as f:
		for line in f:
			url = line.strip()
			if len(url) > 0:
				if is_url_from_approved_artist(url):
					download_song(url)
	shutil.rmtree(tempdir)
	subprocess.call(["viper-nofify","yt-2-mp3","favorites downloaded"])
else:
	print "no new favorites to check"
<commit_msg>comment out notifications for now<commit_after>#!/usr/bin/python

import os
import subprocess
import tempfile
import json
import shutil

#~/Dropbox/IFTTT/YouTube/YouTube2MP3Hook

dropbox_filename='/home/rpetti/Dropbox/IFTTT/YouTube/youtube2mp3hook.txt'
artist_filter_file='/home/rpetti/Dropbox/IFTTT/YouTube/MusicArtists.txt'

artist_list = []

with open(artist_filter_file) as f:
	artist_list = f.readlines();

def is_url_from_approved_artist(url):
	json_data = subprocess.check_output(["youtube-dl","-j",url])
	metadata = json.loads(json_data)
	uploader = metadata[u'uploader']
	if uploader in artist_list:
		return True
	else:
		return False

def download_song(url):
	subprocess.call(["yt-mp3.py",url])

if os.path.isfile(dropbox_filename):
	tempdir = tempfile.mkdtemp()
	newfilename=tempdir+"/favoritelist"
	os.rename(dropbox_filename,newfilename)
	with open(newfilename) as f:
		for line in f:
			url = line.strip()
			if len(url) > 0:
				if is_url_from_approved_artist(url):
					download_song(url)
	shutil.rmtree(tempdir)
	#subprocess.call(["viper-nofify","yt-2-mp3","favorites downloaded"])
else:
	print "no new favorites to check"

{'fraction_non_alphanumeric': 0.12693498452012383, 'fraction_numerical': 0.007076514816452897, 'mean_word_length': 5.7522388059701495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1173378', 'n_tokens_mistral': 901, 'n_tokens_neox': 865, 'n_words': 150}