Kaynağa Gözat

remove folder old/

Miek Stagl 5 yıl önce
ebeveyn
işleme
350dbd8fc3

+ 7 - 0
CHANGELOG

@@ -29,3 +29,10 @@ Version 0.0.4
   - added tg_youtube_search.py to directory
      - This is a fork of youtube_search with custom attributes
      - ytsearch imports this library 
+  - Removed old/ folder with backup archives of previous versions
+
+FUTURE
+  - Improve logging
+    - Write logs to file as directed in config.ini at verbosity level
+    - Add actual filename/search result downloaded for each song
+      - This will improve diagnosing bad downloads for future improvements

BIN
__pycache__/tg_youtube_search.cpython-38.pyc


+ 0 - 125
old/ytsearch.save

@@ -1,125 +0,0 @@
-#!/usr/bin/python3
-
-from youtube_search import YoutubeSearch
-import os
-
-##Import list of songs, artists from list.txt
-##parse this file into a list of dictionaries
-##for each dictionary pair, search youtube and output formatted links in file
-##
-## FUTURE
-## -Config File
-##    -Default Musicfile
-##    -Defualt retrys
-##    -Default save-to location
-##    -Default verbosity and logging location
-##
-## - Download over tor
-##   - Check if Tor installed
-##   - Warn user if NOT using tor
-##
-## - Multi-thread conversion mp3
-##
-## - Retry up to X times the link-generation routine
-##
-## - Allow discogs reference number as argument
-##   - ytsearch will parse discogs website with BeautifulSoup
-##   - Find the Artist, Album Track Titles
-##   - Create folder structure locally and create list.txt
-##   - Begin processing...
-##
-## - Logging and Verbosit levels
-##
-## - Check for dependencies
-##    - Tor?
-##    - Write Permissions in log files?
-##    - YoutubeSearch
-
-##Vars
-
-DOWNLOAD=True
-MUSICFILE="list.txt"
-
-##
-
-
-music=[]	# list to hold dictionaries of songnum, Title, Artist
-logresults=[]	# list to hold results of link creation attempts, and download attempts
-linkresults=[]	#
-completed=[]	# list to hold song numbers of completed downloads so they can be removed from MUSICFILE
-
-##Open list.txt, read into music[]
-def readlist(file):
-	songnum = 0
-	with open(file) as f:
-	  for line in f:
-	    song={}
-	    (key, val) = line.split(", ")
-	    songnum += 1
-	    song['songnum'] = songnum
-	    song['Title'] = key
-	    song['Artist'] = val.rstrip()
-#	    song['raw'] = line
-	    music.append(song)
-	f.close()
-	return music
-
-def parselist(musiclist):
-	for song in musiclist:
-	  searchterm = song['Title'] + " " + song['Artist'] + ' lyrics'
-	  dictlink={}
-	  try:
-	    ytresult = YoutubeSearch(searchterm, max_results=1).to_dict() ##increase timeout!!
-	    link = 'https://youtube.com' + ytresult[0]['link']
-cherokee2
-
-cherokee2
-	    logresults.append(song['Title'] + ", " + song['Artist'] + " Link Created")
-	    if DOWNLOAD:
-              print("Attempting to download", song['Title'])
-              downloadsong(link, song)
-	    else:
-	      print("ERROR: Not Downloading for some reason")
-	  except:
-	    logresults.append(song['Title'] + ", " + song['Artist'] + " COULD NOT CREATE LINK")
-	cleanup(MUSICFILE)
-
-def downloadsong(link, song):
-       try: 
-         os.system("youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --output '%(title)s.%(ext)s' --ignore-errors " + link)
-         completed.append(song['songnum'])
-         logresults.append(song['Title'] + ", " + song['Artist'] + " Audio downloaded")
-         print("Download Complete!")
-       except e as youtubedlexception:
-         logresults.append(song['Title'] + ", " + song['Artist'] + " FAILED TO DOWNLOAD SONG (youtube-dl)")
-         print(youtubedlexception)
-	
-
-def cleanup(file):
-	print("Cleaning completed files from list")
-	print("Completed Downloads:", completed)
-
-	linenum=0
-	with open(file, "r") as f:
-	  lines = f.readlines()
-	with open(file, "w") as f:
-	  for line in lines:
-	    linenum += 1
-	    if linenum not in completed:
-	     f.write(line)
-
-	f.close()
-
-
-if __name__ == "__main__":
-	readlist(MUSICFILE)
-	parselist(music)
-
-
-print("------------")
-for r in logresults:
-  print(r)
-
-
-#print(completed)
-

+ 0 - 84
old/ytsearch.save.6_16_2020

@@ -1,84 +0,0 @@
-#!/usr/bin/python3
-
-from youtube_search import YoutubeSearch
-import os
-
-##Import list of songs, artists from list.txt
-##parse this file into a list of dictionaries
-##for each dictionary pair, search youtube and output formatted links in file
-##
-##FUTURE - remove successful downloads from text file!!
-## -assign each line read a number
-## -remember numbers that are successful downloads
-## -at end of script, delete lines from those numbers
-## -OR-
-## -Find lines that match successful downloads
-##
-## - Differentiae between Masters and Relesses when taking doscogs argument
-
-DOWNLOAD=True
-
-musicfile="list.txt"
-
-music=[]
-songnum = 0
-with open(musicfile) as f:
-  for line in f:
-    song={}
-    (key, val) = line.split(", ")
-    songnum += 1
-    song['songnum'] = songnum
-    song['Title'] = key
-    song['Artist'] = val.rstrip()
-    song['raw'] = line
-    music.append(song)
-f.close()
-
-logresults=[]
-linkresults=[]
-completed=[]
-for song in music:
-  searchterm = song['Title'] + " " + song['Artist'] + ' lyrics -Video'
-  dictlink={}
-  try:
-    ytresult = YoutubeSearch(searchterm, max_results=1).to_dict()
-    link = 'https://youtube.com' + ytresult[0]['link']
-    dictlink['Title'] = song['Title']
-    dictlink['Artist'] = song['Artist']
-    dictlink['link'] = link
-    linkresults.append(dictlink)
-    logresults.append(song['Title'] + ", " + song['Artist'] + " Link Created")
-    if DOWNLOAD:
-       print("Attempting to download", song['Title'])
-       try: 
-         os.system("youtube-dl --extract-audio --audio-format mp3 --output '%(title)s.%(ext)s' --ignore-errors " + link)
-         completed.append(song['songnum'])
-         logresults.append(song['Title'] + ", " + song['Artist'] + " Audio downloaded")
-         print("Download Complete!")
-       except e as youtubedlexception:
-         logresults.append(song['Title'] + ", " + song['Artist'] + " FAILED TO DOWNLOAD SONG (youtube-dl)")
-         print(youtubedlexception)
-    else:
-      print("ERROR: Not Downloading for some reason")
-  except:
-    logresults.append(song['Title'] + ", " + song['Artist'] + " COULD NOT CREATE LINK")
-
-print("------------")
-for r in logresults:
-  print(r)
-
-
-print(completed)
-
-print("Cleaning completed files from list")
-
-linenum=0
-with open(musicfile, "r") as f:
-  lines = f.readlines()
-with open(musicfile, "w") as f:
-  for line in lines:
-    linenum += 1
-    if linenum not in completed:
-     f.write(line)
-
-f.close()