diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d9ab575 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2016 Ritiek + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index aea0203..ddc399b 100644 --- a/README.md +++ b/README.md @@ -2,65 +2,46 @@ My first GitHub Repository (sorry for any mistakes) -This python script allows downloading songs instantly by just entering the name of the song -and the artist. +This python script allows downloading songs from youtube by just entering the name of the song +and the artist in mp3 extension. -![Alt text](http://i.imgur.com/lWyA2pj.png "Testing") -## Dependencies: +# Dependencies: ``` pip install mechanize pip install bs4 pip install pafy ``` -[OPTIONAL] If you want to convert downloaded music to mp3 (from m4a) install avconv for linux or ffmpeg from https://ffmpeg.zeranoe.com/builds/ for windows and then place the ffmpeg.exe in your script folder: ``` -sudo apt-get install libav-tools -or download from https://libav.org/download/ for windows +sudo apt-get install ffmpeg +or download from https://ffmpeg.zeranoe.com/builds/ for windows and place the ffmpeg.exe in your script folder ``` -## Installation & Usage: +# Installation & Usage: ``` git clone https://github.com/Ritiek/YTMusic cd YTMusic -sudo python setup.py install -``` -or you can also install from pypi using: -``` -pip install YTMusic -``` -Run it using: -``` -YTMusic +sudo python YTMusic.py ``` -## Commands that can be used in the Script: +# Commands that can be used in the script: ``` -• play - will play the last song downloaded using default music player -• spotify - downloads songs from spotify playlist (see below:) -• convert - will convert all your m4a songs into mp3 -• exit - exit the script +2. play - will play the last song downloaded using default music player +3. gg - exit the script +4. spotify - downloads songs from spotify playlist (see below:) ``` -## Downloading Music from Spotify: +# Downloading Music from Spotify: -![Alt text](http://i.imgur.com/0dqlYpz.png "Testing") - -• To download music from spotify playlists goto http://www.playlist-converter.net/ and login to your +1. To download music from spotify playlists goto http://www.playlist-converter.net/ and login to your spotify account and choose the playlist you want to download. Let it grab the tracks and then click on ```Export to free text```. - -• Copy the songs list and create a new text file ```spotify.txt``` in your Music directory and paste the +2. Copy the songs list and create a new text file ```spotify.txt``` in your Music directory and paste the songs list. -``` -cd YTMusic/Music -sudo nano spotify.txt -[paste your songs here then ctrl+o, enter, ctrl+x] -sudo chmod 775 spotify.txt -``` -• Use the command ```spotify``` in the script to start downloading the list. +3. Use the command ```spotify``` in the script to start downloading the list. -## Disclaimer: +# Known bugs: -Downloading Copyright Music may be illegal in your country. Please support the artists by buying their Music. +1. Fails to download songs containing accents (that is, characters like 'Ø' in song like 'BØRNS Seeing Stars') +in the Youtube's video title. diff --git a/YT_Music.egg-info/PKG-INFO b/YT_Music.egg-info/PKG-INFO new file mode 100644 index 0000000..7a1397e --- /dev/null +++ b/YT_Music.egg-info/PKG-INFO @@ -0,0 +1,12 @@ +Metadata-Version: 1.1 +Name: YT-Music +Version: 0.1 +Summary: Downloads Songs and Spotify playlists. +Home-page: https://www.github.com/Ritiek/YTMusic/ +Author: Ritiek Malhotra +Author-email: ritiekmalhotra123@gmail.com +License: UNKNOWN +Download-URL: https://github.com/Ritiek/YTMusic/tarball/0.1 +Description: UNKNOWN +Keywords: download,songs,spotify,playlists,music +Platform: UNKNOWN diff --git a/YT_Music.egg-info/SOURCES.txt b/YT_Music.egg-info/SOURCES.txt new file mode 100644 index 0000000..37e8bd4 --- /dev/null +++ b/YT_Music.egg-info/SOURCES.txt @@ -0,0 +1,7 @@ +setup.cfg +setup.py +YT_Music.egg-info/PKG-INFO +YT_Music.egg-info/SOURCES.txt +YT_Music.egg-info/dependency_links.txt +YT_Music.egg-info/top_level.txt +bin/YTMusic \ No newline at end of file diff --git a/YT_Music.egg-info/dependency_links.txt b/YT_Music.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/YT_Music.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/YT_Music.egg-info/top_level.txt b/YT_Music.egg-info/top_level.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/YT_Music.egg-info/top_level.txt @@ -0,0 +1 @@ + diff --git a/build/scripts-2.7/YTMusic b/build/scripts-2.7/YTMusic index c912db7..c40505b 100644 --- a/build/scripts-2.7/YTMusic +++ b/build/scripts-2.7/YTMusic @@ -13,15 +13,15 @@ avconv = 1 if os.name == 'nt': opsys = 'win' - if not os.path.isfile('ffmpeg.exe'): - print 'avconv not found, will not convert to mp3 (from m4a)' + if not os.path.isfile('avconv.exe'): + print 'avconv not found, will not convert to mp3 (from m4a). download from https://builds.libav.org/windows/ to be able to convert them' avconv = 0 else: opsys = 'linux' check_install = os.system('which avconv > /dev/null') if check_install == '': print 'avconv not found, will not convert to mp3 (from m4a). use sudo apt-get install libav-tools to install it' - avonv = 0 + avconv = 0 def Main(): script_dir = os.getcwd() @@ -49,22 +49,42 @@ def Main(): else: print 'No log to read from..' elif raw_song == "convert": + print '' - if avconv == 1: - y = 1 - x = 0 - for m in os.listdir(script_dir + '/Music/'): - if m.endswith(".m4a"): - x = x + 1 - print 'Total songs to convert = ' + str(x) + ' songs' - for m in os.listdir(script_dir + '/Music/'): - if m.endswith(".m4a"): - print '' - print str(y) + '. ' 'Converting ' + m + ' to mp3..' - y = y + 1 - song = m.replace(".m4a", "") - os.system('sudo avconv -loglevel 0 -i "Music/' + song + '.m4a" ' + '"Music/' + song + '.mp3"') - os.remove("Music/" + m) + if opsys == 'win': + if avconv == 1: + y = 1 + x = 0 + for m in os.listdir(script_dir + '/Music/'): + if m.endswith(".m4a"): + x = x + 1 + print 'Total songs to convert = ' + str(x) + ' songs' + for m in os.listdir(script_dir + '/Music/'): + if m.endswith(".m4a"): + print '' + print str(y) + '. ' 'Converting ' + m + ' to mp3..' + y = y + 1 + song = m.replace(".m4a", "") + os.system('avconv.exe -loglevel 0 -i "Music\\' + song + '.m4a" ' + '"Music\\' + song + '.mp3"') + os.remove("Music/" + m) + else: + print 'avconv is not installed, cant convert to mp3' + elif opsys == 'linux': + if avconv == 1: + y = 1 + x = 0 + for m in os.listdir(script_dir + '/Music/'): + if m.endswith(".m4a"): + x = x + 1 + print 'Total songs to convert = ' + str(x) + ' songs' + for m in os.listdir(script_dir + '/Music/'): + if m.endswith(".m4a"): + print '' + print str(y) + '. ' 'Converting ' + m + ' to mp3..' + y = y + 1 + song = m.replace(".m4a", "") + os.system('sudo avconv -loglevel 0 -i "Music/' + song + '.m4a" ' + '"Music/' + song + '.mp3"') + os.remove("Music/" + m) else: print 'avconv is not installed, cant convert to mp3' elif raw_song == "spotify": @@ -171,4 +191,4 @@ def Main(): except KeyboardInterrupt: pass -Main() +Main() \ No newline at end of file diff --git a/dist/YTMusic-0.1-py2.7.egg b/dist/YTMusic-0.1-py2.7.egg index 60bf0c2..a8cda5f 100644 Binary files a/dist/YTMusic-0.1-py2.7.egg and b/dist/YTMusic-0.1-py2.7.egg differ diff --git a/dist/YTMusic-0.1.tar.gz b/dist/YTMusic-0.1.tar.gz new file mode 100644 index 0000000..2dd44a0 Binary files /dev/null and b/dist/YTMusic-0.1.tar.gz differ diff --git a/dist/YT_Music-0.1.tar.gz b/dist/YT_Music-0.1.tar.gz new file mode 100644 index 0000000..894aef4 Binary files /dev/null and b/dist/YT_Music-0.1.tar.gz differ diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b88034e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md diff --git a/setup.py b/setup.py index 8802b44..8230463 100644 --- a/setup.py +++ b/setup.py @@ -8,11 +8,14 @@ if sys.version_info > (3,0): from setuptools import setup, find_packages -setup(name='YTMusic', +setup(name='YT_Music', version='0.1', - description='Download songs just by entering the song name and artist.', + description='Downloads Songs and Spotify playlists.', author='Ritiek Malhotra', author_email='ritiekmalhotra123@gmail.com', - url='https://www.github.com/Ritiek/YTMusic/', scripts=['bin/YTMusic'], + url='https://www.github.com/Ritiek/YTMusic/', + download_url = 'https://github.com/Ritiek/YTMusic/tarball/0.1', + keywords = ['download', 'songs', 'spotify', 'playlists', 'music'], + classifiers = [], )