Skip to content

Commit

Permalink
Added option to suppress console messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue9 committed Apr 6, 2017
1 parent 333ddfc commit 2f7c281
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,10 @@ $RECYCLE.BIN/

# Downloaded files
*.mp3
*.temp
*.temp

# Binary files
*.exe

# IDE files
.idea/
12 changes: 8 additions & 4 deletions audiojack.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@


class AudioJack(object):
def __init__(self, bitrate=256, small_cover_art=False):
self.ydl = youtube_dl.YoutubeDL({
def __init__(self, bitrate=256, small_cover_art=False, quiet=False):
self.opts = {
'format': 'bestaudio',
'outtmpl': '%(id)s.%(ext)s',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': str(bitrate)
}]
})
}
if quiet:
self.opts['quiet'] = 1
self.opts['no_warnings'] = 1
self.ydl = youtube_dl.YoutubeDL(self.opts)
self.small_cover_art = small_cover_art
self._cover_art_cache = {}

Expand Down Expand Up @@ -218,7 +222,7 @@ def _get_cover_art(self, album_id):


if __name__ == '__main__':
aj = AudioJack()
aj = AudioJack(quiet=True)
url = sys.argv[1]
results = aj.get_results(url)
if len(results) > 0:
Expand Down

0 comments on commit 2f7c281

Please sign in to comment.